• R/O
  • HTTP
  • SSH
  • HTTPS

DelesteRandomSelector: Commit

開発Git


Commit MetaInfo

Revisiona3fb73b85c3dc3ce059764c4fc29d9f05ae4b498 (tree)
Time2021-08-05 18:51:28
Authorhizumiaoba <56146205+hizumiaoba@user...>
CommiterGitHub

Log Message

Merge pull request #11 from hizumiaoba/TwitterIntegrated

Releasing major

Change Summary

Incremental Difference

--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,9 @@
44 .settings/
55
66 #Ignore binary files
7-bin/
\ No newline at end of file
7+bin/
8+
9+#Ignore Twitter Consumer keys
10+twitterToken.json
11+TwitterIntegration.java
12+TwitterToken.java
--- a/README.md
+++ b/README.md
@@ -23,10 +23,10 @@ THIS SOFTWARE DEPENDS ON APACHE LICENSE 2.0 BECAUSE THIS USED SOME LIBRARIES WHI
2323
2424 |設定項目|値|デフォルト|説明|
2525 |:--:|:--:|:--:|:--:|
26-|`checkVersion`|`true`/`false`|`true`|アプリケーションのバージョンをチェックします|
26+|`checkVersion`|`true`/`false`|`true`|アプリケーションのバージョンをチェックします(機能作成中のためこの値は使用していません)|
2727 |`checkLibaryUpdates`|`true`/`false`|`true`|楽曲ライブラリの更新を毎回チェックします|
28-|`windowWidth`|1以上の整数値|`640`|ウィンドウの横長さを指定します|
29-|`windowHeight`|1以上の整数値|`360`|ウィンドウの縦長さを指定します|
28+|`windowWidth`|1以上の整数値|`640`|ウィンドウの横長さを指定します(機能作成中のためこの値は使用していません)|
29+|`windowHeight`|1以上の整数値|`360`|ウィンドウの縦長さを指定します(機能作成中のためこの値は使用していません)|
3030 |`songLimit`|1以上の整数値|`3`|ランダム選曲する最大曲数を指定します|
31-|`saveScoreLog`|`true`/`false`|`false`|スコアデータを保存するかどうか指定します|
31+|`saveScoreLog`|`true`/`false`|`false`|スコアデータを保存するかどうか指定します(機能作成中のためこの値は使用していません)|
3232 |`outputDebugSentences`|`true`/`false`|`false`|標準出力へログを流すかどうか指定します
\ No newline at end of file
--- a/database.json
+++ b/database.json
@@ -11312,7 +11312,7 @@
1131211312 }, {
1131311313 "attribute" : "全タイプ",
1131411314 "name" : "イケナイGO AHEAD",
11315- "difficulty" : "MASTER+",
11315+ "difficulty" : "ⓁMASTER+",
1131611316 "level" : 29,
1131711317 "notes" : 973
1131811318 }, {
@@ -11705,5 +11705,71 @@
1170511705 "difficulty" : "MASTER+",
1170611706 "level" : 29,
1170711707 "notes" : 999
11708+ }, {
11709+ "attribute" : "パッション",
11710+ "name" : "モーレツ★世直しギルティ!",
11711+ "difficulty" : "LIGHT",
11712+ "level" : 8,
11713+ "notes" : 219
11714+ }, {
11715+ "attribute" : "パッション",
11716+ "name" : "モーレツ★世直しギルティ!",
11717+ "difficulty" : "TRICK",
11718+ "level" : 17,
11719+ "notes" : 417
11720+ }, {
11721+ "attribute" : "全タイプ",
11722+ "name" : "With Love",
11723+ "difficulty" : "LIGHT",
11724+ "level" : 6,
11725+ "notes" : 139
11726+ }, {
11727+ "attribute" : "全タイプ",
11728+ "name" : "With Love",
11729+ "difficulty" : "TRICK",
11730+ "level" : 16,
11731+ "notes" : 329
11732+ }, {
11733+ "attribute" : "全タイプ",
11734+ "name" : "イケナイGO AHEAD",
11735+ "difficulty" : "MASTER+",
11736+ "level" : 29,
11737+ "notes" : 975
11738+ }, {
11739+ "attribute" : "パッション",
11740+ "name" : "思い出じゃない今日を",
11741+ "difficulty" : "MASTER+",
11742+ "level" : 28,
11743+ "notes" : 896
11744+ }, {
11745+ "attribute" : "キュート",
11746+ "name" : "Secret Mirage",
11747+ "difficulty" : "DEBUT",
11748+ "level" : 6,
11749+ "notes" : 80
11750+ }, {
11751+ "attribute" : "キュート",
11752+ "name" : "Secret Mirage",
11753+ "difficulty" : "REGULAR",
11754+ "level" : 13,
11755+ "notes" : 185
11756+ }, {
11757+ "attribute" : "キュート",
11758+ "name" : "Secret Mirage",
11759+ "difficulty" : "PRO",
11760+ "level" : 17,
11761+ "notes" : 370
11762+ }, {
11763+ "attribute" : "キュート",
11764+ "name" : "Secret Mirage",
11765+ "difficulty" : "MASTER",
11766+ "level" : 25,
11767+ "notes" : 558
11768+ }, {
11769+ "attribute" : "キュート",
11770+ "name" : "Secret Mirage",
11771+ "difficulty" : "MASTER+",
11772+ "level" : 28,
11773+ "notes" : 757
1170811774 } ]
1170911775 }
\ No newline at end of file
--- a/settings.json
+++ b/settings.json
@@ -5,5 +5,5 @@
55 "windowHeight" : 360,
66 "songLimit" : 3,
77 "saveScoreLog" : false,
8- "outputDebugSentences" : false
8+ "outputDebugSentences" : true
99 }
\ No newline at end of file
--- a/src/com/ranfa/main/DelesteRandomSelector.java
+++ b/src/com/ranfa/main/DelesteRandomSelector.java
@@ -36,9 +36,10 @@ import com.ranfa.lib.Scraping;
3636 import com.ranfa.lib.SettingJSONProperty;
3737 import com.ranfa.lib.Settings;
3838 import com.ranfa.lib.Song;
39+import com.ranfa.lib.TwitterIntegration;
3940 import com.ranfa.lib.Version;
4041
41-@Version(major = 0, minor = 2, patch = 1)
42+@Version(major = 1, minor = 0, patch = 0)
4243 public class DelesteRandomSelector extends JFrame {
4344
4445 private static ArrayList<Song> selectedSongsList = new ArrayList<Song>();
@@ -62,8 +63,10 @@ public class DelesteRandomSelector extends JFrame {
6263 private JComboBox comboDifficultySelect;
6364 private JLabel labelLvCaution;
6465 private JComboBox comboAttribute;
65-
6666 private SettingJSONProperty property = new SettingJSONProperty();
67+ private JButton btnTwitterIntegration;
68+ private String[] integratorArray;
69+ private boolean integratorBool = false;
6770
6871 /**
6972 * Launch the application.
@@ -132,7 +135,7 @@ public class DelesteRandomSelector extends JFrame {
132135 CompletableFuture<ArrayList<Song>> getFromJsonFuture = CompletableFuture.supplyAsync(() -> Scraping.getFromJson(), es);
133136 CompletableFuture<ArrayList<Song>> getWholeDataFuture = CompletableFuture.supplyAsync(() -> Scraping.getWholeData(), es);
134137 getWholeDataFuture.thenAcceptAsync(list -> LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: Scraping data size:" + list.size()), es);
135- getFromJsonFuture.thenAcceptAsync(list -> LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO] Currently database size:" + list.size()), es);
138+ getFromJsonFuture.thenAcceptAsync(list -> LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: Currently database size:" + list.size()), es);
136139 LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[DEBUG]: " + "Version:" + getVersion());
137140 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
138141 setBounds(100, 100, 640, 360);
@@ -221,15 +224,21 @@ public class DelesteRandomSelector extends JFrame {
221224 new RowSpec[] {
222225 RowSpec.decode("26px"),
223226 FormSpecs.RELATED_GAP_ROWSPEC,
224- RowSpec.decode("max(50dlu;default)"),
227+ RowSpec.decode("max(36dlu;default)"),
225228 FormSpecs.RELATED_GAP_ROWSPEC,
226229 FormSpecs.DEFAULT_ROWSPEC,
227230 FormSpecs.RELATED_GAP_ROWSPEC,
228- RowSpec.decode("max(50dlu;default)"),
231+ RowSpec.decode("max(30dlu;default)"),
229232 FormSpecs.RELATED_GAP_ROWSPEC,
230233 RowSpec.decode("max(15dlu;default)"),
231234 FormSpecs.RELATED_GAP_ROWSPEC,
232- RowSpec.decode("max(11dlu;default)"),}));
235+ RowSpec.decode("max(11dlu;default)"),
236+ FormSpecs.RELATED_GAP_ROWSPEC,
237+ FormSpecs.DEFAULT_ROWSPEC,
238+ FormSpecs.RELATED_GAP_ROWSPEC,
239+ FormSpecs.DEFAULT_ROWSPEC,
240+ FormSpecs.RELATED_GAP_ROWSPEC,
241+ FormSpecs.DEFAULT_ROWSPEC,}));
233242
234243 btnImport = new JButton("<html><body>楽曲<br>絞り込み</body></html>");
235244 btnImport.addActionListener(new ActionListener() {
@@ -242,6 +251,7 @@ public class DelesteRandomSelector extends JFrame {
242251 selectedSongsList.clear();
243252 selectedSongsList.addAll(specificAttributeList);
244253 LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " +"Songs are selected.We are Ready to go.");
254+ JOptionPane.showMessageDialog(null, "絞り込み完了!「開始」をクリックすることで選曲できます!");
245255 }
246256 });
247257 btnImport.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
@@ -252,9 +262,11 @@ public class DelesteRandomSelector extends JFrame {
252262 public void actionPerformed(ActionEvent e) {
253263 Random random = new Random(System.currentTimeMillis());
254264 String[] tmp = new String[property.getSongLimit()];
265+ integratorArray = new String[property.getSongLimit()];
255266 for(int i = 0; i < property.getSongLimit(); i++) {
256267 int randomInt = random.nextInt(selectedSongsList.size());
257268 tmp[i] = (i + 1) + "曲目: " + selectedSongsList.get(randomInt).getAttribute() + " [" + selectedSongsList.get(randomInt).getDifficulty() + "]「" + selectedSongsList.get(randomInt).getName() + "」!(Lv:" + selectedSongsList.get(randomInt).getLevel() + ")\n\n";
269+ integratorArray[i] = selectedSongsList.get(randomInt).getName() + "\n";
258270 }
259271 String paneString = "";
260272 for (int i = 0; i < tmp.length; i++) {
@@ -262,25 +274,81 @@ public class DelesteRandomSelector extends JFrame {
262274 }
263275 paneString = paneString + "この" + tmp.length + "曲をプレイしましょう!!!";
264276 textPane.setText(paneString);
277+ integratorBool = true;
265278 LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "show up completed.");
266279 }
267280 });
268281 btnStart.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
269282 panelEast.add(btnStart, "1, 7, fill, fill");
270283
271- btnExit = new JButton("終了");
272- btnExit.addActionListener(new ActionListener() {
273- public void actionPerformed(ActionEvent e) {
274- LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " +"Requested Exit by Button");
275- if(getWholeDataFuture.isDone()) {
276- System.exit(0);
277- } else {
278- JOptionPane.showMessageDialog(null, "非同期処理が完了していません。少し時間が経ってからやり直してください。");
279- }
280- }
281- });
282- btnExit.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
283- panelEast.add(btnExit, "1, 11");
284+ btnTwitterIntegration = new JButton("Twitter連携");
285+ btnTwitterIntegration.addActionListener(new ActionListener() {
286+ public void actionPerformed(ActionEvent e) {
287+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Twitter Integration requested.Verify permission status.");
288+ boolean authorizationStatus = TwitterIntegration.authorization();
289+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Permission Verifying completed.\nStatus: " + authorizationStatus);
290+ System.out.print("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Construction status message...");
291+ String updatedStatus = "デレステ課題曲セレクターで\n";
292+ int lengthLimit = updatedStatus.length();
293+ boolean isBroken = false;
294+ if(!integratorBool) {
295+ JOptionPane.showMessageDialog(null, "ちひろ「まだプレイを始めていないみたいですね」");
296+ System.out.println();
297+ return;
298+ }
299+ for(int i = 0; i < integratorArray.length; i++) {
300+ updatedStatus = updatedStatus + integratorArray[i];
301+ lengthLimit += integratorArray[i].length();
302+ if(lengthLimit > 69) {
303+ isBroken = true;
304+ break;
305+ }
306+ }
307+ if(isBroken) {
308+ updatedStatus = updatedStatus + "…その他数曲\nをプレイしました!\n#DelesteRandomSelector #デレステ ";
309+ } else {
310+ updatedStatus = updatedStatus + "をプレイしました!\n#DelesteRandomSelector #デレステ ";
311+ }
312+ System.out.println("completed.\n" + updatedStatus);
313+ lengthLimit = updatedStatus.length();
314+ if(authorizationStatus) {
315+ int option = JOptionPane.showConfirmDialog(null, "Twitterへ以下の内容を投稿します。よろしいですか?\n\n" + updatedStatus + "\n\n文字数:" + lengthLimit);
316+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "User selected " + option);
317+ switch(option) {
318+ case JOptionPane.OK_OPTION:
319+ TwitterIntegration.PostTwitter(updatedStatus);
320+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "Success to update the status.");
321+ JOptionPane.showMessageDialog(null, "投稿が完了しました。");
322+ break;
323+ case JOptionPane.NO_OPTION:
324+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "There is no will to post.");
325+ break;
326+ case JOptionPane.CANCEL_OPTION:
327+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " + "The Operation was canceled by user.");
328+ break;
329+ default:
330+ break;
331+ }
332+ } else {
333+ System.out.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[WARN]: " + "seems to reject the permission.it should need try again.");
334+ }
335+ }
336+ });
337+ panelEast.add(btnTwitterIntegration, "1, 11");
338+
339+ btnExit = new JButton("終了");
340+ btnExit.addActionListener(new ActionListener() {
341+ public void actionPerformed(ActionEvent e) {
342+ LimitedLog.println("[" + Thread.currentThread().toString() + "]:" + this.getClass() + ":[INFO]: " +"Requested Exit by Button");
343+ if(getWholeDataFuture.isDone()) {
344+ System.exit(0);
345+ } else {
346+ JOptionPane.showMessageDialog(null, "非同期処理が完了していません。少し時間が経ってからやり直してください。");
347+ }
348+ }
349+ });
350+ btnExit.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
351+ panelEast.add(btnExit, "1, 13");
284352
285353 panelCentre = new JPanel();
286354 contentPane.add(panelCentre, BorderLayout.CENTER);
Show on old repository browser