タイニー番組ナビゲータ本体
Revision | 783555a783ea9612c144ed1585a4da0b92236748 (tree) |
---|---|
Zeit | 2018-09-07 22:10:32 |
Autor | Masahiko Kimura <mkimura@u01....> |
Commiter | Masahiko Kimura |
Ver.1.8 (2018/09/07):
@@ -1342,7 +1342,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
1342 | 1342 | |
1343 | 1343 | // 第1階層のノード、第2階層のノード名を取得する |
1344 | 1344 | JTreeLabel.Nodes node1 = JTreeLabel.Nodes.getNode(path.getPathComponent(1).toString()); |
1345 | - String node2 = path.getPathComponent(2).toString(); | |
1345 | + String node2 = path.getPathCount() > 2 ? path.getPathComponent(2).toString() : ""; | |
1346 | 1346 | |
1347 | 1347 | // 当日の日付を計算する |
1348 | 1348 | int correct = 0; // 24:00-28:59迄は前日の日付になる |
@@ -2441,21 +2441,18 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
2441 | 2441 | } |
2442 | 2442 | } |
2443 | 2443 | else if (e.getButton() == MouseEvent.BUTTON1) { |
2444 | - // 過去ログは閲覧のみ | |
2445 | - if (tvd.type == ProgType.PASSED) { | |
2446 | - if (e.getClickCount() == 2) { | |
2447 | - MWin.appendMessage(MSGID+"過去ログでダブルクリックは利用できません"); | |
2448 | - ringBeep(); | |
2449 | - } | |
2450 | - | |
2451 | - return; | |
2452 | - } | |
2453 | - | |
2454 | 2444 | if ( e.getClickCount() == 1 ) { |
2455 | 2445 | // 番組詳細表示のロック or 解除(トグル) |
2456 | 2446 | setDetailInfo(tvd, tvd != detailInfoData); |
2457 | 2447 | } |
2458 | 2448 | else if (e.getClickCount() == 2) { |
2449 | + // 過去ログは閲覧のみ | |
2450 | + if (tvd.type == ProgType.PASSED) { | |
2451 | + MWin.appendMessage(MSGID+"過去ログでダブルクリックは利用できません"); | |
2452 | + ringBeep(); | |
2453 | + return; | |
2454 | + } | |
2455 | + | |
2459 | 2456 | // 左ダブルクリックで予約ウィンドウを開く |
2460 | 2457 | openReserveDialog(tvd); |
2461 | 2458 | } |
@@ -55,7 +55,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
55 | 55 | |
56 | 56 | private static final long serialVersionUID = 1L; |
57 | 57 | |
58 | - public static String getViewName() { return "各種設定"; } | |
58 | + public static String getViewName() { return "各種設定"; } | |
59 | 59 | |
60 | 60 | public void setDebug(boolean b) { debug = b; } |
61 | 61 | private static boolean debug = false; |
@@ -63,19 +63,19 @@ public abstract class AbsSettingView extends JScrollPane { | ||
63 | 63 | /******************************************************************************* |
64 | 64 | * 抽象メソッド |
65 | 65 | ******************************************************************************/ |
66 | - | |
66 | + | |
67 | 67 | protected abstract Env getEnv(); |
68 | 68 | protected abstract ClipboardInfoList getCbItemEnv(); |
69 | - | |
69 | + | |
70 | 70 | protected abstract VWLookAndFeel getLAFEnv(); |
71 | 71 | protected abstract VWFont getFontEnv(); |
72 | - | |
73 | - protected abstract StatusWindow getStWin(); | |
72 | + | |
73 | + protected abstract StatusWindow getStWin(); | |
74 | 74 | protected abstract StatusTextArea getMWin(); |
75 | - | |
75 | + | |
76 | 76 | protected abstract Component getParentComponent(); |
77 | - protected abstract VWColorChooserDialog getCcWin(); | |
78 | - | |
77 | + protected abstract VWColorChooserDialog getCcWin(); | |
78 | + | |
79 | 79 | protected abstract void lafChanged(String lafname); |
80 | 80 | protected abstract void fontChanged(String fn, int fontSize); |
81 | 81 | protected abstract void setEnv(boolean reload_prog); |
@@ -83,23 +83,23 @@ public abstract class AbsSettingView extends JScrollPane { | ||
83 | 83 | /******************************************************************************* |
84 | 84 | * 呼び出し元から引き継いだもの |
85 | 85 | ******************************************************************************/ |
86 | - | |
86 | + | |
87 | 87 | // オブジェクト |
88 | 88 | private final Env env = getEnv(); |
89 | 89 | private final ClipboardInfoList cbitems = getCbItemEnv(); |
90 | - | |
90 | + | |
91 | 91 | private final StatusWindow StWin = getStWin(); // これは起動時に作成されたまま変更されないオブジェクト |
92 | 92 | private final StatusTextArea MWin = getMWin(); // これは起動時に作成されたまま変更されないオブジェクト |
93 | - | |
93 | + | |
94 | 94 | private final Component parent = getParentComponent(); // これは起動時に作成されたまま変更されないオブジェクト |
95 | 95 | private final VWColorChooserDialog ccwin = getCcWin(); // これは起動時に作成されたまま変更されないオブジェクト |
96 | - | |
96 | + | |
97 | 97 | // 雑多なメソッド |
98 | 98 | private void StdAppendMessage(String message) { System.out.println(message); } |
99 | 99 | //private void StdAppendError(String message) { System.err.println(message); } |
100 | 100 | private void StWinSetVisible(boolean b) { StWin.setVisible(b); } |
101 | 101 | private void StWinSetLocationCenter(Component frame) { CommonSwingUtils.setLocationCenter(frame, (VWStatusWindow)StWin); } |
102 | - | |
102 | + | |
103 | 103 | /******************************************************************************* |
104 | 104 | * 定数 |
105 | 105 | ******************************************************************************/ |
@@ -112,21 +112,21 @@ public abstract class AbsSettingView extends JScrollPane { | ||
112 | 112 | private static final int SEP_HEIGHT = 10; |
113 | 113 | private static final int SEP_HEIGHT_NALLOW = 5; |
114 | 114 | private static final int BLOCK_SEP_HEIGHT = 75; |
115 | - | |
115 | + | |
116 | 116 | private static final int LABEL_WIDTH = 350; |
117 | 117 | private static final int CCLABEL_WIDTH = 250; |
118 | 118 | private static final int DESCRIPTION_WIDTH = LABEL_WIDTH+PARTS_WIDTH; |
119 | 119 | |
120 | 120 | private static final int UPDATE_WIDTH = 250; |
121 | 121 | private static final int HINT_WIDTH = 700; |
122 | - | |
122 | + | |
123 | 123 | private static final int PANEL_WIDTH = LABEL_WIDTH+PARTS_WIDTH+SEP_WIDTH*3; |
124 | - | |
124 | + | |
125 | 125 | // |
126 | - | |
126 | + | |
127 | 127 | private static final Color NOTICEMSG_COLOR = new Color(0,153,153); |
128 | 128 | // テキスト |
129 | - | |
129 | + | |
130 | 130 | private static final String TEXT_HINT = |
131 | 131 | "各項目の詳細はプロジェクトWikiに説明があります(http://sourceforge.jp/projects/tainavi/wiki/)。"+ |
132 | 132 | "ツールバーのヘルプアイコンをクリックするとブラウザで開きます。"; |
@@ -140,18 +140,18 @@ public abstract class AbsSettingView extends JScrollPane { | ||
140 | 140 | private static final String MSGID = "["+getViewName()+"] "; |
141 | 141 | private static final String ERRID = "[ERROR]"+MSGID; |
142 | 142 | private static final String DBGID = "[DEBUG]"+MSGID; |
143 | - | |
143 | + | |
144 | 144 | /******************************************************************************* |
145 | 145 | * 部品 |
146 | 146 | ******************************************************************************/ |
147 | - | |
147 | + | |
148 | 148 | // コンポーネント |
149 | - | |
149 | + | |
150 | 150 | private JPanel jPanel_setting = null; |
151 | - | |
151 | + | |
152 | 152 | private JPanel jPanel_update = null; |
153 | 153 | private JButton jButton_update = null; |
154 | - | |
154 | + | |
155 | 155 | // リスト形式 |
156 | 156 | private JCheckBoxPanel jCBP_disableFazzySearch = null; |
157 | 157 | private JCheckBoxPanel jCBP_disableFazzySearchReverse = null; |
@@ -180,7 +180,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
180 | 180 | private JComboBoxPanel jCBX_dblClkCmd = null; |
181 | 181 | private JSliderPanel jSP_searchResultMax = null; |
182 | 182 | private JSliderPanel jSP_searchResultBufferMax = null; |
183 | - | |
183 | + | |
184 | 184 | // 新聞形式 |
185 | 185 | private JRadioButtonPanel jRBP_getPaperRedrawType = null; |
186 | 186 | private JSliderPanel jSP_centerPerPage = null; |
@@ -193,7 +193,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
193 | 193 | private JCheckBoxPanel jCBP_effectComboToPaper = null; |
194 | 194 | private JComboBoxPanel jCBX_snapshotFmt = null; |
195 | 195 | private JCheckBoxPanel jCBP_printSnapshot = null; |
196 | - | |
196 | + | |
197 | 197 | // リスト・新聞共通 |
198 | 198 | private JCheckBoxPanel jCBP_displayOnlyExecOnEntry = null; |
199 | 199 | private JCheckBoxPanel jCBP_displayPassedReserve = null; |
@@ -219,7 +219,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
219 | 219 | private JButton jButton_midel = null; |
220 | 220 | private JButton jButton_miup = null; |
221 | 221 | private JButton jButton_midown = null; |
222 | - | |
222 | + | |
223 | 223 | // Web番組表対応 |
224 | 224 | private JCheckBoxPanel jCBP_continueTomorrow = null; |
225 | 225 | private JSliderPanel jSP_cacheTimeLimit = null; |
@@ -242,13 +242,16 @@ public abstract class AbsSettingView extends JScrollPane { | ||
242 | 242 | private JCheckBoxPanel jCBP_historyOnlyUpdateOnce = null; |
243 | 243 | private JCheckBoxPanel jCBP_usePassedProgram = null; |
244 | 244 | private JSliderPanel jSP_prepPassedProgramCount = null; |
245 | - | |
245 | + private JCheckBoxPanel jCBP_downloadProgramOnFixedTime = null; | |
246 | + private JCheckBoxPanel jCBP_downloadProgramInBackground = null; | |
247 | + private JTextFieldWithPopup jTextField_downloadProgramTimeList = null; | |
248 | + | |
246 | 249 | // レコーダ対応 |
247 | 250 | private JRadioButtonPanel jRBP_getRdReserveDetails = null; |
248 | 251 | private JRadioButtonPanel jRBP_getRdAutoReserves = null; |
249 | 252 | private JRadioButtonPanel jRBP_getRdRecorded = null; |
250 | 253 | private JComboBoxPanel jCBX_recordedSaveScope = null; |
251 | - | |
254 | + | |
252 | 255 | // 予約 |
253 | 256 | private JSliderPanel jSP_spoex_extend = null; |
254 | 257 | private JRadioButtonPanel jRBP_overlapUp = null; |
@@ -269,7 +272,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
269 | 272 | private JLabel jLabel_rsv_recedcolor = null; |
270 | 273 | private JCCLabel jCCL_rsv_recedcolor = null; |
271 | 274 | private JCheckBoxPanel jCBP_useAutocomplete = null; |
272 | - | |
275 | + | |
273 | 276 | // その他 |
274 | 277 | private JComboBoxPanel jCBX_updateMethod = null; |
275 | 278 | private JCheckBoxPanel jCBP_disableBeep = null; |
@@ -289,45 +292,45 @@ public abstract class AbsSettingView extends JScrollPane { | ||
289 | 292 | private JTextAreaWithPopup jta_help = null; |
290 | 293 | |
291 | 294 | // コンポーネント以外 |
292 | - | |
295 | + | |
293 | 296 | /** |
294 | 297 | * 特定のコンポーネントを操作した時だけ番組表を再取得してほしい |
295 | 298 | */ |
296 | 299 | private boolean reload_prog_needed = false; |
297 | - | |
300 | + | |
298 | 301 | /******************************************************************************* |
299 | 302 | * コンストラクタ |
300 | 303 | ******************************************************************************/ |
301 | - | |
304 | + | |
302 | 305 | public AbsSettingView() { |
303 | - | |
306 | + | |
304 | 307 | super(); |
305 | - | |
308 | + | |
306 | 309 | this.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
307 | 310 | this.getVerticalScrollBar().setUnitIncrement(25); |
308 | 311 | this.setColumnHeaderView(getJPanel_update()); |
309 | 312 | this.setViewportView(getJPanel_setting()); |
310 | - | |
313 | + | |
311 | 314 | setUpdateButtonEnhanced(false); |
312 | 315 | } |
313 | - | |
316 | + | |
314 | 317 | private JPanel getJPanel_update() { |
315 | 318 | if (jPanel_update == null) |
316 | 319 | { |
317 | 320 | jPanel_update = new JPanel(); |
318 | 321 | jPanel_update.setLayout(new SpringLayout()); |
319 | - | |
322 | + | |
320 | 323 | jPanel_update.setBorder(new LineBorder(Color.GRAY)); |
321 | - | |
324 | + | |
322 | 325 | int y = SEP_HEIGHT; |
323 | 326 | CommonSwingUtils.putComponentOn(jPanel_update, getJButton_update("更新を確定する"), UPDATE_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
324 | - | |
327 | + | |
325 | 328 | int yz = SEP_HEIGHT/2; |
326 | 329 | int x = UPDATE_WIDTH+50; |
327 | 330 | CommonSwingUtils.putComponentOn(jPanel_update, getJta_help(), HINT_WIDTH, PARTS_HEIGHT+SEP_HEIGHT, x, yz); |
328 | - | |
331 | + | |
329 | 332 | y += (PARTS_HEIGHT + SEP_HEIGHT); |
330 | - | |
333 | + | |
331 | 334 | // 画面の全体サイズを決める |
332 | 335 | Dimension d = new Dimension(PANEL_WIDTH,y); |
333 | 336 | jPanel_update.setPreferredSize(d); |
@@ -352,14 +355,14 @@ public abstract class AbsSettingView extends JScrollPane { | ||
352 | 355 | { |
353 | 356 | jPanel_setting = new JPanel(); |
354 | 357 | jPanel_setting.setLayout(new SpringLayout()); |
355 | - | |
358 | + | |
356 | 359 | // |
357 | 360 | int y = SEP_HEIGHT; |
358 | - | |
361 | + | |
359 | 362 | /* |
360 | - * リスト形式 | |
363 | + * リスト形式 | |
361 | 364 | */ |
362 | - | |
365 | + | |
363 | 366 | y+=0; |
364 | 367 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<リスト形式>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
365 | 368 |
@@ -368,7 +371,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
368 | 371 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_disableFazzySearch = new JCheckBoxPanel("番組追跡であいまい検索をしない",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
369 | 372 | jCBP_disableFazzySearch.setSelected( ! env.getDisableFazzySearch()); |
370 | 373 | // RELOADリスナー不要 |
371 | - | |
374 | + | |
372 | 375 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
373 | 376 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_disableFazzySearchReverse = new JCheckBoxPanel("┗ あいまい検索の逆引きを省略(非推奨)",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
374 | 377 | jCBP_disableFazzySearchReverse.setSelected(env.getDisableFazzySearchReverse()); |
@@ -378,11 +381,11 @@ public abstract class AbsSettingView extends JScrollPane { | ||
378 | 381 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_defaultFazzyThreshold = new JSliderPanel("┗ あいまい検索のデフォルト閾値",LABEL_WIDTH,1,99,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
379 | 382 | jSP_defaultFazzyThreshold.setValue(env.getDefaultFazzyThreshold()); |
380 | 383 | // RELOADリスナー不要 |
381 | - | |
384 | + | |
382 | 385 | // 連動設定(Fire!がキモイ…) |
383 | - | |
386 | + | |
384 | 387 | jCBP_disableFazzySearch.addItemListener(al_fazzysearch); |
385 | - | |
388 | + | |
386 | 389 | jCBP_disableFazzySearch.setSelected( ! jCBP_disableFazzySearch.isSelected()); |
387 | 390 | } |
388 | 391 |
@@ -394,12 +397,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
394 | 397 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg(" 逆順を有効にすると、正順でNG判定になった場合に前者と後者を入れ替えて再判定を行います。取りこぼしが減る場合がある反面、検索ノイズが増える場合もあります。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
395 | 398 | y+=(PARTS_HEIGHT); |
396 | 399 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg(" 閾値を大きくすると判定が厳しくなります。キーワードが短いためにヒットしまくりで検索ノイズが多くなった場合に、値を大きくしてみてください。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
397 | - | |
400 | + | |
398 | 401 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
399 | 402 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_traceOnlyTitle = new JCheckBoxPanel("タイトル中に含まれるサブタイトルは番組追跡の対象にしない",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
400 | 403 | jCBP_traceOnlyTitle.setSelected(env.getTraceOnlyTitle()); |
401 | 404 | jCBP_traceOnlyTitle.addItemListener(IL_RELOAD_PROG_NEEDED); |
402 | - | |
405 | + | |
403 | 406 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
404 | 407 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_syoboFilterByCenters = new JCheckBoxPanel("しょぼかるの検索結果も有効な放送局のみに絞る",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
405 | 408 | jCBP_syoboFilterByCenters.setSelected(env.getSyoboFilterByCenters()); |
@@ -440,14 +443,14 @@ public abstract class AbsSettingView extends JScrollPane { | ||
440 | 443 | CommonSwingUtils.putComponentOn(jPanel_setting, jLabel_pickedLineColor = new JLabel("┗ ピックアップ行の背景色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
441 | 444 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_pickedLineColor = new JCCLabel("ピックアップ行の背景色",env.getPickedLineColor(),true,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
442 | 445 | // RELOADリスナー不要 |
443 | - | |
446 | + | |
444 | 447 | // 連動設定 |
445 | - | |
448 | + | |
446 | 449 | jCBP_rsvdLineEnhance.addItemListener(al_rsvdlineenhance); |
447 | - | |
450 | + | |
448 | 451 | jCBP_rsvdLineEnhance.setSelected( ! jCBP_rsvdLineEnhance.isSelected()); |
449 | 452 | } |
450 | - | |
453 | + | |
451 | 454 | { |
452 | 455 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
453 | 456 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_currentLineEnhance = new JCheckBoxPanel("現在放送中の行の背景色を変えて強調する",LABEL_WIDTH), LABEL_WIDTH+PARTS_HEIGHT, PARTS_HEIGHT, SEP_WIDTH, y); |
@@ -458,50 +461,50 @@ public abstract class AbsSettingView extends JScrollPane { | ||
458 | 461 | CommonSwingUtils.putComponentOn(jPanel_setting, jLabel_currentLineColor = new JLabel("┗ 現在放送中行の背景色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
459 | 462 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_currentLineColor = new JCCLabel("現在放送中行の背景色",env.getCurrentLineColor(),true,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
460 | 463 | // RELOADリスナー不要 |
461 | - | |
464 | + | |
462 | 465 | // 連動設定 |
463 | - | |
466 | + | |
464 | 467 | jCBP_currentLineEnhance.addItemListener(al_currentlineenhance); |
465 | - | |
468 | + | |
466 | 469 | jCBP_currentLineEnhance.setSelected( ! jCBP_currentLineEnhance.isSelected()); |
467 | 470 | } |
468 | - | |
471 | + | |
469 | 472 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
470 | 473 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_currentAfter = new JSliderPanel("現在放送中ノードに終了後何分までの番組を表示するか",LABEL_WIDTH,0,60,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
471 | 474 | jSP_currentAfter.setValue(env.getCurrentAfter()/60); |
472 | 475 | // RELOADリスナー不要 |
473 | - | |
476 | + | |
474 | 477 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
475 | 478 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_currentBefore = new JSliderPanel("現在放送中ノードに開始前何分までの番組を表示するか",LABEL_WIDTH,0,120,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
476 | 479 | jSP_currentBefore.setValue(env.getCurrentBefore()/60); |
477 | 480 | // RELOADリスナー不要 |
478 | - | |
481 | + | |
479 | 482 | // |
480 | 483 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
481 | 484 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("タイトル中のキーワードにマッチした箇所の強調色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
482 | 485 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_matchedKeywordColor = new JCCLabel("強調色",env.getMatchedKeywordColor(),false,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
483 | 486 | // RELOADリスナー不要 |
484 | - | |
487 | + | |
485 | 488 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
486 | 489 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_showWarnDialog = new JCheckBoxPanel("キーワード削除時に確認ダイアログを表示",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
487 | 490 | jCBP_showWarnDialog.setSelected(env.getShowWarnDialog()); |
488 | 491 | // RELOADリスナー不要 |
489 | - | |
492 | + | |
490 | 493 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
491 | 494 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_splitMarkAndTitle = new JCheckBoxPanel("オプション表示を個別欄に分離表示",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
492 | 495 | jCBP_splitMarkAndTitle.setSelected(env.getSplitMarkAndTitle()); |
493 | 496 | // RELOADリスナー不要 |
494 | - | |
497 | + | |
495 | 498 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
496 | 499 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_showDetailOnList = new JCheckBoxPanel("番組詳細列を表示",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
497 | 500 | jCBP_showDetailOnList.setSelected(env.getShowDetailOnList()); |
498 | 501 | // RELOADリスナー不要 |
499 | - | |
502 | + | |
500 | 503 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
501 | 504 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_rowHeaderVisible = new JCheckBoxPanel("行番号を表示",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
502 | 505 | jCBP_rowHeaderVisible.setSelected(env.getRowHeaderVisible()); |
503 | 506 | // RELOADリスナー不要 |
504 | - | |
507 | + | |
505 | 508 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
506 | 509 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_rsvTargets = new JSliderPanel("予約待機の予約番組自動選択数",LABEL_WIDTH,1,99,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
507 | 510 | jSP_rsvTargets.setValue(env.getRsvTargets()); |
@@ -514,7 +517,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
514 | 517 | } |
515 | 518 | jCBX_dblClkCmd.setSelectedItem(env.getDblClkCmd()); |
516 | 519 | // RELOADリスナー不要 |
517 | - | |
520 | + | |
518 | 521 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
519 | 522 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_searchResultMax = new JSliderPanel("過去ログ検索件数の上限",LABEL_WIDTH,10,500,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
520 | 523 | jSP_searchResultMax.setValue(env.getSearchResultMax()); |
@@ -526,12 +529,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
526 | 529 | // RELOADリスナー不要 |
527 | 530 | |
528 | 531 | /* |
529 | - * 新聞形式 | |
532 | + * 新聞形式 | |
530 | 533 | */ |
531 | - | |
534 | + | |
532 | 535 | y+=(PARTS_HEIGHT+BLOCK_SEP_HEIGHT); |
533 | 536 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<新聞形式>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
534 | - | |
537 | + | |
535 | 538 | { |
536 | 539 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
537 | 540 | int paperredraw_h = PARTS_HEIGHT*3+SEP_HEIGHT_NALLOW*2; |
@@ -540,20 +543,20 @@ public abstract class AbsSettingView extends JScrollPane { | ||
540 | 543 | jRBP_getPaperRedrawType.add(PARER_REDRAW_CACHE, false); |
541 | 544 | jRBP_getPaperRedrawType.add(PARER_REDRAW_PAGER, false); |
542 | 545 | // RELOADリスナー不要 |
543 | - | |
546 | + | |
544 | 547 | y+=(paperredraw_h+SEP_HEIGHT); |
545 | 548 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_centerPerPage = new JSliderPanel("┗ ページあたりの放送局数",LABEL_WIDTH,1,99,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
546 | 549 | jSP_centerPerPage.setValue(env.getCenterPerPage()); |
547 | 550 | // RELOADリスナー不要 |
548 | - | |
551 | + | |
549 | 552 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
550 | 553 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_allPageSnapshot = new JCheckBoxPanel("┗ スナップショットを全ページ連続で実行",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
551 | 554 | jCBP_allPageSnapshot.setSelected(env.getAllPageSnapshot()); |
552 | 555 | // RELOADリスナー不要 |
553 | - | |
556 | + | |
554 | 557 | // 連動設定(1) |
555 | 558 | jRBP_getPaperRedrawType.addItemListener(il_paperredrawtype); |
556 | - | |
559 | + | |
557 | 560 | if ( env.isPagerEnabled() ) { |
558 | 561 | jRBP_getPaperRedrawType.setSelectedItem(PARER_REDRAW_PAGER); |
559 | 562 | } |
@@ -583,19 +586,19 @@ public abstract class AbsSettingView extends JScrollPane { | ||
583 | 586 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_tooltipDismissDelay = new JSliderPanel("┗ 消去までの遅延(ミリ秒)",LABEL_WIDTH,1000,60000,100,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
584 | 587 | jSP_tooltipDismissDelay.setValue(env.getTooltipDismissDelay()); |
585 | 588 | // RELOADリスナー不要 |
586 | - | |
589 | + | |
587 | 590 | // 連動設定 |
588 | 591 | |
589 | 592 | jCBP_tooltipEnable.addItemListener(al_tooltipenable); |
590 | - | |
593 | + | |
591 | 594 | jCBP_tooltipEnable.setSelected( ! jCBP_tooltipEnable.isSelected()); |
592 | 595 | } |
593 | - | |
596 | + | |
594 | 597 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
595 | 598 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_timerbarScrollEnable = new JCheckBoxPanel("現在時刻線を固定し番組表側をスクロール",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
596 | 599 | jCBP_timerbarScrollEnable.setSelected(env.getTimerbarScrollEnable()); |
597 | 600 | // RELOADリスナー不要 |
598 | - | |
601 | + | |
599 | 602 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
600 | 603 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_passedLogLimit = new JSliderPanel("過去ログの日付ノードの表示数",LABEL_WIDTH,7,180,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
601 | 604 | jSP_passedLogLimit.setValue(env.getPassedLogLimit()); |
@@ -605,12 +608,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
605 | 608 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_effectComboToPaper = new JCheckBoxPanel("レコーダコンボボックスを新聞形式でも有効に",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
606 | 609 | jCBP_effectComboToPaper.setSelected(env.getEffectComboToPaper()); |
607 | 610 | // RELOADリスナー不要 |
608 | - | |
609 | - | |
611 | + | |
612 | + | |
610 | 613 | /* |
611 | - * リスト・新聞形式共通 | |
614 | + * リスト・新聞形式共通 | |
612 | 615 | */ |
613 | - | |
616 | + | |
614 | 617 | y+=(PARTS_HEIGHT+BLOCK_SEP_HEIGHT); |
615 | 618 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<リスト・新聞形式共通>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
616 | 619 |
@@ -618,7 +621,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
618 | 621 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_displayOnlyExecOnEntry = new JCheckBoxPanel("実行ONの予約のみ予約マークを表示する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
619 | 622 | jCBP_displayOnlyExecOnEntry.setSelected(env.getDisplayOnlyExecOnEntry()); |
620 | 623 | // RELOADリスナー不要 |
621 | - | |
624 | + | |
622 | 625 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
623 | 626 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_displayPassedReserve = new JCheckBoxPanel("当日の終了済み予約も表示する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
624 | 627 | jCBP_displayPassedReserve.setSelected(env.getDisplayPassedReserve()); |
@@ -633,7 +636,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
633 | 636 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_adjLateNight = new JCheckBoxPanel("【RD】深夜の帯予約を前にずらす(火~土→月~金)",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
634 | 637 | jCBP_adjLateNight.setSelected(env.getAdjLateNight()); |
635 | 638 | // RELOADリスナー不要 |
636 | - | |
639 | + | |
637 | 640 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
638 | 641 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※月~金26:00の帯番組は、実際には火~土AM2:00に放送されますので鯛ナビでもそのように帯予約を処理しています。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
639 | 642 | y+=(PARTS_HEIGHT); |
@@ -643,17 +646,17 @@ public abstract class AbsSettingView extends JScrollPane { | ||
643 | 646 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_rootNodeVisible = new JCheckBoxPanel("ツリーペーンにrootノードを表示させる",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
644 | 647 | jCBP_rootNodeVisible.setSelected(env.getRootNodeVisible()); |
645 | 648 | // RELOADリスナー不要 |
646 | - | |
649 | + | |
647 | 650 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
648 | 651 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_syncTreeWidth = new JCheckBoxPanel("リスト形式と新聞形式のツリーペーンの幅を同期する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
649 | 652 | jCBP_syncTreeWidth.setSelected(env.getSyncTreeWidth()); |
650 | 653 | // RELOADリスナー不要 |
651 | - | |
654 | + | |
652 | 655 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
653 | 656 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_shortExtMark = new JCheckBoxPanel("「★延長注意★」を「(延)」に短縮表示",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
654 | 657 | jCBP_shortExtMark.setSelected(env.getShortExtMark()); |
655 | 658 | // RELOADリスナー不要 |
656 | - | |
659 | + | |
657 | 660 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
658 | 661 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBX_snapshotFmt = new JComboBoxPanel("スナップショットの画像形式",LABEL_WIDTH,250,true), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
659 | 662 | for ( SnapshotFmt s : SnapshotFmt.values() ) { |
@@ -661,18 +664,18 @@ public abstract class AbsSettingView extends JScrollPane { | ||
661 | 664 | } |
662 | 665 | jCBX_snapshotFmt.setSelectedItem(env.getSnapshotFmt()); |
663 | 666 | // RELOADリスナー不要 |
664 | - | |
667 | + | |
665 | 668 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
666 | 669 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_printSnapshot = new JCheckBoxPanel("スナップショットボタンで印刷を実行する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
667 | 670 | jCBP_printSnapshot.setSelected(env.getPrintSnapshot()); |
668 | 671 | // RELOADリスナー不要 |
669 | - | |
672 | + | |
670 | 673 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
671 | - int marks_h = PARTS_HEIGHT*12; | |
674 | + int marks_h = PARTS_HEIGHT*12; | |
672 | 675 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_showmarks("表示マークの選択"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
673 | 676 | CommonSwingUtils.putComponentOn(jPanel_setting, getJScrollPane_showmarks(), 320, marks_h, LABEL_WIDTH+SEP_WIDTH, y); |
674 | 677 | // ★★★ RELOADリスナーは getJScrollPane_showmarks()内でつける |
675 | - | |
678 | + | |
676 | 679 | y+=(marks_h+SEP_HEIGHT); |
677 | 680 | int cbitems_w = 320; |
678 | 681 | int cbitems_h = PARTS_HEIGHT*8; |
@@ -681,7 +684,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
681 | 684 | CommonSwingUtils.putComponentOn(jPanel_setting, getJButton_clipboard_down("↓"), 50, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH+10+cbitems_w, y+PARTS_HEIGHT+SEP_WIDTH); |
682 | 685 | CommonSwingUtils.putComponentOn(jPanel_setting, getJScrollPane_clipboard(), cbitems_w, cbitems_h, LABEL_WIDTH+SEP_WIDTH, y); |
683 | 686 | // RELOADリスナー不要 |
684 | - | |
687 | + | |
685 | 688 | y += (cbitems_h + SEP_HEIGHT); |
686 | 689 | int mitable_h = PARTS_HEIGHT*8; |
687 | 690 | { |
@@ -702,17 +705,17 @@ public abstract class AbsSettingView extends JScrollPane { | ||
702 | 705 | } |
703 | 706 | |
704 | 707 | /* |
705 | - * Web番組表対応 | |
708 | + * Web番組表対応 | |
706 | 709 | */ |
707 | - | |
710 | + | |
708 | 711 | y+=(mitable_h+BLOCK_SEP_HEIGHT); |
709 | 712 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<Web番組表対応>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
710 | - | |
713 | + | |
711 | 714 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
712 | 715 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_continueTomorrow = new JCheckBoxPanel("29時をまたぐ番組を検出し同一視する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
713 | 716 | jCBP_continueTomorrow.setSelected(env.getContinueTomorrow()); |
714 | 717 | jCBP_continueTomorrow.addItemListener(IL_RELOAD_PROG_NEEDED); |
715 | - | |
718 | + | |
716 | 719 | { |
717 | 720 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
718 | 721 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_cacheTimeLimit = new JSliderPanel("番組表キャッシュの有効時間(0:無制限)",LABEL_WIDTH,0,72,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
@@ -729,17 +732,17 @@ public abstract class AbsSettingView extends JScrollPane { | ||
729 | 732 | // RELOADリスナー不要 |
730 | 733 | |
731 | 734 | // 連動設定 |
732 | - | |
735 | + | |
733 | 736 | jSP_cacheTimeLimit.addChangeListener(cl_cachetimelimit); |
734 | - | |
737 | + | |
735 | 738 | jSP_cacheTimeLimit.setValue(env.getCacheTimeLimit()); |
736 | 739 | } |
737 | - | |
740 | + | |
738 | 741 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
739 | 742 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※起動時に、Web番組表の再取得を自動で「実行させたくない」場合は0にしてください。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
740 | 743 | y+=(PARTS_HEIGHT); |
741 | 744 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※シャットダウンコマンドを設定すると、Web番組表取得メニューに「CSのみ取得(取得後シャットダウン)」が追加されます。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
742 | - | |
745 | + | |
743 | 746 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
744 | 747 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_expandTo8 = new JCheckBoxPanel("可能なら番組表を8日分取得する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
745 | 748 | jCBP_expandTo8.setSelected(env.getExpandTo8()); |
@@ -754,85 +757,107 @@ public abstract class AbsSettingView extends JScrollPane { | ||
754 | 757 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_splitEpno = new JCheckBoxPanel("タイトルに話数が含まれる場合に以降を分離する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
755 | 758 | jCBP_splitEpno.setSelected(env.getSplitEpno()); |
756 | 759 | jCBP_splitEpno.addItemListener(IL_RELOAD_PROG_NEEDED); |
757 | - | |
760 | + | |
758 | 761 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
759 | 762 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_fixTitle = new JCheckBoxPanel("タイトル先頭の「アニメ 」を削除(NHKのみ)",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
760 | 763 | jCBP_fixTitle.setSelected(env.getFixTitle()); |
761 | 764 | jCBP_fixTitle.addItemListener(IL_RELOAD_PROG_NEEDED); |
762 | - | |
765 | + | |
763 | 766 | y +=(PARTS_HEIGHT+SEP_HEIGHT); |
764 | 767 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_ngword("NGワード(;区切りで複数指定可)"), LABEL_WIDTH,PARTS_HEIGHT, SEP_WIDTH, y); |
765 | 768 | CommonSwingUtils.putComponentOn(jPanel_setting, getJTextField_ngword(CommonUtils.joinStr(";", env.getNgword())),600, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
766 | 769 | jTextField_ngword.getDocument().addDocumentListener(DL_RELOAD_PROG_NEEDED); |
767 | - | |
768 | - | |
770 | + | |
771 | + | |
769 | 772 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
770 | 773 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_userAgent("User-Agent"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
771 | 774 | CommonSwingUtils.putComponentOn(jPanel_setting, getJTextField_userAgent(env.getUserAgent()), 600, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
772 | 775 | // RELOADリスナー不要 |
773 | - | |
776 | + | |
774 | 777 | { |
775 | 778 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
776 | 779 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useProxy = new JCheckBoxPanel("HTTPプロキシを有効にする",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
777 | 780 | jCBP_useProxy.setSelected( ! env.getUseProxy()); |
778 | 781 | // RELOADリスナー不要 |
779 | - | |
782 | + | |
780 | 783 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
781 | 784 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_proxy("┗ HTTPプロキシ/ポート"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
782 | 785 | CommonSwingUtils.putComponentOn(jPanel_setting, getJTextField_proxyAddr(env.getProxyAddr()), 200, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
783 | 786 | CommonSwingUtils.putComponentOn(jPanel_setting, getJTextField_proxyPort(env.getProxyPort()), 100, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH+210, y); |
784 | 787 | // RELOADリスナー不要 |
785 | - | |
788 | + | |
786 | 789 | // 連動設定 |
787 | 790 | |
788 | 791 | jCBP_useProxy.addItemListener(al_useproxy); |
789 | 792 | |
790 | 793 | jCBP_useProxy.setSelected( ! jCBP_useProxy.isSelected()); |
791 | 794 | } |
792 | - | |
795 | + | |
793 | 796 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
794 | 797 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useSyobocal = new JCheckBoxPanel("【アニメ】しょぼいカレンダーを利用する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
795 | 798 | jCBP_useSyobocal.setSelected(env.getUseSyobocal()); |
796 | 799 | jCBP_useSyobocal.addItemListener(IL_RELOAD_PROG_NEEDED); |
797 | - | |
800 | + | |
798 | 801 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
799 | 802 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※アニメなんか興味ないよ!という場合はチェックを外して再起動してください。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
800 | - | |
803 | + | |
801 | 804 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
802 | 805 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_historyOnlyUpdateOnce = new JCheckBoxPanel("日に一回しか新着履歴を更新しない",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
803 | 806 | jCBP_historyOnlyUpdateOnce.setSelected(env.getHistoryOnlyUpdateOnce()); |
804 | 807 | // RELOADリスナー不要 |
805 | - | |
808 | + | |
806 | 809 | { |
807 | 810 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
808 | 811 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_usePassedProgram = new JCheckBoxPanel("過去ログを記録する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
809 | 812 | jCBP_usePassedProgram.setSelected( ! env.getUsePassedProgram()); |
810 | 813 | // RELOADリスナー不要 |
811 | - | |
814 | + | |
812 | 815 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
813 | 816 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_prepPassedProgramCount = new JSliderPanel("┗ 何日先のログまで過去ログ用に保存するか",LABEL_WIDTH,1,8,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
814 | 817 | jSP_prepPassedProgramCount.setValue(env.getPrepPassedProgramCount()); |
815 | 818 | // RELOADリスナー不要 |
816 | - | |
819 | + | |
817 | 820 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
818 | 821 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※保存期間を4日先までにして1週間旅行に出かけると7日-4日=3日分の過去ログがロストすることになります。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
819 | - | |
822 | + | |
820 | 823 | // 連動設定 |
821 | - | |
824 | + | |
822 | 825 | jCBP_usePassedProgram.addItemListener(al_usepassedprogram); |
823 | - | |
826 | + | |
824 | 827 | jCBP_usePassedProgram.setSelected( ! jCBP_usePassedProgram.isSelected()); |
825 | 828 | } |
826 | - | |
829 | + | |
830 | + { | |
831 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
832 | + CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_downloadProgramOnFixedTime = new JCheckBoxPanel("決まった時刻に番組表を取得する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
833 | + jCBP_downloadProgramOnFixedTime.setSelected( ! env.getDownloadProgramOnFixedTime()); | |
834 | + // RELOADリスナー不要 | |
835 | + | |
836 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
837 | + CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("┗ 取得時刻(HH:MM形式 ;区切りで複数指定可)"), LABEL_WIDTH,PARTS_HEIGHT, SEP_WIDTH, y); | |
838 | + CommonSwingUtils.putComponentOn(jPanel_setting, getJTextField_downloadProgramTimeList(CommonUtils.joinStr(";", env.getDownloadProgramTimeList())),600, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); | |
839 | + // RELOADリスナー不要 | |
840 | + | |
841 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
842 | + CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_downloadProgramInBackground = new JCheckBoxPanel("バックグランドで取得する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
843 | + jCBP_downloadProgramInBackground.setSelected(env.getDownloadProgramInBackground()); | |
844 | + // RELOADリスナー不要 | |
845 | + | |
846 | + // 連動設定 | |
847 | + jCBP_downloadProgramOnFixedTime.addItemListener(al_downloadProgramOnFixedTime); | |
848 | + jCBP_downloadProgramOnFixedTime.setSelected( ! jCBP_downloadProgramOnFixedTime.isSelected()); | |
849 | + } | |
850 | + | |
851 | + | |
827 | 852 | /* |
828 | - * レコーダ対応 | |
853 | + * レコーダ対応 | |
829 | 854 | */ |
830 | 855 | |
831 | 856 | y+=(PARTS_HEIGHT+BLOCK_SEP_HEIGHT); |
832 | 857 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<レコーダ対応>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
833 | - | |
858 | + | |
834 | 859 | int getdetail_h = PARTS_HEIGHT*3+SEP_HEIGHT_NALLOW*2; |
835 | - | |
860 | + | |
836 | 861 | { |
837 | 862 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
838 | 863 | CommonSwingUtils.putComponentOn(jPanel_setting, jRBP_getRdReserveDetails = new JRadioButtonPanel("予約一覧取得時に詳細情報も取得する",LABEL_WIDTH), PARTS_WIDTH, getdetail_h, SEP_WIDTH, y); |
@@ -840,28 +865,28 @@ public abstract class AbsSettingView extends JScrollPane { | ||
840 | 865 | jRBP_getRdReserveDetails.add("常に取得する",false); |
841 | 866 | jRBP_getRdReserveDetails.add("常に取得しない",false); |
842 | 867 | // RELOADリスナー不要 |
843 | - | |
868 | + | |
844 | 869 | y+=(getdetail_h+SEP_HEIGHT); |
845 | 870 | CommonSwingUtils.putComponentOn(jPanel_setting, jRBP_getRdAutoReserves = new JRadioButtonPanel("予約一覧取得時に自動予約一覧も取得する",LABEL_WIDTH), PARTS_WIDTH, getdetail_h, SEP_WIDTH, y); |
846 | 871 | jRBP_getRdAutoReserves.add("毎回確認する",true); |
847 | 872 | jRBP_getRdAutoReserves.add("常に取得する",false); |
848 | 873 | jRBP_getRdAutoReserves.add("常に取得しない",false); |
849 | 874 | // RELOADリスナー不要 |
850 | - | |
875 | + | |
851 | 876 | y+=(getdetail_h+SEP_HEIGHT); |
852 | 877 | CommonSwingUtils.putComponentOn(jPanel_setting, jRBP_getRdRecorded = new JRadioButtonPanel("予約一覧取得時に録画結果一覧も取得する",LABEL_WIDTH), PARTS_WIDTH, getdetail_h, SEP_WIDTH, y); |
853 | 878 | jRBP_getRdRecorded.add("毎回確認する",true); |
854 | 879 | jRBP_getRdRecorded.add("常に取得する",false); |
855 | 880 | jRBP_getRdRecorded.add("常に取得しない",false); |
856 | 881 | // RELOADリスナー不要 |
857 | - | |
882 | + | |
858 | 883 | // 選択肢 |
859 | 884 | updateSelections(); |
860 | - | |
885 | + | |
861 | 886 | y+=(getdetail_h+SEP_HEIGHT); |
862 | 887 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※「常に取得しない」を選択した場合でも、ツールバーのプルダウンメニューから強制的に取得を実行できます。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
863 | 888 | } |
864 | - | |
889 | + | |
865 | 890 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
866 | 891 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBX_recordedSaveScope = new JComboBoxPanel("録画結果一覧の保存期間",LABEL_WIDTH,250,true), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
867 | 892 | jCBX_recordedSaveScope.addItem("保存しない"); |
@@ -870,22 +895,22 @@ public abstract class AbsSettingView extends JScrollPane { | ||
870 | 895 | } |
871 | 896 | jCBX_recordedSaveScope.setSelectedIndex(env.getRecordedSaveScope()); |
872 | 897 | // RELOADリスナー不要 |
873 | - | |
898 | + | |
874 | 899 | y+=(getdetail_h+SEP_HEIGHT); |
875 | 900 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("NULLプラグインでのカレンダ連携設定はレコーダ設定に移動しました"), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
876 | - | |
901 | + | |
877 | 902 | /* |
878 | 903 | * 予約 |
879 | 904 | */ |
880 | 905 | |
881 | 906 | y+=(75+BLOCK_SEP_HEIGHT); |
882 | 907 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("<<<予約>>>"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
883 | - | |
908 | + | |
884 | 909 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
885 | 910 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_spoex_extend = new JSliderPanel("延長警告の録画時間延長幅(分)",LABEL_WIDTH,0,180,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
886 | 911 | jSP_spoex_extend.setValue(Integer.valueOf(env.getSpoexLength())); |
887 | 912 | // RELOADリスナー不要 |
888 | - | |
913 | + | |
889 | 914 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
890 | 915 | int ovarlap_h = PARTS_HEIGHT*2+SEP_HEIGHT_NALLOW*1; |
891 | 916 | CommonSwingUtils.putComponentOn(jPanel_setting, jRBP_overlapUp = new JRadioButtonPanel("録画時間の前",LABEL_WIDTH), PARTS_WIDTH, ovarlap_h, SEP_WIDTH, y); |
@@ -910,12 +935,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
910 | 935 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_enableCHAVsetting("AV自動設定キーをジャンルからCHに"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
911 | 936 | CommonSwingUtils.putComponentOn(jPanel_setting, getJCheckBox_enableCHAVsetting(env.getEnableCHAVsetting()), 100, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
912 | 937 | // RELOADリスナー不要 |
913 | - | |
938 | + | |
914 | 939 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
915 | 940 | CommonSwingUtils.putComponentOn(jPanel_setting, jSP_rangeLikeRsv = new JSliderPanel("類似予約の検索時間範囲(0:無制限)",LABEL_WIDTH,0,24,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
916 | 941 | jSP_rangeLikeRsv.setValue(env.getRangeLikeRsv()); |
917 | 942 | // RELOADリスナー不要 |
918 | - | |
943 | + | |
919 | 944 | { |
920 | 945 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
921 | 946 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_givePriorityToReserved = new JCheckBoxPanel("類似予約がある場合は情報を引き継ぐ",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
@@ -926,58 +951,58 @@ public abstract class AbsSettingView extends JScrollPane { | ||
926 | 951 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_givePriorityToReservedTitle = new JCheckBoxPanel("┗ 類似予約のタイトルを引き継ぐ",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
927 | 952 | jCBP_givePriorityToReservedTitle.setSelected(env.getGivePriorityToReservedTitle()); |
928 | 953 | // RELOADリスナー不要 |
929 | - | |
954 | + | |
930 | 955 | // 連動設定 |
931 | 956 | |
932 | 957 | jCBP_givePriorityToReserved.addItemListener(al_giveprioritytoreserved); |
933 | - | |
958 | + | |
934 | 959 | jCBP_givePriorityToReserved.setSelected( ! jCBP_givePriorityToReserved.isSelected()); |
935 | 960 | } |
936 | - | |
961 | + | |
937 | 962 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
938 | 963 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_adjoiningNotRepetition = new JCheckBoxPanel("終了時刻と開始時刻が重なる番組でも重複扱いしない",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
939 | 964 | jCBP_adjoiningNotRepetition.setSelected(env.getAdjoiningNotRepetition()); |
940 | 965 | // RELOADリスナー不要 |
941 | - | |
966 | + | |
942 | 967 | { |
943 | 968 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
944 | 969 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_rsv_showallite = new JCheckBoxPanel("予約一覧で繰り返し予約を展開する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
945 | 970 | jCBP_rsv_showallite.setSelected( ! env.getShowAllIterationItem()); |
946 | 971 | // RELOADリスナー不要 |
947 | - | |
972 | + | |
948 | 973 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
949 | 974 | CommonSwingUtils.putComponentOn(jPanel_setting, jLabel_rsv_itecolor = new JLabel("┗ 展開した繰り返し予約の2回目以降の文字色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
950 | 975 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_rsv_itecolor = new JCCLabel("文字色",env.getIterationItemForeground(),false,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
951 | 976 | // RELOADリスナー不要 |
952 | - | |
977 | + | |
953 | 978 | jCBP_rsv_showallite.addItemListener(al_showallite); |
954 | - | |
979 | + | |
955 | 980 | // Fire! |
956 | 981 | jCBP_rsv_showallite.setSelected( ! jCBP_rsv_showallite.isSelected()); |
957 | 982 | } |
958 | - | |
983 | + | |
959 | 984 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
960 | 985 | CommonSwingUtils.putComponentOn(jPanel_setting, jLabel_rsv_tunshortcolor = new JLabel("チューナー不足警告の背景色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
961 | 986 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_rsv_tunshortcolor = new JCCLabel("チューナー不足警告の背景色",env.getTunerShortColor(),true,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
962 | 987 | // RELOADリスナー不要 |
963 | - | |
988 | + | |
964 | 989 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
965 | 990 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※チューナー不足警告は、レコーダの予約一覧上に表示される警告情報を反映しています。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
966 | 991 | y+=(PARTS_HEIGHT); |
967 | 992 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※EDCBの場合、チューナー不足警告は鯛ナビからの予約アクションでは更新されませんので、必要に応じて予約一覧の再取得を行って更新してください。"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
968 | - | |
993 | + | |
969 | 994 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
970 | 995 | CommonSwingUtils.putComponentOn(jPanel_setting, jLabel_rsv_recedcolor = new JLabel("正常録画済み(と思われる)予約の背景色"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
971 | 996 | CommonSwingUtils.putComponentOn(jPanel_setting, jCCL_rsv_recedcolor = new JCCLabel("正常録画済み(と思われる)予約の背景色",env.getRecordedColor(),true,parent,ccwin), CCLABEL_WIDTH, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
972 | 997 | // RELOADリスナー不要 |
973 | - | |
998 | + | |
974 | 999 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
975 | 1000 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useAutocomplete = new JCheckBoxPanel("【RD】タイトル自動補完機能を使用する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
976 | 1001 | jCBP_useAutocomplete.setSelected(env.getUseAutocomplete()); |
977 | 1002 | // RELOADリスナー不要 |
978 | - | |
1003 | + | |
979 | 1004 | /* |
980 | - * その他 | |
1005 | + * その他 | |
981 | 1006 | */ |
982 | 1007 | |
983 | 1008 | y+=(PARTS_HEIGHT+BLOCK_SEP_HEIGHT); |
@@ -990,7 +1015,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
990 | 1015 | } |
991 | 1016 | jCBX_updateMethod.setSelectedItem(env.getUpdateMethod()); |
992 | 1017 | // RELOADリスナー不要 |
993 | - | |
1018 | + | |
994 | 1019 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
995 | 1020 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_disableBeep = new JCheckBoxPanel("beep禁止",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
996 | 1021 | jCBP_disableBeep.setSelected(env.getDisableBeep()); |
@@ -1006,11 +1031,11 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1006 | 1031 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_hideToTray = new JCheckBoxPanel("┗ 最小化時はシステムトレイに隠す",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1007 | 1032 | jCBP_hideToTray.setSelected(env.getHideToTray()); |
1008 | 1033 | // RELOADリスナー不要 |
1009 | - | |
1034 | + | |
1010 | 1035 | // 連動設定 |
1011 | 1036 | |
1012 | 1037 | jCBP_showSysTray.addItemListener(al_showsystray); |
1013 | - | |
1038 | + | |
1014 | 1039 | jCBP_showSysTray.setSelected( ! jCBP_showSysTray.isSelected()); |
1015 | 1040 | } |
1016 | 1041 |
@@ -1018,69 +1043,69 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1018 | 1043 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_onlyOneInstance = new JCheckBoxPanel("多重起動禁止(要再起動)",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1019 | 1044 | jCBP_onlyOneInstance.setSelected(env.getOnlyOneInstance()); |
1020 | 1045 | // RELOADリスナー不要 |
1021 | - | |
1046 | + | |
1022 | 1047 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1023 | 1048 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_lookAndFeel("ルック&フィール"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1024 | 1049 | CommonSwingUtils.putComponentOn(jPanel_setting, getJComboBox_lookAndFeel(), 250, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
1025 | 1050 | // RELOADリスナー不要 |
1026 | - | |
1051 | + | |
1027 | 1052 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1028 | 1053 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_font("表示フォント"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1029 | 1054 | CommonSwingUtils.putComponentOn(jPanel_setting, getJComboBox_font(), 250, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
1030 | 1055 | CommonSwingUtils.putComponentOn(jPanel_setting, getJComboBox_fontSize(), 100, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH+260, y); |
1031 | 1056 | // RELOADリスナー不要 |
1032 | - | |
1057 | + | |
1033 | 1058 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1034 | 1059 | CommonSwingUtils.putComponentOn(jPanel_setting, new JLabel("┗ 表示サンプル"), LABEL_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1035 | 1060 | CommonSwingUtils.putComponentOn(jPanel_setting, getJLabel_fontSample(""), 360, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH, y); |
1036 | - | |
1061 | + | |
1037 | 1062 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1038 | 1063 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useGTKRC = new JCheckBoxPanel("鯛ナビ専用のgtkrcを使う",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1039 | 1064 | jCBP_useGTKRC.setSelected(env.getUseGTKRC()); |
1040 | - | |
1065 | + | |
1041 | 1066 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1042 | 1067 | CommonSwingUtils.putComponentOn(jPanel_setting, getNoticeMsg("※ルック&フィールがGTKの場合は再起動するまで表示フォントの設定は反映されません(@see env/_gtkrc-2.0)"), DESCRIPTION_WIDTH, PARTS_HEIGHT, SEP_WIDTH*2, y); |
1043 | - | |
1068 | + | |
1044 | 1069 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1045 | 1070 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useRundll32 = new JCheckBoxPanel("【Win】ファイルオープンにrundll32を使用する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1046 | 1071 | jCBP_useRundll32.setSelected(env.getUseRundll32()); |
1047 | 1072 | // RELOADリスナー不要 |
1048 | - | |
1073 | + | |
1049 | 1074 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1050 | 1075 | CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_debug = new JCheckBoxPanel("【注意】デバッグログ出力を有効にする",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); |
1051 | 1076 | jCBP_debug.setSelected(env.getDebug()); |
1052 | 1077 | // RELOADリスナー不要 |
1053 | 1078 | |
1054 | 1079 | y += (PARTS_HEIGHT + 50); |
1055 | - | |
1080 | + | |
1056 | 1081 | // 画面の全体サイズを決める |
1057 | 1082 | Dimension d = new Dimension(PANEL_WIDTH,y); |
1058 | 1083 | jPanel_setting.setPreferredSize(d); |
1059 | 1084 | } |
1060 | - | |
1085 | + | |
1061 | 1086 | return jPanel_setting; |
1062 | 1087 | } |
1063 | - | |
1088 | + | |
1064 | 1089 | /******************************************************************************* |
1065 | 1090 | * アクション |
1066 | 1091 | ******************************************************************************/ |
1067 | - | |
1092 | + | |
1068 | 1093 | // 更新確定ボタン押下時の処理 |
1069 | 1094 | private void updateEnvs() { |
1070 | - | |
1095 | + | |
1071 | 1096 | TatCount tc = new TatCount(); |
1072 | - | |
1097 | + | |
1073 | 1098 | StWin.clear(); |
1074 | - | |
1099 | + | |
1075 | 1100 | new SwingBackgroundWorker(false) { |
1076 | - | |
1101 | + | |
1077 | 1102 | @Override |
1078 | 1103 | protected Object doWorks() throws Exception { |
1079 | - | |
1104 | + | |
1080 | 1105 | StWin.appendMessage(MSGID+"設定を保存します"); |
1081 | - | |
1106 | + | |
1082 | 1107 | int idx; |
1083 | - | |
1108 | + | |
1084 | 1109 | // リスト形式 |
1085 | 1110 | env.setDisableFazzySearch(jCBP_disableFazzySearch.isSelected()); |
1086 | 1111 | env.setDisableFazzySearchReverse(jCBP_disableFazzySearchReverse.isSelected()); |
@@ -1106,7 +1131,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1106 | 1131 | env.setDblClkCmd((DblClkCmd) jCBX_dblClkCmd.getSelectedItem()); |
1107 | 1132 | env.setSearchResultMax(jSP_searchResultMax.getValue()); |
1108 | 1133 | env.setSearchResultBufferMax(jSP_searchResultBufferMax.getValue()); |
1109 | - | |
1134 | + | |
1110 | 1135 | // 新聞形式関連 |
1111 | 1136 | { |
1112 | 1137 | String selected = jRBP_getPaperRedrawType.getSelectedItem().getText(); |
@@ -1132,7 +1157,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1132 | 1157 | env.setEffectComboToPaper(jCBP_effectComboToPaper.isSelected()); |
1133 | 1158 | env.setSnapshotFmt((SnapshotFmt) jCBX_snapshotFmt.getSelectedItem()); |
1134 | 1159 | env.setPrintSnapshot(jCBP_printSnapshot.isSelected()); |
1135 | - | |
1160 | + | |
1136 | 1161 | // リスト・新聞形式共通 |
1137 | 1162 | env.setDisplayOnlyExecOnEntry(jCBP_displayOnlyExecOnEntry.isSelected()); |
1138 | 1163 | env.setDisplayPassedReserve(jCBP_displayPassedReserve.isSelected()); |
@@ -1156,7 +1181,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1156 | 1181 | tv.setValue((String) jTable_mitable.getValueAt(row, 1)); |
1157 | 1182 | env.getTvCommand().add(tv); |
1158 | 1183 | } |
1159 | - | |
1184 | + | |
1160 | 1185 | // Web番組表対応 |
1161 | 1186 | env.setContinueTomorrow(jCBP_continueTomorrow.isSelected()); |
1162 | 1187 | env.setCacheTimeLimit(jSP_cacheTimeLimit.getValue()); |
@@ -1182,13 +1207,16 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1182 | 1207 | env.setHistoryOnlyUpdateOnce(jCBP_historyOnlyUpdateOnce.isSelected()); |
1183 | 1208 | env.setUsePassedProgram(jCBP_usePassedProgram.isSelected()); |
1184 | 1209 | env.setPrepPassedProgramCount(jSP_prepPassedProgramCount.getValue()); |
1185 | - | |
1210 | + env.setDownloadProgramOnFixedTime(jCBP_downloadProgramOnFixedTime.isSelected()); | |
1211 | + env.setDownloadProgramInBackground(jCBP_downloadProgramInBackground.isSelected()); | |
1212 | + env.setDownloadProgramTimeList(jTextField_downloadProgramTimeList.getText()); | |
1213 | + | |
1186 | 1214 | // レコーダ対応 |
1187 | 1215 | env.setForceLoadReserveDetails(jRBP_getRdReserveDetails.getSelectedIndex()); |
1188 | 1216 | env.setForceLoadAutoReserves(jRBP_getRdAutoReserves.getSelectedIndex()); |
1189 | 1217 | env.setForceLoadRecorded(jRBP_getRdRecorded.getSelectedIndex()); |
1190 | 1218 | env.setRecordedSaveScope(jCBX_recordedSaveScope.getSelectedIndex()); |
1191 | - | |
1219 | + | |
1192 | 1220 | // 予約 |
1193 | 1221 | env.setSpoexLength(String.format("%d",jSP_spoex_extend.getValue())); |
1194 | 1222 | idx = jRBP_overlapUp.getSelectedIndex(); |
@@ -1226,7 +1254,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1226 | 1254 | env.setTunerShortColor(jCCL_rsv_tunshortcolor.getChoosed()); |
1227 | 1255 | env.setRecordedColor(jCCL_rsv_recedcolor.getChoosed()); |
1228 | 1256 | env.setUseAutocomplete(jCBP_useAutocomplete.isSelected()); |
1229 | - | |
1257 | + | |
1230 | 1258 | // その他の設定 |
1231 | 1259 | env.setUpdateMethod((UpdateOn) jCBX_updateMethod.getSelectedItem()); |
1232 | 1260 | env.setDisableBeep(jCBP_disableBeep.isSelected()); |
@@ -1239,14 +1267,14 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1239 | 1267 | env.setUseGTKRC(jCBP_useGTKRC.isSelected()); |
1240 | 1268 | env.setUseRundll32(jCBP_useRundll32.isSelected()); |
1241 | 1269 | env.setDebug(jCBP_debug.isSelected()); |
1242 | - | |
1270 | + | |
1243 | 1271 | // 設定保存 |
1244 | 1272 | setEnv(reload_prog_needed); |
1245 | 1273 | setUpdateButtonEnhanced(false); |
1246 | - | |
1274 | + | |
1247 | 1275 | return null; |
1248 | 1276 | } |
1249 | - | |
1277 | + | |
1250 | 1278 | @Override |
1251 | 1279 | protected void doFinally() { |
1252 | 1280 | StWinSetVisible(false); |
@@ -1255,10 +1283,10 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1255 | 1283 | |
1256 | 1284 | StWinSetLocationCenter(parent); |
1257 | 1285 | StWinSetVisible(true); |
1258 | - | |
1286 | + | |
1259 | 1287 | MWin.appendMessage(String.format(MSGID+"更新が完了しました。所要時間: %.2f秒",tc.end())); |
1260 | 1288 | } |
1261 | - | |
1289 | + | |
1262 | 1290 | /** |
1263 | 1291 | * 各種設定タブ以外で変更したenvの内容をタブに反映する |
1264 | 1292 | */ |
@@ -1267,19 +1295,19 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1267 | 1295 | jRBP_getRdAutoReserves.setSelectedIndex(env.getForceLoadAutoReserves()); |
1268 | 1296 | jRBP_getRdRecorded.setSelectedIndex(env.getForceLoadRecorded()); |
1269 | 1297 | } |
1270 | - | |
1298 | + | |
1271 | 1299 | /******************************************************************************* |
1272 | 1300 | * リスナー |
1273 | 1301 | ******************************************************************************/ |
1274 | - | |
1302 | + | |
1275 | 1303 | /* |
1276 | 1304 | * 連動 |
1277 | 1305 | */ |
1278 | - | |
1306 | + | |
1279 | 1307 | /** |
1280 | 1308 | * 変更があった場合に番組表のリロードを要求するコンポーネントにつけるリスナー |
1281 | 1309 | */ |
1282 | - | |
1310 | + | |
1283 | 1311 | private void setUpdateButtonEnhanced(boolean b) { |
1284 | 1312 | if (b) { |
1285 | 1313 | jButton_update.setText("更新時番組表再取得あり"); |
@@ -1291,7 +1319,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1291 | 1319 | } |
1292 | 1320 | reload_prog_needed = b; |
1293 | 1321 | } |
1294 | - | |
1322 | + | |
1295 | 1323 | private final ItemListener IL_RELOAD_PROG_NEEDED = new ItemListener() { |
1296 | 1324 | @Override |
1297 | 1325 | public void itemStateChanged(ItemEvent e) { |
@@ -1322,7 +1350,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1322 | 1350 | if (debug) System.err.println(DBGID+"MODIFIED"); |
1323 | 1351 | setUpdateButtonEnhanced(true); |
1324 | 1352 | } |
1325 | - | |
1353 | + | |
1326 | 1354 | @Override |
1327 | 1355 | public void editingCanceled(ChangeEvent e) { |
1328 | 1356 | } |
@@ -1354,7 +1382,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1354 | 1382 | jCCL_rsvdLineColor.setEnabled(true); |
1355 | 1383 | jLabel_pickedLineColor.setEnabled(true); |
1356 | 1384 | jCCL_pickedLineColor.setEnabled(true); |
1357 | - | |
1385 | + | |
1358 | 1386 | } |
1359 | 1387 | else { |
1360 | 1388 | jLabel_rsvdLineColor.setEnabled(false); |
@@ -1364,7 +1392,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1364 | 1392 | } |
1365 | 1393 | } |
1366 | 1394 | }; |
1367 | - | |
1395 | + | |
1368 | 1396 | // 現在放送中行の背景色 |
1369 | 1397 | ItemListener al_currentlineenhance = new ItemListener() { |
1370 | 1398 | @Override |
@@ -1373,7 +1401,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1373 | 1401 | if (jCBP_currentLineEnhance.isSelected()) { |
1374 | 1402 | jLabel_currentLineColor.setEnabled(true); |
1375 | 1403 | jCCL_currentLineColor.setEnabled(true); |
1376 | - | |
1404 | + | |
1377 | 1405 | } |
1378 | 1406 | else { |
1379 | 1407 | jLabel_currentLineColor.setEnabled(false); |
@@ -1414,7 +1442,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1414 | 1442 | jCBP_pagerEnable.removeItemListener(il_pagerenable); |
1415 | 1443 | jCBP_pagerEnable.setEnabled(false); |
1416 | 1444 | jCBP_pagerEnable.addItemListener(il_pagerenable); |
1417 | - | |
1445 | + | |
1418 | 1446 | jSP_centerPerPage.setEnabled(false); |
1419 | 1447 | jCBP_allPageSnapshot.setEnabled(false); |
1420 | 1448 | } |
@@ -1422,7 +1450,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1422 | 1450 | jCBP_pagerEnable.removeItemListener(il_pagerenable); |
1423 | 1451 | jCBP_pagerEnable.setEnabled(true); |
1424 | 1452 | jCBP_pagerEnable.addItemListener(il_pagerenable); |
1425 | - | |
1453 | + | |
1426 | 1454 | if (jCBP_pagerEnable.isSelected()) { |
1427 | 1455 | jSP_centerPerPage.setEnabled(true); |
1428 | 1456 | jCBP_allPageSnapshot.setEnabled(true); |
@@ -1455,7 +1483,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1455 | 1483 | } |
1456 | 1484 | }; |
1457 | 1485 | */ |
1458 | - | |
1486 | + | |
1459 | 1487 | ItemListener al_tooltipenable = new ItemListener() { |
1460 | 1488 | @Override |
1461 | 1489 | public void itemStateChanged(ItemEvent e) { |
@@ -1555,7 +1583,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1555 | 1583 | } |
1556 | 1584 | } |
1557 | 1585 | }; |
1558 | - | |
1586 | + | |
1559 | 1587 | ItemListener al_showsystray = new ItemListener() { |
1560 | 1588 | @Override |
1561 | 1589 | public void itemStateChanged(ItemEvent e) { |
@@ -1568,39 +1596,54 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1568 | 1596 | } |
1569 | 1597 | } |
1570 | 1598 | }; |
1571 | - | |
1599 | + | |
1572 | 1600 | ActionListener al_fontChanged = new ActionListener() { |
1573 | 1601 | @Override |
1574 | 1602 | public void actionPerformed(ActionEvent e) { |
1575 | - | |
1603 | + | |
1576 | 1604 | String fn = (String) jComboBox_font.getSelectedItem(); |
1577 | 1605 | int fs = Integer.valueOf((String) jComboBox_fontSize.getSelectedItem()); |
1578 | - | |
1606 | + | |
1579 | 1607 | fontChanged(fn, fs); |
1580 | - | |
1608 | + | |
1581 | 1609 | if ( jLabel_fontSample != null ) { |
1582 | 1610 | Font f = jLabel_fontSample.getFont(); |
1583 | 1611 | jLabel_fontSample.setFont(new Font(fn,f.getStyle(),fs)); |
1584 | 1612 | } |
1585 | 1613 | } |
1586 | 1614 | }; |
1587 | - | |
1588 | - | |
1615 | + | |
1616 | + ItemListener al_downloadProgramOnFixedTime = new ItemListener() { | |
1617 | + @Override | |
1618 | + public void itemStateChanged(ItemEvent e) { | |
1619 | + if (debug) System.out.println("Fire! al_downloadProgramOnFixedTime"); | |
1620 | + if (jCBP_downloadProgramOnFixedTime.isSelected()) { | |
1621 | + jTextField_downloadProgramTimeList.setEnabled(true); | |
1622 | +// jCBP_downloadProgramInBackground.setEnabled(true); | |
1623 | + } | |
1624 | + else { | |
1625 | + jTextField_downloadProgramTimeList.setEnabled(false); | |
1626 | +// jCBP_downloadProgramInBackground.setEnabled(false); | |
1627 | + } | |
1628 | + } | |
1629 | + }; | |
1630 | + | |
1631 | + | |
1589 | 1632 | /******************************************************************************* |
1590 | 1633 | * コンポーネント |
1591 | 1634 | ******************************************************************************/ |
1592 | - | |
1635 | + | |
1593 | 1636 | private JLabel getNoticeMsg(String text) { |
1594 | 1637 | JLabel l = new JLabel(text); |
1595 | 1638 | l.setForeground(NOTICEMSG_COLOR); |
1596 | 1639 | return l; |
1597 | 1640 | } |
1598 | - | |
1641 | + | |
1599 | 1642 | // 更新確定ボタン |
1600 | 1643 | private JButton getJButton_update(String s) { |
1601 | 1644 | if (jButton_update == null) { |
1602 | 1645 | jButton_update = new JButton(s); |
1603 | - | |
1646 | + | |
1604 | 1647 | jButton_update.addActionListener(new ActionListener() { |
1605 | 1648 | public void actionPerformed(ActionEvent e) { |
1606 | 1649 | updateEnvs(); |
@@ -1609,7 +1652,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1609 | 1652 | } |
1610 | 1653 | return(jButton_update); |
1611 | 1654 | } |
1612 | - | |
1655 | + | |
1613 | 1656 | // |
1614 | 1657 | private JLabel getJLabel_userAgent(String s) |
1615 | 1658 | { |
@@ -1626,7 +1669,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1626 | 1669 | } |
1627 | 1670 | return jTextField_userAgent; |
1628 | 1671 | } |
1629 | - | |
1672 | + | |
1630 | 1673 | // |
1631 | 1674 | private JLabel getJLabel_proxy(String s) |
1632 | 1675 | { |
@@ -1651,7 +1694,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1651 | 1694 | } |
1652 | 1695 | return jTextField_proxyPort; |
1653 | 1696 | } |
1654 | - | |
1697 | + | |
1655 | 1698 | // 表示マークの選択 |
1656 | 1699 | private JLabel getJLabel_showmarks(String s) { |
1657 | 1700 | if (jLabel_showmarks == null) { |
@@ -1672,7 +1715,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1672 | 1715 | // ヘッダの設定 |
1673 | 1716 | String[] colname = {"チェック", "マーク", "ID"}; |
1674 | 1717 | int[] colwidth = {50,250,0}; |
1675 | - | |
1718 | + | |
1676 | 1719 | // |
1677 | 1720 | DefaultTableModel model = new DefaultTableModel(colname, 0); |
1678 | 1721 | jTable_showmarks = new JNETable(model, false) { |
@@ -1691,10 +1734,10 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1691 | 1734 | column = columnModel.getColumn(i); |
1692 | 1735 | column.setPreferredWidth(colwidth[i]); |
1693 | 1736 | } |
1694 | - | |
1737 | + | |
1695 | 1738 | // にゃーん |
1696 | 1739 | jTable_showmarks.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
1697 | - | |
1740 | + | |
1698 | 1741 | // エディタに手を入れる |
1699 | 1742 | DefaultCellEditor editor = new DefaultCellEditor(new JCheckBox() { |
1700 | 1743 |
@@ -1705,12 +1748,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1705 | 1748 | return JCheckBox.CENTER; |
1706 | 1749 | } |
1707 | 1750 | }); |
1708 | - | |
1751 | + | |
1709 | 1752 | editor.addCellEditorListener(CEL_RELOAD_PROG_NEEDED); |
1710 | - | |
1753 | + | |
1711 | 1754 | // |
1712 | 1755 | jTable_showmarks.getColumn("チェック").setCellEditor(editor); |
1713 | - | |
1756 | + | |
1714 | 1757 | // レンダラに手を入れる |
1715 | 1758 | DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() { |
1716 | 1759 |
@@ -1736,7 +1779,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1736 | 1779 | } |
1737 | 1780 | }; |
1738 | 1781 | jTable_showmarks.getColumn("チェック").setCellRenderer(renderer); |
1739 | - | |
1782 | + | |
1740 | 1783 | // |
1741 | 1784 | for (Object[] obj : TVProgram.optMarks) { |
1742 | 1785 | Entry<ProgOption,Boolean> entry = null; |
@@ -1779,15 +1822,15 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1779 | 1822 | Object b = jTable_clipboard.getValueAt(row, 0); |
1780 | 1823 | Object item = jTable_clipboard.getValueAt(row, 1); |
1781 | 1824 | Object id = jTable_clipboard.getValueAt(row, 2); |
1782 | - | |
1825 | + | |
1783 | 1826 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row-1, 0), row, 0); |
1784 | 1827 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row-1, 1), row, 1); |
1785 | 1828 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row-1, 2), row, 2); |
1786 | - | |
1829 | + | |
1787 | 1830 | jTable_clipboard.setValueAt(b, row-1, 0); |
1788 | 1831 | jTable_clipboard.setValueAt(item, row-1, 1); |
1789 | 1832 | jTable_clipboard.setValueAt(id, row-1, 2); |
1790 | - | |
1833 | + | |
1791 | 1834 | jTable_clipboard.setRowSelectionInterval(row-1, row-1); |
1792 | 1835 | } |
1793 | 1836 | }); |
@@ -1807,15 +1850,15 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1807 | 1850 | Object b = jTable_clipboard.getValueAt(row, 0); |
1808 | 1851 | Object item = jTable_clipboard.getValueAt(row, 1); |
1809 | 1852 | Object id = jTable_clipboard.getValueAt(row, 2); |
1810 | - | |
1853 | + | |
1811 | 1854 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row+1, 0), row, 0); |
1812 | 1855 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row+1, 1), row, 1); |
1813 | 1856 | jTable_clipboard.setValueAt(jTable_clipboard.getValueAt(row+1, 2), row, 2); |
1814 | - | |
1857 | + | |
1815 | 1858 | jTable_clipboard.setValueAt(b, row+1, 0); |
1816 | 1859 | jTable_clipboard.setValueAt(item, row+1, 1); |
1817 | 1860 | jTable_clipboard.setValueAt(id, row+1, 2); |
1818 | - | |
1861 | + | |
1819 | 1862 | jTable_clipboard.setRowSelectionInterval(row+1, row+1); |
1820 | 1863 | } |
1821 | 1864 | }); |
@@ -1835,7 +1878,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1835 | 1878 | // ヘッダの設定 |
1836 | 1879 | String[] colname = {"チェック", "アイテム", "ID"}; |
1837 | 1880 | int[] colwidth = {50,250,0}; |
1838 | - | |
1881 | + | |
1839 | 1882 | // |
1840 | 1883 | DefaultTableModel model = new DefaultTableModel(colname, 0); |
1841 | 1884 | jTable_clipboard = new JNETable(model, false) { |
@@ -1854,10 +1897,10 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1854 | 1897 | column = columnModel.getColumn(i); |
1855 | 1898 | column.setPreferredWidth(colwidth[i]); |
1856 | 1899 | } |
1857 | - | |
1900 | + | |
1858 | 1901 | // にゃーん |
1859 | 1902 | jTable_clipboard.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
1860 | - | |
1903 | + | |
1861 | 1904 | // エディタに手を入れる |
1862 | 1905 | DefaultCellEditor editor = new DefaultCellEditor(new JCheckBox() { |
1863 | 1906 |
@@ -1894,7 +1937,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1894 | 1937 | } |
1895 | 1938 | }; |
1896 | 1939 | jTable_clipboard.getColumn("チェック").setCellRenderer(renderer); |
1897 | - | |
1940 | + | |
1898 | 1941 | // |
1899 | 1942 | for (ClipboardInfo cb : getCbItemEnv()) { |
1900 | 1943 | Object[] data = { cb.getB(), cb.getItem(), cb.getId() }; |
@@ -1903,7 +1946,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1903 | 1946 | } |
1904 | 1947 | return(jTable_clipboard); |
1905 | 1948 | } |
1906 | - | |
1949 | + | |
1907 | 1950 | // 右クリックメニューの実行コマンドの追加 |
1908 | 1951 | private JLabel getJLabel_menuitem(String s) { |
1909 | 1952 | if (jLabel_menuitem == null) { |
@@ -1971,13 +2014,13 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1971 | 2014 | } |
1972 | 2015 | Object name = jTable_mitable.getValueAt(row, 0); |
1973 | 2016 | Object cmd = jTable_mitable.getValueAt(row, 1); |
1974 | - | |
2017 | + | |
1975 | 2018 | jTable_mitable.setValueAt(jTable_mitable.getValueAt(row-1, 0), row, 0); |
1976 | 2019 | jTable_mitable.setValueAt(jTable_mitable.getValueAt(row-1, 1), row, 1); |
1977 | - | |
2020 | + | |
1978 | 2021 | jTable_mitable.setValueAt(name, row-1, 0); |
1979 | 2022 | jTable_mitable.setValueAt(cmd, row-1, 1); |
1980 | - | |
2023 | + | |
1981 | 2024 | jTable_mitable.setRowSelectionInterval(row-1, row-1); |
1982 | 2025 | } |
1983 | 2026 | }); |
@@ -1996,13 +2039,13 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1996 | 2039 | } |
1997 | 2040 | Object name = jTable_mitable.getValueAt(row, 0); |
1998 | 2041 | Object cmd = jTable_mitable.getValueAt(row, 1); |
1999 | - | |
2042 | + | |
2000 | 2043 | jTable_mitable.setValueAt(jTable_mitable.getValueAt(row+1, 0), row, 0); |
2001 | 2044 | jTable_mitable.setValueAt(jTable_mitable.getValueAt(row+1, 1), row, 1); |
2002 | - | |
2045 | + | |
2003 | 2046 | jTable_mitable.setValueAt(name, row+1, 0); |
2004 | 2047 | jTable_mitable.setValueAt(cmd, row+1, 1); |
2005 | - | |
2048 | + | |
2006 | 2049 | jTable_mitable.setRowSelectionInterval(row+1, row+1); |
2007 | 2050 | } |
2008 | 2051 | }); |
@@ -2022,7 +2065,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2022 | 2065 | // ヘッダの設定 |
2023 | 2066 | String[] colname = {"コマンド名", "実行するコマンド"}; |
2024 | 2067 | int[] colwidth = {col1_w,col2_w}; |
2025 | - | |
2068 | + | |
2026 | 2069 | // |
2027 | 2070 | DefaultTableModel model = new DefaultTableModel(colname, 0); |
2028 | 2071 | jTable_mitable = new JNETable(model, false) { |
@@ -2041,10 +2084,10 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2041 | 2084 | column = columnModel.getColumn(i); |
2042 | 2085 | column.setPreferredWidth(colwidth[i]); |
2043 | 2086 | } |
2044 | - | |
2087 | + | |
2045 | 2088 | // にゃーん |
2046 | 2089 | jTable_mitable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
2047 | - | |
2090 | + | |
2048 | 2091 | // |
2049 | 2092 | for (TextValueSet tv : env.getTvCommand()) { |
2050 | 2093 | Object[] data = { tv.getText(), tv.getValue() }; |
@@ -2053,7 +2096,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2053 | 2096 | } |
2054 | 2097 | return(jTable_mitable); |
2055 | 2098 | } |
2056 | - | |
2099 | + | |
2057 | 2100 | // |
2058 | 2101 | private JLabel getJLabel_ngword(String s) { |
2059 | 2102 | if (jLabel_ngword == null) { |
@@ -2098,7 +2141,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2098 | 2141 | else { |
2099 | 2142 | model.setSelectedItem(UIManager.getLookAndFeel().getName()); |
2100 | 2143 | } |
2101 | - | |
2144 | + | |
2102 | 2145 | // |
2103 | 2146 | jComboBox_lookAndFeel.addActionListener(new ActionListener() { |
2104 | 2147 | public void actionPerformed(ActionEvent e) { |
@@ -2110,7 +2153,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2110 | 2153 | } |
2111 | 2154 | return jComboBox_lookAndFeel; |
2112 | 2155 | } |
2113 | - | |
2156 | + | |
2114 | 2157 | private JLabel getJLabel_font(String s) { |
2115 | 2158 | if (jLabel_font == null) { |
2116 | 2159 | jLabel_font = new JLabel(); |
@@ -2136,7 +2179,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2136 | 2179 | else { |
2137 | 2180 | model.setSelectedItem(jComboBox_font.getFont().getFontName()); |
2138 | 2181 | } |
2139 | - | |
2182 | + | |
2140 | 2183 | // |
2141 | 2184 | jComboBox_font.addActionListener(al_fontChanged); |
2142 | 2185 |
@@ -2154,7 +2197,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2154 | 2197 | if ( env.getFontSize() > 0) { |
2155 | 2198 | jComboBox_fontSize.setSelectedItem(String.valueOf(env.getFontSize())); |
2156 | 2199 | } |
2157 | - | |
2200 | + | |
2158 | 2201 | jComboBox_fontSize.addActionListener(al_fontChanged); |
2159 | 2202 | } |
2160 | 2203 | return(jComboBox_fontSize); |
@@ -2171,7 +2214,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2171 | 2214 | } |
2172 | 2215 | return jLabel_fontSample; |
2173 | 2216 | } |
2174 | - | |
2217 | + | |
2175 | 2218 | private JLabel getJLabel_enableCHAVsetting(String s) |
2176 | 2219 | { |
2177 | 2220 | if (jLabel_enableCHAVsetting == null) { |
@@ -2187,7 +2230,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2187 | 2230 | } |
2188 | 2231 | return(jCheckBox_enableCHAVsetting); |
2189 | 2232 | } |
2190 | - | |
2233 | + | |
2191 | 2234 | private JLabel getJLabel_autoFolderSelect(String s) |
2192 | 2235 | { |
2193 | 2236 | if (jLabel_autoFolderSelect == null) { |
@@ -2213,4 +2256,13 @@ public abstract class AbsSettingView extends JScrollPane { | ||
2213 | 2256 | } |
2214 | 2257 | return jta_help; |
2215 | 2258 | } |
2259 | + | |
2260 | + private JTextField getJTextField_downloadProgramTimeList(String s) { | |
2261 | + if (jTextField_downloadProgramTimeList == null) { | |
2262 | + jTextField_downloadProgramTimeList = new JTextFieldWithPopup(); | |
2263 | + jTextField_downloadProgramTimeList.setText(s); | |
2264 | + jTextField_downloadProgramTimeList.setCaretPosition(0); | |
2265 | + } | |
2266 | + return jTextField_downloadProgramTimeList; | |
2267 | + } | |
2216 | 2268 | } |
@@ -126,6 +126,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
126 | 126 | private static final String ICONFILE_SEARCH = "icon/system-search-2.png"; |
127 | 127 | private static final String ICONFILE_ADDKEYWORD = "icon/bookmark-new-list-4.png"; |
128 | 128 | private static final String ICONFILE_RELOADPROG = "icon/internet-news-reader.png"; |
129 | + private static final String ICONFILE_STOPRELOADPROG = "icon/stop-news-reader.png"; | |
129 | 130 | private static final String ICONFILE_BATCHCMD = "icon/checkbox.png"; |
130 | 131 | private static final String ICONFILE_RELOADRSV = "icon/video-television.png"; |
131 | 132 | private static final String ICONFILE_WAKEUP = "icon/system-shutdown-2.png"; |
@@ -152,6 +153,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
152 | 153 | private static final String TIPS_ADDKEYWORD = "キーワードリストに登録(Ctrl+K)"; |
153 | 154 | private static final String TIPS_PAGER = "ページャー"; |
154 | 155 | private static final String TIPS_RELOADPROG = "Webから番組情報を再取得(Ctrl+W)"; |
156 | + private static final String TIPS_STOPRELOADPROG = "バックグランドで実行中の番組情報の取得を中止"; | |
155 | 157 | private static final String TIPS_BATCHRESERVATION = "一括予約(Ctrl+B)"; |
156 | 158 | private static final String TIPS_RECORDERSEL = "操作するレコーダを選択する"; |
157 | 159 | private static final String TIPS_RELOADRSVED = "レコーダから予約情報を再取得&レコーダの各種設定情報の収集(Ctrl+R)"; |
@@ -436,6 +438,24 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
436 | 438 | jButton_addkeyword.setEnabled(b); |
437 | 439 | } |
438 | 440 | |
441 | + /* | |
442 | + * TVプログラムの再取得 | |
443 | + */ | |
444 | + public void setReloadTVProgramsInProgress(boolean b){ | |
445 | + if (jButton_reloadprogs != null){ | |
446 | + ImageIcon icon = new ImageIcon(b ? ICONFILE_STOPRELOADPROG : ICONFILE_RELOADPROG); | |
447 | + jButton_reloadprogs.setIcon(icon); | |
448 | + jButton_reloadprogs.setToolTipText(b ? TIPS_STOPRELOADPROG : TIPS_RELOADPROG); | |
449 | + } | |
450 | + | |
451 | + if (jButton_reloadprogmenu != null){ | |
452 | + jButton_reloadprogmenu.setEnabled(!b); | |
453 | + if (b) | |
454 | + jButton_reloadprogmenu.removeMouseListener(ma_reloadProgramExtension); | |
455 | + else | |
456 | + jButton_reloadprogmenu.addMouseListener(ma_reloadProgramExtension); | |
457 | + } | |
458 | + } | |
439 | 459 | /** |
440 | 460 | * ばちー |
441 | 461 | */ |
@@ -26,6 +26,7 @@ import java.net.HttpURLConnection; | ||
26 | 26 | import java.net.Socket; |
27 | 27 | import java.nio.channels.FileChannel; |
28 | 28 | import java.nio.channels.FileLock; |
29 | +import java.text.ParseException; | |
29 | 30 | import java.text.SimpleDateFormat; |
30 | 31 | import java.util.ArrayList; |
31 | 32 | import java.util.Calendar; |
@@ -772,6 +773,34 @@ public class CommonUtils { | ||
772 | 773 | } |
773 | 774 | } |
774 | 775 | |
776 | + /* | |
777 | + * 日時を文字列に変換 | |
778 | + */ | |
779 | + public static String getCalendarAsString(GregorianCalendar c){ | |
780 | + if (c == null) | |
781 | + c = new GregorianCalendar(); | |
782 | + | |
783 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS z"); | |
784 | + return sdf.format(c.getTime()); | |
785 | + } | |
786 | + | |
787 | + /* | |
788 | + * 日時を文字列から変換 | |
789 | + */ | |
790 | + public static GregorianCalendar getCalendarFromString(String s){ | |
791 | + if (s == null) | |
792 | + return null; | |
793 | + | |
794 | + GregorianCalendar c = new GregorianCalendar(); | |
795 | + try { | |
796 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS z"); | |
797 | + c.setTime(sdf.parse(s)); | |
798 | + } catch (ParseException e) { | |
799 | + return null; | |
800 | + } | |
801 | + | |
802 | + return c; | |
803 | + } | |
775 | 804 | |
776 | 805 | /******************************************************************************* |
777 | 806 | * Color関連 |
@@ -660,7 +660,25 @@ public class Env { | ||
660 | 660 | public void setPrepPassedProgramCount(int w) { prepPassedProgramCount = w; } |
661 | 661 | private int prepPassedProgramCount = 4; |
662 | 662 | |
663 | - | |
663 | + // 決まった時間に番組表を取得する | |
664 | + public boolean getDownloadProgramOnFixedTime() { return downloadProgramOnFixedTime; } | |
665 | + public void setDownloadProgramOnFixedTime(boolean b) { downloadProgramOnFixedTime = b; } | |
666 | + private boolean downloadProgramOnFixedTime = false; | |
667 | + | |
668 | + // 番組表を取得する時刻の一覧 | |
669 | + public String getDownloadProgramTimeList() { return downloadProgramTimeList; } | |
670 | + public void setDownloadProgramTimeList(String s) { downloadProgramTimeList = s; } | |
671 | + private String downloadProgramTimeList = "08:30"; | |
672 | + | |
673 | + // 番組表をバックグランドで取得するか | |
674 | + public boolean getDownloadProgramInBackground() { return downloadProgramInBackground; } | |
675 | + public void setDownloadProgramInBackground(boolean b) { downloadProgramInBackground = b; } | |
676 | + private boolean downloadProgramInBackground = false; | |
677 | + | |
678 | + // 最後に番組表を取得した時刻 | |
679 | + public String getLastDownloadTime(){ return lastDownloadTime; } | |
680 | + public void setLastDownloadTime(String s){ lastDownloadTime = s; } | |
681 | + private String lastDownloadTime = null; | |
664 | 682 | |
665 | 683 | /* |
666 | 684 | * レコーダ対応 |
@@ -222,7 +222,8 @@ public class GetEventId extends TVProgramUtils implements TVProgram,Cloneable { | ||
222 | 222 | } |
223 | 223 | |
224 | 224 | @Override |
225 | - public void loadProgram(String areaCode, boolean force) { | |
225 | + public boolean loadProgram(String areaCode, boolean force) { | |
226 | + return true; | |
226 | 227 | } |
227 | 228 | |
228 | 229 | @Override |
@@ -1064,6 +1064,9 @@ public class HDDRecorderUtils implements HDDRecorder,Cloneable { | ||
1064 | 1064 | // ちょっと時刻順に整理しよう |
1065 | 1065 | ArrayList<ReserveList> s = new ArrayList<ReserveList>(); |
1066 | 1066 | for ( ReserveList o : r ) { |
1067 | + if (o.getAhh().isEmpty() || o.getAmm().isEmpty() || o.getZhh().isEmpty() || o.getZmm().isEmpty()) | |
1068 | + continue; | |
1069 | + | |
1067 | 1070 | int idx = -1; |
1068 | 1071 | for ( int i=0; i<s.size(); i++ ) { |
1069 | 1072 | if ( o.getStartDateTime().compareTo(s.get(i).getStartDateTime()) < 0 ) { |
@@ -17,65 +17,65 @@ import tainavi.TVProgramIterator.IterationType; | ||
17 | 17 | public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable { |
18 | 18 | |
19 | 19 | //private static final String thisEncoding = "UTF-8"; |
20 | - | |
20 | + | |
21 | 21 | public void setDebug(boolean b) { debug = b; } |
22 | 22 | private static boolean debug = false; |
23 | - | |
23 | + | |
24 | 24 | /* 必須コード - ここから */ |
25 | - | |
25 | + | |
26 | 26 | /******************************************************************************* |
27 | 27 | * 種族の特性 |
28 | 28 | ******************************************************************************/ |
29 | - | |
29 | + | |
30 | 30 | @Override |
31 | 31 | public String getTVProgramId() { return tvProgId; } |
32 | 32 | private static final String tvProgId = "PassedProgram"; |
33 | - | |
33 | + | |
34 | 34 | @Override |
35 | 35 | public boolean isAreaSelectSupported() { return false; } |
36 | - | |
36 | + | |
37 | 37 | @Override |
38 | 38 | public ProgType getType() { return ProgType.PASSED; } |
39 | 39 | @Override |
40 | 40 | public ProgSubtype getSubtype() { return ProgSubtype.NONE; } |
41 | - | |
41 | + | |
42 | 42 | public PassedProgram clone() { |
43 | 43 | return (PassedProgram) super.clone(); |
44 | 44 | } |
45 | - | |
45 | + | |
46 | 46 | // リフレッシュされないようにする |
47 | 47 | @Override |
48 | 48 | public void refresh() {} |
49 | - | |
49 | + | |
50 | 50 | /******************************************************************************* |
51 | 51 | * 個体の特性 |
52 | 52 | ******************************************************************************/ |
53 | - | |
53 | + | |
54 | 54 | @Override |
55 | 55 | public int getTimeBarStart() {return 5;} |
56 | - | |
56 | + | |
57 | 57 | //private int getDogDays() { return 7; } |
58 | - | |
58 | + | |
59 | 59 | public void setUseXML(boolean b) { useXML = b; } |
60 | 60 | private static boolean useXML = false; |
61 | - | |
62 | - | |
61 | + | |
62 | + | |
63 | 63 | /******************************************************************************* |
64 | 64 | * 定数 |
65 | 65 | ******************************************************************************/ |
66 | - | |
66 | + | |
67 | 67 | public static final String SEARCH_RESULT_CENTER = "$SRCRESCNT$"; |
68 | - | |
68 | + | |
69 | 69 | private static final String MSGID = "[過去ログ] "; |
70 | 70 | private static final String ERRID = "[ERROR]"+MSGID; |
71 | 71 | private static final String DBGID = "[DEBUG]"+MSGID; |
72 | - | |
72 | + | |
73 | 73 | /******************************************************************************* |
74 | 74 | * 部品 |
75 | 75 | ******************************************************************************/ |
76 | - | |
76 | + | |
77 | 77 | // コンポーネント以外 |
78 | - | |
78 | + | |
79 | 79 | /** |
80 | 80 | * 保存先のディレクトリを設定する |
81 | 81 | * @param s |
@@ -84,15 +84,15 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
84 | 84 | dname = s; |
85 | 85 | } |
86 | 86 | private static String dname = "passed"; |
87 | - | |
87 | + | |
88 | 88 | public int getProgCount() { return progcount; } |
89 | 89 | private int progcount = 0; |
90 | - | |
90 | + | |
91 | 91 | |
92 | 92 | /******************************************************************************* |
93 | 93 | * コンストラクタ |
94 | 94 | ******************************************************************************/ |
95 | - | |
95 | + | |
96 | 96 | public PassedProgram() { |
97 | 97 | super(); |
98 | 98 | cleanup(); |
@@ -102,20 +102,20 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
102 | 102 | * 情報を全部破棄 |
103 | 103 | */ |
104 | 104 | private void cleanup() { |
105 | - | |
105 | + | |
106 | 106 | crlist = new ArrayList<Center>(); // 番組情報を全部破棄 |
107 | 107 | sortedcrlist = new ArrayList<Center>(); // 番組情報を全部破棄 |
108 | 108 | pcenter = new ArrayList<ProgList>(); // 番組情報を全部破棄 |
109 | - | |
109 | + | |
110 | 110 | } |
111 | 111 | |
112 | - | |
112 | + | |
113 | 113 | /******************************************************************************* |
114 | 114 | * 本体 |
115 | 115 | ******************************************************************************/ |
116 | - | |
117 | - public void loadProgram(String areaCode, boolean force) {} // 使用しない。ダミー。 | |
118 | - | |
116 | + | |
117 | + public boolean loadProgram(String areaCode, boolean force) { return true; } // 使用しない。ダミー。 | |
118 | + | |
119 | 119 | /** |
120 | 120 | * 指定の日付のすべての過去ログを取得する |
121 | 121 | * @param date |
@@ -124,10 +124,10 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
124 | 124 | public boolean loadAllCenters(String date) { |
125 | 125 | return loadByCenter(date,null); |
126 | 126 | } |
127 | - | |
127 | + | |
128 | 128 | final String expr_a = "^(\\d)_(\\d+)_(.+)\\."; |
129 | 129 | final String expr_z = "(xml|txt)$"; |
130 | - | |
130 | + | |
131 | 131 | /** |
132 | 132 | * 指定の日付の指定の放送局の過去ログを取得する |
133 | 133 | * @param date |
@@ -135,18 +135,18 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
135 | 135 | * @return |
136 | 136 | */ |
137 | 137 | public boolean loadByCenter(String date, String center) { |
138 | - | |
138 | + | |
139 | 139 | progcount = 0; |
140 | - | |
140 | + | |
141 | 141 | final String ymname = dname+File.separator+date.substring(0,7).replace("/", "_"); |
142 | 142 | final String ddname = ymname+File.separator+date.replace("/", "_"); |
143 | - | |
143 | + | |
144 | 144 | File f = new File(ymname); |
145 | 145 | if ( ! f.exists() && ! f.isDirectory()) { |
146 | 146 | System.out.println(MSGID+"年ディレクトがみつかりません: "+f.getAbsolutePath()); |
147 | 147 | return false; |
148 | 148 | } |
149 | - | |
149 | + | |
150 | 150 | File g = new File(ddname); |
151 | 151 | if ( ! g.exists() && ! g.isDirectory()) { |
152 | 152 | System.out.println(MSGID+"月日ディレクトがみつかりません: "+g.getAbsolutePath()); |
@@ -154,12 +154,12 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
154 | 154 | } |
155 | 155 | |
156 | 156 | // 取得開始 |
157 | - | |
157 | + | |
158 | 158 | TatCount tc = new TatCount(); |
159 | - | |
159 | + | |
160 | 160 | // 番組情報を全部破棄 |
161 | 161 | this.cleanup(); |
162 | - | |
162 | + | |
163 | 163 | String[] flist = g.list(); |
164 | 164 | Arrays.sort(flist); |
165 | 165 | ArrayList<String> fxlist = new ArrayList<String>(); |
@@ -170,27 +170,27 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
170 | 170 | if (debug) System.out.println(DBGID+"Invalid file name: "+flist[i]); |
171 | 171 | continue; // ファイル名の書式が合わないものは無視 |
172 | 172 | } |
173 | - | |
173 | + | |
174 | 174 | String base = flist[i].replaceFirst(expr_z, ""); |
175 | 175 | if ( ! fxlist.contains(base) ) |
176 | 176 | { |
177 | 177 | fxlist.add(base); |
178 | 178 | } |
179 | 179 | } |
180 | - | |
180 | + | |
181 | 181 | for ( String fx : fxlist ) { |
182 | - | |
182 | + | |
183 | 183 | Matcher ma = Pattern.compile(expr_a,Pattern.DOTALL).matcher(fx); |
184 | 184 | ma.find(); |
185 | - | |
185 | + | |
186 | 186 | String fcenter = CommonUtils.unEscape(ma.group(3)); |
187 | - | |
187 | + | |
188 | 188 | if ( center != null && ! center.equals(fcenter) ) |
189 | 189 | { |
190 | 190 | if (debug) System.out.println(DBGID+"not selected: "+fx); |
191 | 191 | continue; // 放送局指定がされている場合はその局のみ |
192 | 192 | } |
193 | - | |
193 | + | |
194 | 194 | int order = Integer.valueOf(ma.group(2)); |
195 | 195 | if ( order == 0 ) |
196 | 196 | { |
@@ -208,18 +208,18 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
208 | 208 | cr.setOrder(order); |
209 | 209 | crlist.add(cr); |
210 | 210 | sortedcrlist.add(cr); |
211 | - | |
211 | + | |
212 | 212 | // 番組表局リストの追加 |
213 | 213 | ProgList pl = new ProgList(); |
214 | 214 | pl.Center = fcenter; |
215 | 215 | pl.enabled = true; |
216 | 216 | pcenter.add(pl); |
217 | - | |
217 | + | |
218 | 218 | // 日付リストの追加 |
219 | 219 | ProgDateList pcl = new ProgDateList(); |
220 | 220 | pcl.Date = date; |
221 | 221 | pl.pdate.add(pcl); |
222 | - | |
222 | + | |
223 | 223 | TatCount tx = new TatCount(); |
224 | 224 | if ( new File(txtname).exists() ) { |
225 | 225 | progcount += readTXT(pl.Center,pcl,txtname); |
@@ -257,14 +257,14 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
257 | 257 | |
258 | 258 | return true; |
259 | 259 | } |
260 | - | |
260 | + | |
261 | 261 | private int readTXT(String center, ProgDateList pcl, String txtname) { |
262 | - | |
262 | + | |
263 | 263 | String txt = CommonUtils.read4file(txtname, false); |
264 | 264 | if ( txt == null ) { |
265 | 265 | return -1; |
266 | 266 | } |
267 | - | |
267 | + | |
268 | 268 | int index = 0; |
269 | 269 | while ( index < txt.length() ) |
270 | 270 | { |
@@ -274,30 +274,30 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
274 | 274 | break; |
275 | 275 | } |
276 | 276 | newtop += WrHeader.STARTMARK.toString().length()+1; |
277 | - | |
277 | + | |
278 | 278 | // 番組フッタを探す |
279 | 279 | int newtail = txt.indexOf(WrHeader.ENDMARK.toString(),newtop); |
280 | 280 | if ( newtail == -1 ) { |
281 | 281 | break; |
282 | 282 | } |
283 | 283 | index = newtail+WrHeader.ENDMARK.toString().length()+1; |
284 | - | |
284 | + | |
285 | 285 | // 解析する |
286 | 286 | ProgDetailList pdl = new ProgDetailList(txt.substring(newtop,newtail)); |
287 | - | |
287 | + | |
288 | 288 | // サブタイトル分離 |
289 | 289 | doSplitSubtitle(pdl); |
290 | - | |
290 | + | |
291 | 291 | pcl.pdetail.add(pdl); |
292 | 292 | |
293 | 293 | // 情報を追加 |
294 | 294 | pdl.center = center; |
295 | 295 | pdl.type = this.getType(); |
296 | 296 | } |
297 | - | |
297 | + | |
298 | 298 | return pcl.pdetail.size(); |
299 | 299 | } |
300 | - | |
300 | + | |
301 | 301 | private int readXML(String center, ProgDateList pcl, String date, String xmlname) { |
302 | 302 | try { |
303 | 303 |
@@ -308,7 +308,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
308 | 308 | System.err.println(ERRID+"読み込みに失敗しました: "+xmlname); |
309 | 309 | return -1; |
310 | 310 | } |
311 | - | |
311 | + | |
312 | 312 | GregorianCalendar cal = CommonUtils.getCalendar(date); |
313 | 313 | for ( int j=0; j<da.size(); j++ ) |
314 | 314 | { |
@@ -334,27 +334,27 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
337 | - | |
337 | + | |
338 | 338 | // クソバグ対応(番組詳細のない情報があった) |
339 | 339 | if (data.detail == null) |
340 | 340 | { |
341 | 341 | data.detail=""; |
342 | 342 | } |
343 | - | |
343 | + | |
344 | 344 | // 後方互換(EDCB番組表で追加された追加番組詳細情報への対応) |
345 | 345 | if (data.addedDetail == null) |
346 | 346 | { |
347 | 347 | data.addedDetail = ""; |
348 | 348 | } |
349 | - | |
349 | + | |
350 | 350 | // |
351 | 351 | data.splitted_title = data.title; |
352 | 352 | data.splitted_detail = data.detail; |
353 | - | |
353 | + | |
354 | 354 | // 検索用インデックスを生成 |
355 | 355 | data.titlePop = TraceProgram.replacePop(data.title); |
356 | 356 | data.detailPop = TraceProgram.replacePop(data.detail); |
357 | - | |
357 | + | |
358 | 358 | // 終了時刻・実日付を生成 |
359 | 359 | String[] Ahm = data.start.split(":",2); |
360 | 360 | if ( Ahm.length == 2 ) |
@@ -363,7 +363,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
363 | 363 | GregorianCalendar cale = (GregorianCalendar) cal.clone(); |
364 | 364 | int hh = Integer.valueOf(Ahm[0]); |
365 | 365 | int mm = Integer.valueOf(Ahm[1]); |
366 | - | |
366 | + | |
367 | 367 | if ( j == 0 ) |
368 | 368 | { |
369 | 369 | if ( CommonUtils.isLateNight(hh) ) |
@@ -383,38 +383,38 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
383 | 383 | // 2個目以降で00-05時は翌日だ |
384 | 384 | cale.add(Calendar.DATE, 1); |
385 | 385 | } |
386 | - | |
386 | + | |
387 | 387 | data.accurateDate = CommonUtils.getDate(cale); |
388 | - | |
388 | + | |
389 | 389 | cale.set(Calendar.HOUR_OF_DAY, hh); |
390 | 390 | cale.set(Calendar.MINUTE, mm); |
391 | 391 | data.startDateTime = CommonUtils.getDateTime(cale); |
392 | 392 | data.start = CommonUtils.getTime(cale); |
393 | - | |
393 | + | |
394 | 394 | cale.add(Calendar.MINUTE, prelength+data.length); |
395 | 395 | data.end = CommonUtils.getTime(cale); |
396 | 396 | data.endDateTime = CommonUtils.getDateTime(cale); |
397 | - | |
397 | + | |
398 | 398 | data.recmin = CommonUtils.getRecMinVal(data.start,data.end); |
399 | 399 | } |
400 | - | |
400 | + | |
401 | 401 | pcl.pdetail.add(data); |
402 | 402 | |
403 | 403 | // 情報を追加 |
404 | 404 | data.center = center; |
405 | 405 | data.type = this.getType(); |
406 | 406 | } |
407 | - | |
407 | + | |
408 | 408 | return pcl.pdetail.size(); |
409 | 409 | } |
410 | 410 | catch ( Exception e ) |
411 | 411 | { |
412 | 412 | System.err.println(ERRID+"過去ログの読み込みに失敗しました: "+xmlname); |
413 | 413 | e.printStackTrace(); |
414 | - } | |
414 | + } | |
415 | 415 | return -1; |
416 | 416 | } |
417 | - | |
417 | + | |
418 | 418 | /** |
419 | 419 | * プログラムリストをファイルに保存する |
420 | 420 | * @param tviterator |
@@ -423,11 +423,11 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
423 | 423 | * @return |
424 | 424 | */ |
425 | 425 | public boolean save(TVProgramIterator tviterator, ArrayList<Center> clst, int prepCount) { |
426 | - | |
426 | + | |
427 | 427 | TVProgramIterator pli = tviterator.build(clst, IterationType.ALL); |
428 | - | |
428 | + | |
429 | 429 | String curDate = CommonUtils.getDate529(0,true); |
430 | - | |
430 | + | |
431 | 431 | // 古いログは削除 |
432 | 432 | { |
433 | 433 | ArrayList<String> dirs = new ArrayList<String>(); |
@@ -457,7 +457,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
457 | 457 | } |
458 | 458 | } |
459 | 459 | } |
460 | - | |
460 | + | |
461 | 461 | // 削除 |
462 | 462 | for (String dir : dirs) |
463 | 463 | { |
@@ -475,21 +475,21 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
475 | 475 | } |
476 | 476 | } |
477 | 477 | } |
478 | - | |
478 | + | |
479 | 479 | // 放送局名をキーにプログラムリストをなめる |
480 | 480 | TatCount tc = new TatCount(); |
481 | - | |
481 | + | |
482 | 482 | pli.rewind(); // まきもどせ |
483 | - | |
483 | + | |
484 | 484 | int centerid = 0; |
485 | 485 | for ( ProgList pl : pli ) |
486 | 486 | { |
487 | 487 | ++centerid; |
488 | - | |
488 | + | |
489 | 489 | tc.restart(); |
490 | 490 | String firstD = ""; |
491 | 491 | String lastD = ""; |
492 | - | |
492 | + | |
493 | 493 | int count = 1; |
494 | 494 | for ( ProgDateList cl : pl.pdate ) |
495 | 495 | { |
@@ -497,21 +497,21 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
497 | 497 | { |
498 | 498 | continue; // 過去日のログは不要 |
499 | 499 | } |
500 | - | |
500 | + | |
501 | 501 | if ( count++ > prepCount ) |
502 | 502 | { |
503 | 503 | break; // 指定日数以上は保存しない |
504 | 504 | } |
505 | - | |
505 | + | |
506 | 506 | if ( firstD.length() == 0 ) firstD = cl.Date; |
507 | 507 | lastD = cl.Date; |
508 | - | |
508 | + | |
509 | 509 | // 出力先の決定 |
510 | 510 | String ymname = dname+File.separator+cl.Date.substring(0,7).replace("/", "_"); |
511 | 511 | String ddname = ymname+File.separator+cl.Date.replace("/", "_"); |
512 | 512 | String xmlname = ddname+File.separator+String.format("%d_%04d_%s.xml", 1, centerid, CommonUtils.escapeFilename(pl.Center)); |
513 | 513 | String txtname = ddname+File.separator+String.format("%d_%04d_%s.txt", 1, centerid, CommonUtils.escapeFilename(pl.Center)); |
514 | - | |
514 | + | |
515 | 515 | for ( String xname : new String[] { dname,ymname,ddname } ) |
516 | 516 | { |
517 | 517 | File f = new File(xname); |
@@ -532,13 +532,13 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
532 | 532 | if (debug) System.err.println(String.format(DBGID+"XML形式での保存にかかった時間(%.4f秒): %s->%s %s",tx.end(),firstD,lastD,pl.Center)); |
533 | 533 | } |
534 | 534 | } |
535 | - | |
535 | + | |
536 | 536 | reportProgress(String.format(MSGID+"保存しました(%.2f秒): %s->%s %s",tc.end(),firstD,lastD,pl.Center)); |
537 | 537 | } |
538 | 538 | return true; |
539 | - | |
539 | + | |
540 | 540 | } |
541 | - | |
541 | + | |
542 | 542 | private boolean writeTXT(ProgDateList pcl, String txtname) { |
543 | 543 | StringBuilder sb = new StringBuilder(); |
544 | 544 | for ( ProgDetailList d : pcl.pdetail ) { |
@@ -569,13 +569,13 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
569 | 569 | data.setOption(d.option); |
570 | 570 | da.add(data); |
571 | 571 | } |
572 | - | |
572 | + | |
573 | 573 | // 出力 |
574 | 574 | if ( ! CommonUtils.writeXML(xmlname, da) ) |
575 | 575 | { |
576 | 576 | return false; |
577 | 577 | } |
578 | - | |
578 | + | |
579 | 579 | return true; |
580 | 580 | } |
581 | 581 |
@@ -587,20 +587,20 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
587 | 587 | * ディレクトリ一覧を取得する(日に一回しか検索しない) |
588 | 588 | */ |
589 | 589 | public String[] getDateList(int maxCnt) { |
590 | - | |
590 | + | |
591 | 591 | String getdate = CommonUtils.getDate529(0,true); |
592 | 592 | if ( getdate.compareTo(pregetdate) <= 0 ) |
593 | 593 | { |
594 | 594 | return dd; |
595 | 595 | } |
596 | 596 | pregetdate = getdate; |
597 | - | |
597 | + | |
598 | 598 | System.out.println(MSGID+"フォルダを検索して過去ログをリストアップします. "+getdate); |
599 | - | |
599 | + | |
600 | 600 | // 最初のエントリーはダミー |
601 | 601 | ArrayList<String> da = new ArrayList<String>(); |
602 | 602 | da.add("過去ログ"); |
603 | - | |
603 | + | |
604 | 604 | // 過去日のディレクトリのみが対象 |
605 | 605 | GregorianCalendar cal = CommonUtils.getCalendar(0); |
606 | 606 | if ( CommonUtils.isLateNight(cal) ) |
@@ -608,7 +608,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
608 | 608 | cal.add(Calendar.DAY_OF_MONTH, -1); |
609 | 609 | } |
610 | 610 | String date = String.format("%04d_%02d_%02d", cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH)); |
611 | - | |
611 | + | |
612 | 612 | // トップディレクトリは存在するかな? |
613 | 613 | File d = new File(dname); |
614 | 614 | if ( ! d.exists() && ! d.isDirectory()) |
@@ -616,7 +616,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
616 | 616 | System.out.println(MSGID+"ディレクトリがみつかりません: "+d.getAbsolutePath()); |
617 | 617 | return da.toArray(new String[0]); |
618 | 618 | } |
619 | - | |
619 | + | |
620 | 620 | // 日付降順に処理する |
621 | 621 | int cnt = 0; |
622 | 622 | String[] dlist = d.list(); |
@@ -629,7 +629,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
629 | 629 | { |
630 | 630 | continue; |
631 | 631 | } |
632 | - | |
632 | + | |
633 | 633 | // ディレクトリだよね? |
634 | 634 | final String ddname = d.getName()+File.separator+dlist[j]; |
635 | 635 | File f = new File(ddname); |
@@ -638,7 +638,7 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
638 | 638 | System.out.println(MSGID+"ディレクトリがみつかりません: "+f.getAbsolutePath()); |
639 | 639 | return null; |
640 | 640 | } |
641 | - | |
641 | + | |
642 | 642 | // 日付降順に処理する |
643 | 643 | String[] flist = f.list(); |
644 | 644 | Arrays.sort(flist); |
@@ -661,55 +661,55 @@ public class PassedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
661 | 661 | dd = da.toArray(new String[0]); |
662 | 662 | return dd; |
663 | 663 | } |
664 | - | |
664 | + | |
665 | 665 | /* ここまで */ |
666 | - | |
667 | - | |
668 | - | |
666 | + | |
667 | + | |
668 | + | |
669 | 669 | /* |
670 | 670 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
671 | 671 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここから ★★★★★ |
672 | 672 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
673 | 673 | */ |
674 | - | |
674 | + | |
675 | 675 | /* |
676 | 676 | * 公開メソッド |
677 | 677 | */ |
678 | - | |
678 | + | |
679 | 679 | // |
680 | 680 | @Override |
681 | 681 | public String getDefaultArea() {return "東京";} |
682 | - | |
682 | + | |
683 | 683 | // |
684 | 684 | public void loadAreaCode() {} |
685 | - | |
685 | + | |
686 | 686 | // |
687 | 687 | public void saveAreaCode() {} |
688 | - | |
688 | + | |
689 | 689 | /* |
690 | 690 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
691 | 691 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここまで ★★★★★ |
692 | 692 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
693 | 693 | */ |
694 | - | |
695 | - | |
696 | - | |
694 | + | |
695 | + | |
696 | + | |
697 | 697 | /* |
698 | 698 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
699 | 699 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここから ★★★★★ |
700 | 700 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
701 | 701 | */ |
702 | - | |
702 | + | |
703 | 703 | /* |
704 | 704 | * 公開メソッド |
705 | 705 | */ |
706 | - | |
706 | + | |
707 | 707 | // 設定ファイルがなければWebから取得 |
708 | 708 | public void loadCenter(String code, boolean force) {} |
709 | - | |
709 | + | |
710 | 710 | // 設定ファイルへ書き出し |
711 | 711 | public boolean saveCenter() { return false; } |
712 | - | |
712 | + | |
713 | 713 | /* |
714 | 714 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
715 | 715 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここまで ★★★★★ |
@@ -12,33 +12,33 @@ import java.util.GregorianCalendar; | ||
12 | 12 | public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable { |
13 | 13 | |
14 | 14 | //private static final String thisEncoding = "UTF-8"; |
15 | - | |
15 | + | |
16 | 16 | public void setDebug(boolean b) { debug = b; } |
17 | 17 | private static boolean debug = false; |
18 | - | |
18 | + | |
19 | 19 | /* 必須コード - ここから */ |
20 | - | |
20 | + | |
21 | 21 | /******************************************************************************* |
22 | 22 | * 種族の特性 |
23 | 23 | ******************************************************************************/ |
24 | - | |
24 | + | |
25 | 25 | @Override |
26 | 26 | public String getTVProgramId() { return tvProgId; } |
27 | 27 | private static final String tvProgId = "PickedProgram"; |
28 | - | |
28 | + | |
29 | 29 | @Override |
30 | 30 | public boolean isAreaSelectSupported() { return false; } |
31 | - | |
31 | + | |
32 | 32 | @Override |
33 | 33 | public ProgType getType() { return ProgType.PICKED; } |
34 | 34 | @Override |
35 | 35 | public ProgSubtype getSubtype() { return ProgSubtype.NONE; } |
36 | - | |
36 | + | |
37 | 37 | @Override |
38 | 38 | public PickedProgram clone() { |
39 | 39 | return (PickedProgram) super.clone(); |
40 | 40 | } |
41 | - | |
41 | + | |
42 | 42 | /******************************************************************************* |
43 | 43 | * 個体の特性 |
44 | 44 | ******************************************************************************/ |
@@ -49,85 +49,85 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
49 | 49 | /******************************************************************************* |
50 | 50 | * 定数 |
51 | 51 | ******************************************************************************/ |
52 | - | |
52 | + | |
53 | 53 | public static enum WrHeader { |
54 | - | |
54 | + | |
55 | 55 | // 順番をかえなければ、どこに追加してもいい |
56 | - | |
56 | + | |
57 | 57 | CENTER ( "$CH$", true ), |
58 | 58 | DATE ( "$DT$", true ), |
59 | - | |
59 | + | |
60 | 60 | // ここから下は別の領域なので追加はNG |
61 | - | |
61 | + | |
62 | 62 | BEND ( "$PI#YY$", false ), // 項目ごとのフッタ |
63 | 63 | STARTMARK ( "$PI#AA$", false ), // ヘッダ |
64 | 64 | ENDMARK ( "$PI#ZZ$", false ), // フッタ |
65 | - | |
65 | + | |
66 | 66 | ; |
67 | - | |
67 | + | |
68 | 68 | private String hdr; |
69 | 69 | private boolean marker; |
70 | - | |
70 | + | |
71 | 71 | private WrHeader(String hdr, boolean marker) { |
72 | 72 | this.hdr = hdr; |
73 | 73 | this.marker = marker; |
74 | 74 | } |
75 | - | |
75 | + | |
76 | 76 | // ここはtoString()をOverrideしてよい |
77 | 77 | @Override |
78 | 78 | public String toString() { return hdr; } |
79 | 79 | } |
80 | - | |
80 | + | |
81 | 81 | // 区切り文字 |
82 | 82 | private static final String S_CR = "\n"; |
83 | - | |
83 | + | |
84 | 84 | private final static String txtname = "env"+File.separator+"picked.txt"; |
85 | - | |
85 | + | |
86 | 86 | private static final String MSGID = "[ピックアップ] "; |
87 | 87 | private static final String DBGID = "[DEBUG]"+MSGID; |
88 | 88 | private static final String ERRID = "[ERROR]"+MSGID; |
89 | - | |
89 | + | |
90 | 90 | /******************************************************************************* |
91 | 91 | * 部品 |
92 | 92 | ******************************************************************************/ |
93 | - | |
93 | + | |
94 | 94 | /******************************************************************************* |
95 | 95 | * 本体 |
96 | 96 | ******************************************************************************/ |
97 | - | |
97 | + | |
98 | 98 | @Override |
99 | - public void loadProgram(String areaCode, boolean force) { | |
100 | - | |
99 | + public boolean loadProgram(String areaCode, boolean force) { | |
100 | + | |
101 | 101 | // |
102 | 102 | if ( ! new File(txtname).exists() ) { |
103 | 103 | System.out.println(MSGID+"ピックアップリストのファイルがありませんでした: "+txtname); |
104 | - return; | |
104 | + return true; | |
105 | 105 | } |
106 | - | |
106 | + | |
107 | 107 | // 番組リストの追加 |
108 | 108 | int cnt = load(); |
109 | 109 | System.out.println(MSGID+"ピックアップリストを取得しました: "+cnt); |
110 | - | |
110 | + return true; | |
111 | 111 | } |
112 | - | |
113 | - | |
114 | - | |
115 | - | |
112 | + | |
113 | + | |
114 | + | |
115 | + | |
116 | 116 | // 内部的な |
117 | - | |
117 | + | |
118 | 118 | /* |
119 | 119 | * プログラムリストをファイルに保存する |
120 | 120 | */ |
121 | 121 | public boolean save() { |
122 | - | |
122 | + | |
123 | 123 | StringBuilder sb = new StringBuilder(); |
124 | - | |
124 | + | |
125 | 125 | for (ProgList pl : pcenter) { |
126 | 126 | for (ProgDateList cl : pl.pdate) { |
127 | 127 | if ( cl.pdetail.size() == 0 ) { |
128 | 128 | continue; |
129 | 129 | } |
130 | - | |
130 | + | |
131 | 131 | sb.append(WrHeader.STARTMARK); |
132 | 132 | sb.append(S_CR); |
133 | 133 | sb.append(WrHeader.CENTER); |
@@ -136,7 +136,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
136 | 136 | sb.append(WrHeader.DATE); |
137 | 137 | sb.append(cl.Date); |
138 | 138 | sb.append(WrHeader.BEND); |
139 | - | |
139 | + | |
140 | 140 | // 詳細をコピーする |
141 | 141 | for (ProgDetailList d : cl.pdetail) { |
142 | 142 | sb.append(d.toString()); |
@@ -146,18 +146,18 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
146 | 146 | sb.append(S_CR); |
147 | 147 | } |
148 | 148 | } |
149 | - | |
149 | + | |
150 | 150 | // 出力 |
151 | 151 | if ( ! CommonUtils.write2file(txtname, sb.toString()) ) { |
152 | 152 | System.err.println(ERRID+"保存に失敗しました: "+txtname); |
153 | 153 | return false; |
154 | 154 | } |
155 | - | |
155 | + | |
156 | 156 | return true; |
157 | 157 | } |
158 | - | |
158 | + | |
159 | 159 | private int load() { |
160 | - | |
160 | + | |
161 | 161 | String txt = CommonUtils.read4file(txtname, false); |
162 | 162 | if ( txt == null ) { |
163 | 163 | return -1; |
@@ -166,7 +166,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
166 | 166 | ArrayList<ProgList> newplist = new ArrayList<ProgList>(); |
167 | 167 | |
168 | 168 | int cnt = 0; |
169 | - | |
169 | + | |
170 | 170 | while ( txt.length() > 0 ) |
171 | 171 | { |
172 | 172 | if ( ! txt.startsWith(WrHeader.STARTMARK.toString()+S_CR) ) { |
@@ -176,24 +176,24 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
176 | 176 | if ( newtail == -1 ) { |
177 | 177 | break; |
178 | 178 | } |
179 | - | |
179 | + | |
180 | 180 | // 今回の情報 |
181 | 181 | String data = txt.substring(WrHeader.STARTMARK.toString().length()+1, newtail+1); |
182 | - | |
182 | + | |
183 | 183 | // 次回に続く |
184 | 184 | txt = txt.substring(newtail+WrHeader.STARTMARK.toString().length()+1); |
185 | - | |
185 | + | |
186 | 186 | // 放送局名 |
187 | 187 | String center = null; |
188 | - | |
188 | + | |
189 | 189 | { |
190 | 190 | int btail = 0; |
191 | - | |
191 | + | |
192 | 192 | if ( ! data.startsWith(WrHeader.CENTER.toString()) ) { |
193 | 193 | break; |
194 | 194 | } |
195 | 195 | data = data.substring(WrHeader.CENTER.toString().length()); |
196 | - | |
196 | + | |
197 | 197 | btail = data.indexOf(WrHeader.BEND.toString()); |
198 | 198 | if ( btail == -1 ) { |
199 | 199 | break; |
@@ -204,15 +204,15 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
204 | 204 | |
205 | 205 | // 日付 |
206 | 206 | String date =null; |
207 | - | |
207 | + | |
208 | 208 | { |
209 | 209 | int btail = 0; |
210 | - | |
210 | + | |
211 | 211 | if ( ! data.startsWith(WrHeader.DATE.toString()) ) { |
212 | 212 | break; |
213 | 213 | } |
214 | 214 | data = data.substring(WrHeader.DATE.toString().length()); |
215 | - | |
215 | + | |
216 | 216 | btail = data.indexOf(WrHeader.BEND.toString()); |
217 | 217 | if ( btail == -1 ) { |
218 | 218 | break; |
@@ -222,7 +222,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
222 | 222 | } |
223 | 223 | |
224 | 224 | // 番組詳細へ |
225 | - | |
225 | + | |
226 | 226 | // 解析する |
227 | 227 | ProgList pcenter = null; |
228 | 228 | for ( ProgList p : newplist ) { |
@@ -237,7 +237,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
237 | 237 | pcenter.pdate = new ArrayList<ProgDateList>(); |
238 | 238 | newplist.add(pcenter); |
239 | 239 | } |
240 | - | |
240 | + | |
241 | 241 | ProgDateList pdate = null; |
242 | 242 | for ( ProgDateList p : pcenter.pdate ) { |
243 | 243 | if ( p.Date.equals(date) ) { |
@@ -251,15 +251,15 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
251 | 251 | pdate.pdetail = new ArrayList<ProgDetailList>(); |
252 | 252 | pcenter.pdate.add(pdate); |
253 | 253 | } |
254 | - | |
254 | + | |
255 | 255 | cnt += loadDetail(pdate.pdetail,data); |
256 | 256 | } |
257 | - | |
257 | + | |
258 | 258 | pcenter = newplist; |
259 | - | |
259 | + | |
260 | 260 | return cnt; |
261 | 261 | } |
262 | - | |
262 | + | |
263 | 263 | private int loadDetail(ArrayList<ProgDetailList> pdetail, String txt) { |
264 | 264 | int index = 0; |
265 | 265 | while ( index < txt.length() ) |
@@ -270,33 +270,33 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
270 | 270 | break; |
271 | 271 | } |
272 | 272 | newtop += ProgDetailList.WrHeader.STARTMARK.toString().length()+1; |
273 | - | |
273 | + | |
274 | 274 | // 番組フッタを探す |
275 | 275 | int newtail = txt.indexOf(ProgDetailList.WrHeader.ENDMARK.toString(),newtop); |
276 | 276 | if ( newtail == -1 ) { |
277 | 277 | break; |
278 | 278 | } |
279 | 279 | index = newtail+ProgDetailList.WrHeader.ENDMARK.toString().length()+1; |
280 | - | |
280 | + | |
281 | 281 | // 解析する |
282 | 282 | ProgDetailList pdl = new ProgDetailList(txt.substring(newtop,newtail)); |
283 | 283 | pdetail.add(pdl); |
284 | 284 | |
285 | 285 | } |
286 | - | |
286 | + | |
287 | 287 | return pdetail.size(); |
288 | 288 | } |
289 | 289 | |
290 | 290 | /* |
291 | - * 日付でリフレッシュ | |
291 | + * 日付でリフレッシュ | |
292 | 292 | */ |
293 | 293 | public void refresh() { |
294 | - | |
294 | + | |
295 | 295 | GregorianCalendar cs = CommonUtils.getCalendar(0); |
296 | 296 | if (CommonUtils.isLateNight(cs.get(Calendar.HOUR_OF_DAY))) { |
297 | 297 | cs.add(Calendar.DATE, -1); |
298 | 298 | } |
299 | - | |
299 | + | |
300 | 300 | ArrayList<ProgList> tPlist = new ArrayList<ProgList>(); |
301 | 301 | for (ProgList tPl : pcenter) { |
302 | 302 | GregorianCalendar c = (GregorianCalendar)cs.clone(); |
@@ -322,7 +322,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
322 | 322 | } |
323 | 323 | tPlist.add(pl); |
324 | 324 | } |
325 | - | |
325 | + | |
326 | 326 | pcenter = tPlist; |
327 | 327 | } |
328 | 328 |
@@ -330,7 +330,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
330 | 330 | * 追加しよう |
331 | 331 | */ |
332 | 332 | public boolean add(ProgDetailList tvd) { |
333 | - | |
333 | + | |
334 | 334 | ProgList pl = null; |
335 | 335 | for (ProgList tPl : pcenter) { |
336 | 336 | if (tPl.Center.equals(tvd.center)) { |
@@ -360,7 +360,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
360 | 360 | } |
361 | 361 | pcenter.add(pl); |
362 | 362 | } |
363 | - | |
363 | + | |
364 | 364 | ProgDateList pcl = null; |
365 | 365 | for (ProgDateList tPcl : pl.pdate) { |
366 | 366 | if (tPcl.Date.equals(tvd.accurateDate)) { |
@@ -378,19 +378,19 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
378 | 378 | return false; |
379 | 379 | } |
380 | 380 | } |
381 | - | |
381 | + | |
382 | 382 | // clone()する必要はあるのか? |
383 | 383 | pcl.pdetail.add(tvd); |
384 | - | |
384 | + | |
385 | 385 | return true; |
386 | 386 | } |
387 | 387 | |
388 | - | |
388 | + | |
389 | 389 | /* |
390 | 390 | * 削除しよう |
391 | 391 | */ |
392 | 392 | public boolean remove(ProgDetailList data, String center, String date, boolean force) { |
393 | - | |
393 | + | |
394 | 394 | ProgList pl = null; |
395 | 395 | for (ProgList tPl : pcenter) { |
396 | 396 | if (tPl.Center.equals(center)) { |
@@ -402,7 +402,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
402 | 402 | // なんかおかしくねー |
403 | 403 | return false; |
404 | 404 | } |
405 | - | |
405 | + | |
406 | 406 | ProgDateList pcl = null; |
407 | 407 | for (ProgDateList tPcl : pl.pdate) { |
408 | 408 | if (tPcl.Date.equals(date)) { |
@@ -414,7 +414,7 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
414 | 414 | // 過去ログとかね… |
415 | 415 | return false; |
416 | 416 | } |
417 | - | |
417 | + | |
418 | 418 | for (ProgDetailList tPdl : pcl.pdetail) { |
419 | 419 | if (tPdl.title.equals(data.title) && tPdl.start.equals(data.start) && tPdl.end.equals(data.end)) { |
420 | 420 | if (force) { |
@@ -425,22 +425,22 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
425 | 425 | } |
426 | 426 | return false; |
427 | 427 | } |
428 | - | |
428 | + | |
429 | 429 | /** |
430 | 430 | * 指定した番組情報に対応するピックアップ情報を返す |
431 | 431 | */ |
432 | 432 | public ProgDetailList find(ProgDetailList srctvd) { |
433 | - | |
433 | + | |
434 | 434 | for ( ProgList tvpl : pcenter ) { |
435 | 435 | if ( ! tvpl.Center.equals(srctvd.center) ) { |
436 | 436 | continue; |
437 | 437 | } |
438 | - | |
438 | + | |
439 | 439 | for ( ProgDateList tvc : tvpl.pdate ) { |
440 | 440 | if ( ! tvc.Date.equals(srctvd.accurateDate) ) { |
441 | 441 | continue; |
442 | 442 | } |
443 | - | |
443 | + | |
444 | 444 | for ( ProgDetailList tvd : tvc.pdetail ) { |
445 | 445 | if ( tvd.startDateTime.equals(srctvd.startDateTime) && tvd.endDateTime.equals(srctvd.endDateTime) ) { |
446 | 446 | return tvd; |
@@ -450,55 +450,55 @@ public class PickedProgram extends TVProgramUtils implements TVProgram,Cloneable | ||
450 | 450 | } |
451 | 451 | return null; |
452 | 452 | } |
453 | - | |
453 | + | |
454 | 454 | /* ここまで */ |
455 | - | |
456 | - | |
457 | - | |
455 | + | |
456 | + | |
457 | + | |
458 | 458 | /* |
459 | 459 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
460 | 460 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここから ★★★★★ |
461 | 461 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
462 | 462 | */ |
463 | - | |
463 | + | |
464 | 464 | /* |
465 | 465 | * 公開メソッド |
466 | 466 | */ |
467 | - | |
467 | + | |
468 | 468 | // |
469 | 469 | @Override |
470 | 470 | public String getDefaultArea() {return "東京";} |
471 | - | |
471 | + | |
472 | 472 | // |
473 | 473 | public void loadAreaCode() {} |
474 | - | |
474 | + | |
475 | 475 | // |
476 | 476 | public void saveAreaCode() {} |
477 | - | |
477 | + | |
478 | 478 | /* |
479 | 479 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
480 | 480 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここまで ★★★★★ |
481 | 481 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
482 | 482 | */ |
483 | - | |
484 | - | |
485 | - | |
483 | + | |
484 | + | |
485 | + | |
486 | 486 | /* |
487 | 487 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
488 | 488 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここから ★★★★★ |
489 | 489 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
490 | 490 | */ |
491 | - | |
491 | + | |
492 | 492 | /* |
493 | 493 | * 公開メソッド |
494 | 494 | */ |
495 | - | |
495 | + | |
496 | 496 | // 設定ファイルがなければWebから取得 |
497 | 497 | public void loadCenter(String code, boolean force) {} |
498 | - | |
498 | + | |
499 | 499 | // 設定ファイルへ書き出し |
500 | 500 | public boolean saveCenter() { return false; } |
501 | - | |
501 | + | |
502 | 502 | /* |
503 | 503 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
504 | 504 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここまで ★★★★★ |
@@ -11,104 +11,105 @@ public class SearchResult extends TVProgramUtils implements TVProgram,Cloneable | ||
11 | 11 | /******************************************************************************* |
12 | 12 | * 種族の特性 |
13 | 13 | ******************************************************************************/ |
14 | - | |
14 | + | |
15 | 15 | @Override |
16 | 16 | public String getTVProgramId() { return tvProgId; } |
17 | 17 | private static final String tvProgId = "SearchResult"; |
18 | - | |
18 | + | |
19 | 19 | @Override |
20 | 20 | public boolean isAreaSelectSupported() { return false; } |
21 | - | |
21 | + | |
22 | 22 | @Override |
23 | 23 | public ProgType getType() { return ProgType.SEARCHED; } |
24 | - | |
24 | + | |
25 | 25 | @Override |
26 | 26 | public ProgSubtype getSubtype() { return ProgSubtype.NONE; } |
27 | - | |
27 | + | |
28 | 28 | public PassedProgram clone() { |
29 | 29 | return (PassedProgram) super.clone(); |
30 | 30 | } |
31 | - | |
32 | - | |
31 | + | |
32 | + | |
33 | 33 | /******************************************************************************* |
34 | 34 | * 個体の特性 |
35 | 35 | ******************************************************************************/ |
36 | - | |
36 | + | |
37 | 37 | @Override |
38 | 38 | public int getTimeBarStart() { return 5; } |
39 | - | |
39 | + | |
40 | 40 | // 検索結果を何件保存するか |
41 | 41 | public void setResultBufferMax(int n) { resultBufferMax = n; } |
42 | 42 | private int resultBufferMax = 5; |
43 | - | |
44 | - | |
43 | + | |
44 | + | |
45 | 45 | /******************************************************************************* |
46 | 46 | * 定数 |
47 | 47 | ******************************************************************************/ |
48 | - | |
49 | - | |
48 | + | |
49 | + | |
50 | 50 | /******************************************************************************* |
51 | 51 | * コンストラクタ |
52 | 52 | ******************************************************************************/ |
53 | - | |
53 | + | |
54 | 54 | public SearchResult() { |
55 | - | |
55 | + | |
56 | 56 | super(); |
57 | - | |
57 | + | |
58 | 58 | // ガワ |
59 | 59 | crlist = new ArrayList<Center>(); // 番組情報を全部破棄 |
60 | 60 | sortedcrlist = new ArrayList<Center>(); // 番組情報を全部破棄 |
61 | 61 | pcenter = new ArrayList<ProgList>(); // 番組情報を全部破棄 |
62 | - | |
62 | + | |
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | 66 | /******************************************************************************* |
67 | 67 | * 検索結果固有 |
68 | 68 | ******************************************************************************/ |
69 | - | |
69 | + | |
70 | 70 | public ArrayList<ProgDetailList> getResultBuffer(final String label) { |
71 | - | |
71 | + | |
72 | 72 | // 履歴保存先を指定サイズまで縮小 |
73 | 73 | for ( int i=pcenter.size(); i>=resultBufferMax && i>1; i-- ) { |
74 | 74 | crlist.remove(i-1); |
75 | 75 | pcenter.remove(i-1); |
76 | 76 | } |
77 | - | |
77 | + | |
78 | 78 | // 追加 |
79 | 79 | { |
80 | 80 | Center srchcr = new Center(); |
81 | 81 | srchcr.setCenter(label); |
82 | - | |
82 | + | |
83 | 83 | ProgList srchpl = new ProgList(); |
84 | 84 | srchpl.enabled = true; |
85 | 85 | srchpl.Center = srchcr.getCenter(); |
86 | 86 | srchpl.pdate = new ArrayList<ProgDateList>(); |
87 | - | |
87 | + | |
88 | 88 | ProgDateList srchpdt = new ProgDateList(); |
89 | 89 | srchpdt.Date = CommonUtils.getDateTime(CommonUtils.getCalendar("2999/12/31 23:59")); |
90 | 90 | srchpl.pdate.add(srchpdt); |
91 | - | |
91 | + | |
92 | 92 | crlist.add(0,srchcr); |
93 | 93 | //sortedcrlist.add(srchcr); |
94 | 94 | pcenter.add(0,srchpl); |
95 | 95 | } |
96 | - | |
96 | + | |
97 | 97 | return pcenter.get(0).pdate.get(0).pdetail; |
98 | 98 | } |
99 | 99 | |
100 | 100 | public int getResultBufferSize() { return pcenter.size(); } |
101 | - | |
101 | + | |
102 | 102 | public String getLabel(int index) { return pcenter.get(index).Center; } |
103 | - | |
103 | + | |
104 | 104 | public ArrayList<ProgDetailList> getResult(int index) { return pcenter.get(index).pdate.get(0).pdetail; } |
105 | - | |
105 | + | |
106 | 106 | /******************************************************************************* |
107 | 107 | * 本体 |
108 | 108 | ******************************************************************************/ |
109 | - | |
109 | + | |
110 | 110 | @Override |
111 | - public void loadProgram(String areaCode, boolean force) { | |
111 | + public boolean loadProgram(String areaCode, boolean force) { | |
112 | + return true; | |
112 | 113 | } |
113 | 114 | |
114 | 115 | @Override |
@@ -1,9 +1,9 @@ | ||
1 | 1 | package tainavi; |
2 | 2 | |
3 | 3 | public interface StatusWindow { |
4 | - | |
4 | + | |
5 | 5 | public void clear(); |
6 | - | |
6 | + | |
7 | 7 | /** |
8 | 8 | * 基本形 |
9 | 9 | * @see #appendMessage(String) |
@@ -12,6 +12,10 @@ public interface StatusWindow { | ||
12 | 12 | public void append(String message); |
13 | 13 | public void appendMessage(String message); |
14 | 14 | public void appendError(String message); |
15 | - | |
15 | + | |
16 | 16 | public void setVisible(boolean b); |
17 | + | |
18 | + public void setWindowCloseRequested(boolean b); | |
19 | + public boolean isWindowCloseRequested(); | |
20 | + public void resetWindowCloseRequested(); | |
17 | 21 | } |
@@ -21,15 +21,15 @@ public interface TVProgram { | ||
21 | 21 | */ |
22 | 22 | public enum ProgOption { HIDDEN_NEW, HIDDEN_LAST, HIDDEN_NOSCRUMBLE, FIRST, REPEAT, LIVE, SPECIAL, NOSYOBO, SUBTITLE, BILINGUAL, STANDIN, PV, MULTIVOICE, DATA, SURROUND, NEWARRIVAL, MODIFIED, NONREPEATED, MOVED, PRECEDING, RATING }; |
23 | 23 | |
24 | - public static enum ProgGenre { | |
24 | + public static enum ProgGenre { | |
25 | 25 | NEWS ("ニュース/報道", "0"), |
26 | 26 | SPORTS ("スポーツ", "1"), |
27 | 27 | VARIETYSHOW ("情報/ワイドショー", "2"), |
28 | - DORAMA ("ドラマ", "3"), | |
28 | + DORAMA ("ドラマ", "3"), | |
29 | 29 | MUSIC ("音楽", "4"), |
30 | 30 | VARIETY ("バラエティー", "5"), |
31 | - MOVIE ("映画", "6"), | |
32 | - ANIME ("アニメ/特撮", "7"), | |
31 | + MOVIE ("映画", "6"), | |
32 | + ANIME ("アニメ/特撮", "7"), | |
33 | 33 | DOCUMENTARY ("ドキュメンタリー/教養", "8"), |
34 | 34 | THEATER ("劇場/公演", "9"), |
35 | 35 | HOBBY ("趣味/教育", "A"), |
@@ -37,24 +37,24 @@ public interface TVProgram { | ||
37 | 37 | //KIDS ("キッズ", "ZZZ"), // もとからなかったらしい |
38 | 38 | //EXTENTION ("拡張", "E"), // 非対応とする |
39 | 39 | NOGENRE ("その他", "F"); |
40 | - | |
40 | + | |
41 | 41 | private String name; |
42 | 42 | private String iepg; |
43 | - | |
43 | + | |
44 | 44 | private ProgGenre(String name, String iepg) { |
45 | 45 | this.name = name; |
46 | 46 | this.iepg = iepg; |
47 | 47 | } |
48 | - | |
48 | + | |
49 | 49 | @Override |
50 | 50 | public String toString() { |
51 | 51 | return(name); |
52 | 52 | } |
53 | - | |
53 | + | |
54 | 54 | public String toIEPG() { |
55 | 55 | return(iepg); |
56 | 56 | } |
57 | - | |
57 | + | |
58 | 58 | /** |
59 | 59 | * ジャンル名文字列に一致するものを返す |
60 | 60 | */ |
@@ -66,7 +66,7 @@ public interface TVProgram { | ||
66 | 66 | } |
67 | 67 | return null; |
68 | 68 | } |
69 | - | |
69 | + | |
70 | 70 | /** |
71 | 71 | * IEPGで |
72 | 72 | */ |
@@ -79,7 +79,7 @@ public interface TVProgram { | ||
79 | 79 | return null; |
80 | 80 | } |
81 | 81 | }; |
82 | - | |
82 | + | |
83 | 83 | public static enum ProgSubgenre { |
84 | 84 | NEWS_TEIJI (ProgGenre.NEWS, "定時・総合", "0"), |
85 | 85 | NEWS_TENKI (ProgGenre.NEWS, "天気", "1"), |
@@ -93,7 +93,7 @@ public interface TVProgram { | ||
93 | 93 | NEWS_LOCAL (ProgGenre.NEWS, "ローカル・地域", "9"), |
94 | 94 | NEWS_KOTSU (ProgGenre.NEWS, "交通", "A"), |
95 | 95 | NEWS_ETC (ProgGenre.NEWS, "その他", "F"), |
96 | - | |
96 | + | |
97 | 97 | SPORTS_NEWS (ProgGenre.SPORTS, "スポーツニュース", "0"), |
98 | 98 | SPORTS_BASEBALL (ProgGenre.SPORTS, "野球", "1"), |
99 | 99 | SPORTS_FOOTBALL (ProgGenre.SPORTS, "サッカー", "2"), |
@@ -106,7 +106,7 @@ public interface TVProgram { | ||
106 | 106 | SPORTS_MARINE (ProgGenre.SPORTS, "マリン・ウィンタースポーツ","9"), |
107 | 107 | SPORTS_KEIBA (ProgGenre.SPORTS, "競馬・公営競技", "A"), |
108 | 108 | SPORTS_ETC (ProgGenre.SPORTS, "その他", "F"), |
109 | - | |
109 | + | |
110 | 110 | VSHOW_GEINO (ProgGenre.VARIETYSHOW, "芸能・ワイドショー", "0"), |
111 | 111 | VSHOW_FASHION (ProgGenre.VARIETYSHOW, "ファッション", "1"), |
112 | 112 | VSHOW_LIFE (ProgGenre.VARIETYSHOW, "暮らし・住まい", "2"), |
@@ -116,12 +116,12 @@ public interface TVProgram { | ||
116 | 116 | VSHOW_EVENT (ProgGenre.VARIETYSHOW, "イベント", "6"), |
117 | 117 | VSHOW_INFO (ProgGenre.VARIETYSHOW, "番組紹介・お知らせ", "7"), |
118 | 118 | VSHOW_ETC (ProgGenre.VARIETYSHOW, "その他", "F"), |
119 | - | |
119 | + | |
120 | 120 | DRAMA_KOKUNAI (ProgGenre.DORAMA, "国内ドラマ", "0"), |
121 | 121 | DRAMA_KAIGAI (ProgGenre.DORAMA, "海外ドラマ", "1"), |
122 | 122 | DRAMA_JIDAI (ProgGenre.DORAMA, "時代劇", "2"), |
123 | 123 | DRAMA_ETC (ProgGenre.DORAMA, "その他", "F"), |
124 | - | |
124 | + | |
125 | 125 | MUSIC_KOKUNAI (ProgGenre.MUSIC, "国内ロック・ポップス", "0"), |
126 | 126 | MUSIC_KAIGAI (ProgGenre.MUSIC, "海外ロック・ポップス", "1"), |
127 | 127 | MUSIC_CLASSIC (ProgGenre.MUSIC, "クラシック・オペラ", "2"), |
@@ -134,7 +134,7 @@ public interface TVProgram { | ||
134 | 134 | MUSIC_DOYO (ProgGenre.MUSIC, "童謡・キッズ", "9"), |
135 | 135 | MUSIC_MINZOKU (ProgGenre.MUSIC, "民族音楽・ワールドミュージック", "A"), |
136 | 136 | MUSIC_ETC (ProgGenre.MUSIC, "その他", "F"), |
137 | - | |
137 | + | |
138 | 138 | VARIETY_QUIZ (ProgGenre.VARIETY, "クイズ", "0"), |
139 | 139 | VARIETY_GAME (ProgGenre.VARIETY, "ゲーム", "1"), |
140 | 140 | VARIETY_TALK (ProgGenre.VARIETY, "トークバラエティ", "2"), |
@@ -143,17 +143,17 @@ public interface TVProgram { | ||
143 | 143 | VARIETY_TABI (ProgGenre.VARIETY, "旅バラエティ", "5"), |
144 | 144 | VARIETY_RYORI (ProgGenre.VARIETY, "料理バラエティ", "6"), |
145 | 145 | VARIETY_ETC (ProgGenre.VARIETY, "その他", "F"), |
146 | - | |
146 | + | |
147 | 147 | MOVIE_YOGA (ProgGenre.MOVIE, "洋画", "0"), |
148 | 148 | MOVIE_HOGA (ProgGenre.MOVIE, "邦画", "1"), |
149 | 149 | MOVIE_ANIME (ProgGenre.MOVIE, "アニメ", "2"), |
150 | 150 | MOVIE_ETC (ProgGenre.MOVIE, "その他", "F"), |
151 | - | |
151 | + | |
152 | 152 | ANIME_KOKUNAI (ProgGenre.ANIME, "国内アニメ", "0"), |
153 | 153 | ANIME_KAIGAI (ProgGenre.ANIME, "海外アニメ", "1"), |
154 | 154 | ANIME_TOKUSATSU (ProgGenre.ANIME, "特撮", "2"), |
155 | 155 | ANIME_ETC (ProgGenre.ANIME, "その他", "F"), |
156 | - | |
156 | + | |
157 | 157 | DOC_SOCIAL (ProgGenre.DOCUMENTARY, "社会・時事", "0"), |
158 | 158 | DOC_HISTORY (ProgGenre.DOCUMENTARY, "歴史・紀行", "1"), |
159 | 159 | DOC_NATURE (ProgGenre.DOCUMENTARY, "自然・動物・環境", "2"), |
@@ -164,14 +164,14 @@ public interface TVProgram { | ||
164 | 164 | DOC_DOCUMENTARY (ProgGenre.DOCUMENTARY, "ドキュメンタリー全般", "7"), |
165 | 165 | DOC_INTERVIEW (ProgGenre.DOCUMENTARY, "インタビュー・討論", "8"), |
166 | 166 | DOC_ETC (ProgGenre.DOCUMENTARY, "その他", "F"), |
167 | - | |
167 | + | |
168 | 168 | THEATER_GENDAI (ProgGenre.THEATER, "現代劇・新劇", "0"), |
169 | 169 | THEATER_MUSICAL (ProgGenre.THEATER, "ミュージカル", "1"), |
170 | 170 | THEATER_DANCE (ProgGenre.THEATER, "ダンス・バレエ", "2"), |
171 | 171 | THEATER_RAKUGO (ProgGenre.THEATER, "落語・演芸", "3"), |
172 | 172 | THEATER_KABUKI (ProgGenre.THEATER, "歌舞伎・古典", "4"), |
173 | 173 | THEATER_ETC (ProgGenre.THEATER, "その他", "F"), |
174 | - | |
174 | + | |
175 | 175 | HOBBY_TABI (ProgGenre.HOBBY, "旅・釣り・アウトドア", "0"), |
176 | 176 | HOBBY_ENGEI (ProgGenre.HOBBY, "園芸・ペット・手芸", "1"), |
177 | 177 | HOBBY_MUSIC (ProgGenre.HOBBY, "音楽・美術・工芸", "2"), |
@@ -186,7 +186,7 @@ public interface TVProgram { | ||
186 | 186 | HOBBY_SHOGAI (ProgGenre.HOBBY, "生涯教育・資格", "B"), |
187 | 187 | HOBBY_KYOIKU (ProgGenre.HOBBY, "教育問題", "C"), |
188 | 188 | HOBBY_ETC (ProgGenre.HOBBY, "その他", "F"), |
189 | - | |
189 | + | |
190 | 190 | WELFARE_KOUREI (ProgGenre.WELFARE, "高齢者", "0"), |
191 | 191 | WELFARE_SHOGAI (ProgGenre.WELFARE, "障害者", "1"), |
192 | 192 | WELFARE_HUKUSHI (ProgGenre.WELFARE, "社会福祉", "2"), |
@@ -195,38 +195,38 @@ public interface TVProgram { | ||
195 | 195 | WELFARE_MOJI (ProgGenre.WELFARE, "文字(字幕)", "5"), |
196 | 196 | WELFARE_ONSEI (ProgGenre.WELFARE, "音声解説", "6"), |
197 | 197 | WELFARE_ETC (ProgGenre.WELFARE, "その他", "F"), |
198 | - | |
198 | + | |
199 | 199 | NOGENRE_ETC (ProgGenre.NOGENRE, "その他", "F"), |
200 | - | |
200 | + | |
201 | 201 | ; |
202 | - | |
202 | + | |
203 | 203 | private ProgGenre genre; |
204 | 204 | private String name; |
205 | 205 | private String iepg; |
206 | - | |
206 | + | |
207 | 207 | private ProgSubgenre(ProgGenre genre, String name, String iepg) { |
208 | 208 | this.genre = genre; |
209 | 209 | this.name = name; |
210 | 210 | this.iepg = iepg; |
211 | 211 | } |
212 | - | |
212 | + | |
213 | 213 | @Override |
214 | 214 | public String toString() { |
215 | 215 | return(name); |
216 | 216 | } |
217 | - | |
217 | + | |
218 | 218 | public String toFullString() { |
219 | 219 | return genre.toString()+" - "+name; |
220 | 220 | } |
221 | - | |
221 | + | |
222 | 222 | public String toIEPG() { |
223 | 223 | return(iepg); |
224 | 224 | } |
225 | - | |
225 | + | |
226 | 226 | public ProgGenre getGenre() { |
227 | 227 | return(genre); |
228 | 228 | } |
229 | - | |
229 | + | |
230 | 230 | public static ArrayList<ProgSubgenre> values(ProgGenre gr) { |
231 | 231 | ArrayList<ProgSubgenre> ga = new ArrayList<TVProgram.ProgSubgenre>(); |
232 | 232 | for ( ProgSubgenre g : ProgSubgenre.values() ) { |
@@ -256,7 +256,7 @@ public interface TVProgram { | ||
256 | 256 | } |
257 | 257 | return null; |
258 | 258 | } |
259 | - | |
259 | + | |
260 | 260 | public static ProgSubgenre getByIEPG(ProgGenre gr, String iepg) { |
261 | 261 | for ( ProgSubgenre g : ProgSubgenre.values(gr) ) { |
262 | 262 | if ( g.iepg.equals(iepg) ) { |
@@ -266,7 +266,7 @@ public interface TVProgram { | ||
266 | 266 | return null; |
267 | 267 | } |
268 | 268 | }; |
269 | - | |
269 | + | |
270 | 270 | public static final Object[][] optMarks = { |
271 | 271 | { ProgOption.HIDDEN_NEW, "【新】新番組" }, |
272 | 272 | { ProgOption.HIDDEN_LAST, "【終】最終回" }, |
@@ -290,7 +290,7 @@ public interface TVProgram { | ||
290 | 290 | { ProgOption.MODIFIED, "(更)番組詳細に更新あり - 予約待機分のみ" }, |
291 | 291 | { ProgOption.MOVED, "(移)先週無かったか時間が違う" }, |
292 | 292 | }; |
293 | - | |
293 | + | |
294 | 294 | public static final String[] OKINIIRI = {"★★★★★","★★★★","★★★","★★","★",""}; |
295 | 295 | |
296 | 296 | // エリアコード |
@@ -298,7 +298,7 @@ public interface TVProgram { | ||
298 | 298 | public static final String trCode = "tr"; |
299 | 299 | public static final String bsCode = "bs"; |
300 | 300 | public static final String csCode = "cs"; |
301 | - | |
301 | + | |
302 | 302 | // タイトルの頭の邪魔な文字 |
303 | 303 | public static final String titlePrefixRemoveExpr = "^(\\[(新|無|字|終|HV|SS|二|映|無料)\\]|無料≫|【無料】|【アニメ】)+\\s*"; |
304 | 304 | public static final String epnoNormalizeExpr = "([第#(])(\\d\\D|\\d$)"; |
@@ -311,7 +311,7 @@ public interface TVProgram { | ||
311 | 311 | |
312 | 312 | // 個体の特性 |
313 | 313 | // なし |
314 | - | |
314 | + | |
315 | 315 | /* |
316 | 316 | * TVProgramRefreshクラスを継承する部分 ←そんなクラスあったっけ…? |
317 | 317 | */ |
@@ -323,24 +323,24 @@ public interface TVProgram { | ||
323 | 323 | public void setExtension(String spoexSearchStart, String spoexSearchEnd, boolean spoexLimitation, ArrayList<SearchKey> extKeys); |
324 | 324 | public void abon(ArrayList<String> ngword); |
325 | 325 | public String chkComplete(); |
326 | - | |
326 | + | |
327 | 327 | //public void setAbnormal(boolean b); |
328 | 328 | //public boolean getAbnormal(); |
329 | - | |
329 | + | |
330 | 330 | public ProgType getType(); |
331 | 331 | public ProgSubtype getSubtype(); |
332 | 332 | |
333 | 333 | public void setDebug(boolean b); |
334 | 334 | //public boolean setProxy(String host, String port); |
335 | - | |
335 | + | |
336 | 336 | /* |
337 | 337 | * 公開メソッドP(番組表) |
338 | 338 | */ |
339 | - public void loadProgram(String areaCode, boolean force); | |
339 | + public boolean loadProgram(String areaCode, boolean force); | |
340 | 340 | public int getTimeBarStart(); |
341 | 341 | public void setExpandTo8(boolean b); |
342 | 342 | public void setUseDetailCache(boolean b); |
343 | - | |
343 | + | |
344 | 344 | /* |
345 | 345 | * 公開メソッドA(地域設定) |
346 | 346 | */ |
@@ -354,16 +354,16 @@ public interface TVProgram { | ||
354 | 354 | public String setSelectedAreaByCode(String code); |
355 | 355 | public String getSelectedArea(); |
356 | 356 | public String getSelectedCode(); |
357 | - | |
357 | + | |
358 | 358 | /* |
359 | 359 | * 公開メソッドC(放送局設定) |
360 | 360 | */ |
361 | 361 | //public void loadCenter(); |
362 | 362 | public void loadCenter(String code, boolean force); |
363 | 363 | public boolean saveCenter(); |
364 | - | |
364 | + | |
365 | 365 | /* |
366 | - * | |
366 | + * | |
367 | 367 | */ |
368 | 368 | public void setUserAgent(String s); |
369 | 369 | public void setProgDir(String s); |
@@ -373,10 +373,10 @@ public interface TVProgram { | ||
373 | 373 | public void setContinueTomorrow(boolean b); |
374 | 374 | public void setSplitEpno(boolean b); |
375 | 375 | //public String[] doSplitEpno(ProgGenre genre, String title); |
376 | - | |
376 | + | |
377 | 377 | // 拡張機能! |
378 | 378 | public boolean setOptString(String s); |
379 | 379 | public String getOptString(); |
380 | - | |
381 | - | |
380 | + | |
381 | + | |
382 | 382 | } |
@@ -40,30 +40,30 @@ public class TVProgramUtils implements Cloneable { | ||
40 | 40 | /******************************************************************************* |
41 | 41 | * ディープコピーが意外と大変 |
42 | 42 | ******************************************************************************/ |
43 | - | |
43 | + | |
44 | 44 | @Override |
45 | 45 | public TVProgramUtils clone() { |
46 | 46 | try { |
47 | 47 | TVProgramUtils p = (TVProgramUtils) super.clone(); |
48 | - | |
48 | + | |
49 | 49 | // フィールドコピーしてもらいたくないもの |
50 | 50 | p.pcenter = null; |
51 | - | |
51 | + | |
52 | 52 | // static化したのでコピー抑制を必要としなくなったものたち |
53 | 53 | //p.setProgressArea(null); |
54 | 54 | //p.setChConv(null); |
55 | - | |
55 | + | |
56 | 56 | FieldUtils.deepCopy(p, this); // ディープコピーするよ |
57 | - | |
57 | + | |
58 | 58 | p.pcenter = new ArrayList<ProgList>(); |
59 | - | |
59 | + | |
60 | 60 | /* |
61 | 61 | // 地域設定をコピー |
62 | 62 | p.aclist = new ArrayList<AreaCode>(); |
63 | 63 | for ( AreaCode ac : aclist ) { |
64 | 64 | p.aclist.add(ac.clone()); |
65 | 65 | } |
66 | - | |
66 | + | |
67 | 67 | // 放送局設定をコピー |
68 | 68 | p.crlist = new ArrayList<Center>(); |
69 | 69 | for ( Center cr : crlist ) { |
@@ -74,17 +74,17 @@ public class TVProgramUtils implements Cloneable { | ||
74 | 74 | p.setSortedCRlist(); |
75 | 75 | |
76 | 76 | return p; |
77 | - | |
77 | + | |
78 | 78 | } catch (CloneNotSupportedException e) { |
79 | 79 | throw new InternalError(e.toString()); |
80 | 80 | } |
81 | 81 | } |
82 | - | |
83 | - | |
82 | + | |
83 | + | |
84 | 84 | /******************************************************************************* |
85 | 85 | * 共通情報 |
86 | 86 | ******************************************************************************/ |
87 | - | |
87 | + | |
88 | 88 | /** |
89 | 89 | * Proxy |
90 | 90 | */ |
@@ -102,72 +102,86 @@ public class TVProgramUtils implements Cloneable { | ||
102 | 102 | proxy = newproxy; |
103 | 103 | return true; |
104 | 104 | } |
105 | - | |
105 | + | |
106 | 106 | private Proxy getProxy() { return proxy; } |
107 | - | |
107 | + | |
108 | 108 | private static Proxy proxy = null; |
109 | - | |
109 | + | |
110 | 110 | /** |
111 | 111 | * ChannelConvert.dat |
112 | 112 | */ |
113 | 113 | public static void setChConv(ChannelConvert cc) { chconv = cc; } |
114 | - | |
114 | + | |
115 | 115 | private ChannelConvert getChConv() { return chconv; } |
116 | - | |
116 | + | |
117 | 117 | private static ChannelConvert chconv = null; |
118 | - | |
118 | + | |
119 | 119 | /** |
120 | 120 | * ログと進捗ダイアログ |
121 | 121 | */ |
122 | 122 | public static void setProgressArea(StatusWindow o) { stw = o; } |
123 | - | |
124 | - protected void reportProgress(String msg) { | |
125 | - if (stw != null) { | |
123 | + public static void setProgressAreaBackground(StatusTextArea o){ mwinBackground = o; } | |
124 | + | |
125 | + public static void reportProgress(String msg) { | |
126 | + if (mwinBackground != null){ | |
127 | + mwinBackground.appendMessage(msg); | |
128 | + } | |
129 | + else if (stw != null) { | |
126 | 130 | stw.append(msg); |
127 | 131 | } |
128 | 132 | System.out.println(msg); |
129 | 133 | } |
130 | 134 | |
131 | 135 | private static StatusWindow stw = null; |
132 | - | |
133 | - | |
136 | + private static StatusTextArea mwinBackground = null; | |
137 | + | |
138 | + public static void setCancelRequested(boolean b){ cancelRequested = b; } | |
139 | + public static boolean isCancelRequested(){ | |
140 | + if (stw != null && stw.isWindowCloseRequested()) | |
141 | + return true; | |
142 | + | |
143 | + return cancelRequested; | |
144 | + } | |
145 | + | |
146 | + private static boolean cancelRequested = false; | |
147 | + | |
134 | 148 | /******************************************************************************* |
135 | 149 | * オプション確認 |
136 | 150 | ******************************************************************************/ |
137 | - | |
151 | + | |
138 | 152 | public boolean isAreaSelectSupported() { return true; } // デフォルトはエリアを選べる |
139 | - | |
140 | - | |
153 | + | |
154 | + | |
141 | 155 | /******************************************************************************* |
142 | 156 | * 定数 |
143 | 157 | ******************************************************************************/ |
144 | - | |
158 | + | |
145 | 159 | // コネクションタイムアウト |
146 | 160 | private static final int conntout = 5; |
147 | - | |
161 | + | |
148 | 162 | // read()タイムアウト |
149 | 163 | private static final int readtout = 30; |
150 | 164 | |
151 | 165 | // 番組表が複数ページに跨っている場合、何ページまで追いかけるか |
152 | 166 | protected static final int REFPAGESMAX = 10; |
153 | - | |
167 | + | |
154 | 168 | // 番組詳細に情報をconcatする時のセパレータ |
155 | 169 | protected final String DETAIL_SEP = "\n\n"; |
156 | - | |
170 | + | |
157 | 171 | // メッセージID |
158 | 172 | private static final String MSGID = "[番組表共通] "; |
159 | 173 | private static final String DBGID = "[DEBUG]"+MSGID; |
160 | 174 | private static final String ERRID = "[ERROR]"+MSGID; |
161 | - | |
175 | + | |
162 | 176 | /******************************************************************************* |
163 | 177 | * メンバ変数関連 |
164 | 178 | ******************************************************************************/ |
165 | - | |
179 | + | |
166 | 180 | // デバッグフラグ |
167 | 181 | public void setDebug(boolean b) { debug = b; } |
168 | 182 | protected boolean getDebug() { return debug; } // 参照はサブクラスのみに許可 |
169 | 183 | private boolean debug = false; |
170 | - | |
184 | + | |
171 | 185 | // 通信エラー時のリトライ回数 |
172 | 186 | protected void setRetryCount(int n) { retrycount = n; } // サブクラスのみに許可(特殊) |
173 | 187 | private int retrycount = 1; |
@@ -181,65 +195,65 @@ public class TVProgramUtils implements Cloneable { | ||
181 | 195 | public String getProgDir() { return progDir; } |
182 | 196 | public void setProgDir(String s) { progDir = s; } |
183 | 197 | private String progDir = "progcache"; |
184 | - | |
198 | + | |
185 | 199 | // 番組表キャッシュの有効時間(H) |
186 | 200 | public int getCacheExpired() { return cacheExpired; } |
187 | 201 | public void setCacheExpired(int h) { cacheExpired = h; } |
188 | 202 | private int cacheExpired = 6; |
189 | - | |
203 | + | |
190 | 204 | // 番組詳細取得を行なうかどうか |
191 | 205 | public boolean getUseDetailCache() { return useDetailCache; } |
192 | 206 | public void setUseDetailCache(boolean b) { useDetailCache = b; } |
193 | 207 | private boolean useDetailCache = true; |
194 | - | |
208 | + | |
195 | 209 | // 29時跨ぎで2つに分かれた番組情報をくっつけるかどうか |
196 | 210 | public boolean getContinueTomorrow() { return continueTomorrow; } |
197 | 211 | public void setContinueTomorrow(boolean b) { continueTomorrow = b; } |
198 | 212 | private boolean continueTomorrow = false; |
199 | - | |
213 | + | |
200 | 214 | // タイトルから話数以降を分離する |
201 | 215 | public void setSplitEpno(boolean b) { splitEpno = b; } |
202 | 216 | public boolean isSplitEpno() { return splitEpno; } |
203 | 217 | private boolean splitEpno = true; |
204 | - | |
218 | + | |
205 | 219 | // 可能なら8日分取得する |
206 | 220 | public boolean getExpandTo8() { return expandTo8; } |
207 | 221 | public void setExpandTo8(boolean b) { expandTo8 = b; } |
208 | 222 | private boolean expandTo8 = false; |
209 | - | |
223 | + | |
210 | 224 | // 番組詳細キャッシュをオンライン取得するかどうか |
211 | 225 | @Deprecated |
212 | 226 | protected boolean isForceLoadDetInfo() { return forceLoadDetInfo; } |
213 | 227 | @Deprecated |
214 | 228 | private boolean forceLoadDetInfo = false; |
215 | - | |
229 | + | |
216 | 230 | // もう使っていないようだ |
217 | 231 | //public void setAbnormal(boolean b) { abnormal = b; } |
218 | 232 | //public boolean getAbnormal() { return abnormal; } |
219 | 233 | //private boolean abnormal = false; |
220 | 234 | |
221 | - | |
235 | + | |
222 | 236 | /******************************************************************************* |
223 | 237 | * 番組表固有の情報 |
224 | 238 | ******************************************************************************/ |
225 | 239 | |
226 | - | |
240 | + | |
227 | 241 | /******************************************************************************* |
228 | 242 | * 番組情報 |
229 | 243 | ******************************************************************************/ |
230 | - | |
244 | + | |
231 | 245 | /** |
232 | 246 | * <P>番組表が格納される場所 |
233 | 247 | * <P>上から順の{@link ProgList}(pcenter/放送局別)->{@link ProgDateList}(pdate/日付別)→{@link ProgDetailList}pdetail/(番組詳細) |
234 | 248 | */ |
235 | 249 | public ArrayList<ProgList> getCenters() { return(pcenter); } |
236 | 250 | public ArrayList<ProgList> pcenter = new ArrayList<ProgList>(); |
237 | - | |
238 | - | |
251 | + | |
252 | + | |
239 | 253 | /******************************************************************************* |
240 | 254 | * 放送局情報 |
241 | 255 | ******************************************************************************/ |
242 | - | |
256 | + | |
243 | 257 | /** |
244 | 258 | * 放送局名リスト |
245 | 259 | * @see ProgList#Center |
@@ -247,7 +261,7 @@ public class TVProgramUtils implements Cloneable { | ||
247 | 261 | */ |
248 | 262 | public ArrayList<Center> getCRlist() { return(crlist); } |
249 | 263 | public ArrayList<Center> crlist = new ArrayList<Center>(); |
250 | - | |
264 | + | |
251 | 265 | /** |
252 | 266 | * ソート済み放送局名リスト |
253 | 267 | * @see ProgList#Center |
@@ -266,7 +280,7 @@ public class TVProgramUtils implements Cloneable { | ||
266 | 280 | } |
267 | 281 | } |
268 | 282 | public ArrayList<Center> sortedcrlist = new ArrayList<Center>(); |
269 | - | |
283 | + | |
270 | 284 | // 設定ファイルへ書き出し |
271 | 285 | public boolean saveCenter() { |
272 | 286 | String centerListFile = getCenterListFile(getTVProgramId(), getSelectedCode()); |
@@ -277,12 +291,12 @@ public class TVProgramUtils implements Cloneable { | ||
277 | 291 | System.out.println("放送局リストを保存しました: "+centerListFile+", "+getSelectedCode()); |
278 | 292 | return true; |
279 | 293 | } |
280 | - | |
294 | + | |
281 | 295 | // 放送局リストファイル名 |
282 | 296 | protected String getCenterListFile(String id, String code) { |
283 | 297 | return String.format("env%scenter.%s.%s.xml", File.separator, id, code); |
284 | 298 | } |
285 | - | |
299 | + | |
286 | 300 | // 放送局名に一括してフィルタをかける |
287 | 301 | protected void attachChFilters() { |
288 | 302 | for ( Center c : crlist ) { |
@@ -292,7 +306,7 @@ public class TVProgramUtils implements Cloneable { | ||
292 | 306 | c.setCenter(getChConv().get(c.getCenterOrig())); |
293 | 307 | } |
294 | 308 | } |
295 | - | |
309 | + | |
296 | 310 | // 放送局名個別にフィルタをかけたい |
297 | 311 | protected String getChName(String chorig) { |
298 | 312 | return getChConv().get(chorig); |
@@ -302,13 +316,13 @@ public class TVProgramUtils implements Cloneable { | ||
302 | 316 | /******************************************************************************* |
303 | 317 | * 地域情報 |
304 | 318 | ******************************************************************************/ |
305 | - | |
319 | + | |
306 | 320 | /** |
307 | 321 | * 地域コード のリストを取得する |
308 | 322 | */ |
309 | 323 | public ArrayList<AreaCode> getAClist() { return(aclist); } |
310 | 324 | public ArrayList<AreaCode> aclist = new ArrayList<AreaCode>(); |
311 | - | |
325 | + | |
312 | 326 | /** |
313 | 327 | * 地域コードから地域名を取得 |
314 | 328 | */ |
@@ -332,7 +346,7 @@ public class TVProgramUtils implements Cloneable { | ||
332 | 346 | } |
333 | 347 | return(null); |
334 | 348 | } |
335 | - | |
349 | + | |
336 | 350 | /** |
337 | 351 | * 地域名を指定して選択中の地域を変更し、ついでにその地域コードを返す |
338 | 352 | * @see #getSelectedCode() |
@@ -353,7 +367,7 @@ public class TVProgramUtils implements Cloneable { | ||
353 | 367 | } |
354 | 368 | return(null); |
355 | 369 | } |
356 | - | |
370 | + | |
357 | 371 | /** |
358 | 372 | * 地域コードを指定して選択中の地域を変更し、ついでにその地域名を返す |
359 | 373 | * @see #getSelectedArea() |
@@ -374,7 +388,7 @@ public class TVProgramUtils implements Cloneable { | ||
374 | 388 | } |
375 | 389 | return(null); |
376 | 390 | } |
377 | - | |
391 | + | |
378 | 392 | /** |
379 | 393 | * 選択中の地域名を返す |
380 | 394 | */ |
@@ -398,7 +412,7 @@ public class TVProgramUtils implements Cloneable { | ||
398 | 412 | } |
399 | 413 | return(getCode(getDefaultArea())); |
400 | 414 | } |
401 | - | |
415 | + | |
402 | 416 | // 設定ファイルへ書き出し |
403 | 417 | public void saveAreaCode() { |
404 | 418 | if ( CommonUtils.writeXML(getAreaSelectedFile(), aclist) ) { |
@@ -408,17 +422,17 @@ public class TVProgramUtils implements Cloneable { | ||
408 | 422 | System.err.println(ERRID+"地域リストの保存に失敗しました: "+getAreaSelectedFile()); |
409 | 423 | } |
410 | 424 | } |
411 | - | |
425 | + | |
412 | 426 | // 地域情報ファイル名 |
413 | 427 | protected String getAreaSelectedFile() { |
414 | 428 | return String.format("env%sarea.%s.xml", File.separator, getTVProgramId()); |
415 | 429 | } |
416 | - | |
417 | - | |
430 | + | |
431 | + | |
418 | 432 | /******************************************************************************* |
419 | 433 | * タイトル操作関連 |
420 | 434 | ******************************************************************************/ |
421 | - | |
435 | + | |
422 | 436 | /** |
423 | 437 | * 話数重複排除 |
424 | 438 | */ |
@@ -428,7 +442,7 @@ public class TVProgramUtils implements Cloneable { | ||
428 | 442 | if ( ! md.find() ) { |
429 | 443 | return title; |
430 | 444 | } |
431 | - | |
445 | + | |
432 | 446 | ArrayList<String> tnoa = new ArrayList<String>(); |
433 | 447 | { |
434 | 448 | Matcher me = Pattern.compile("(\\d+)").matcher(md.group(1)); |
@@ -439,7 +453,7 @@ public class TVProgramUtils implements Cloneable { | ||
439 | 453 | return title; |
440 | 454 | } |
441 | 455 | } |
442 | - | |
456 | + | |
443 | 457 | // 番組詳細と重複しているかな? |
444 | 458 | { |
445 | 459 | ArrayList<String> dnoa = new ArrayList<String>(); |
@@ -455,7 +469,7 @@ public class TVProgramUtils implements Cloneable { | ||
455 | 469 | if ( dnoa.size() == 0 ) { |
456 | 470 | return title; |
457 | 471 | } |
458 | - | |
472 | + | |
459 | 473 | for ( String tno : tnoa ) { |
460 | 474 | for ( String dno : dnoa ) { |
461 | 475 | if ( dno.equals(tno) ) { |
@@ -468,22 +482,22 @@ public class TVProgramUtils implements Cloneable { | ||
468 | 482 | title = md.replaceFirst(""); |
469 | 483 | } |
470 | 484 | } |
471 | - | |
485 | + | |
472 | 486 | return title; |
473 | 487 | } |
474 | - | |
488 | + | |
475 | 489 | /** |
476 | 490 | * サブタイトルの分離 |
477 | 491 | * @param pdl |
478 | 492 | */ |
479 | 493 | protected void doSplitSubtitle(ProgDetailList pdl) { |
480 | - | |
494 | + | |
481 | 495 | pdl.splitted_title = doCutDupEpno(pdl.title, pdl.detail); // タイトルと番組詳細中の話数の重複排除 |
482 | - | |
496 | + | |
483 | 497 | String [] d = doSplitEpno(pdl.genre, pdl.splitted_title); // 分離! |
484 | - | |
498 | + | |
485 | 499 | pdl.splitted_title = pdl.title.substring(0,d[0].length()); |
486 | - | |
500 | + | |
487 | 501 | if ( d[1].length() > 0 ) { |
488 | 502 | // 番組詳細はサブタイトル分離番組詳細へのポインタでいいよ |
489 | 503 | pdl.splitted_detail = d[1]+DETAIL_SEP+pdl.detail; |
@@ -493,7 +507,7 @@ public class TVProgramUtils implements Cloneable { | ||
493 | 507 | // サブタイトルが分離されなかったから同じでいいよ |
494 | 508 | pdl.splitted_detail = pdl.detail; |
495 | 509 | } |
496 | - | |
510 | + | |
497 | 511 | // タイトル&番組詳細のキーワード検索情報の設定 |
498 | 512 | String key_title; |
499 | 513 | String key_detail; |
@@ -508,11 +522,11 @@ public class TVProgramUtils implements Cloneable { | ||
508 | 522 | } |
509 | 523 | pdl.titlePop = TraceProgram.replacePop(key_title); |
510 | 524 | pdl.detailPop = TraceProgram.replacePop(key_detail); |
511 | - | |
525 | + | |
512 | 526 | // 分離しない場合でも、番組追跡はサブタイトル抜きでの検索ができるようにしたい |
513 | 527 | pdl.splitted_titlePop = TraceProgram.replacePop(pdl.splitted_title); |
514 | 528 | } |
515 | - | |
529 | + | |
516 | 530 | /** |
517 | 531 | * サブタイトル分離(Part.11 444-) |
518 | 532 | */ |
@@ -559,14 +573,14 @@ public class TVProgramUtils implements Cloneable { | ||
559 | 573 | } |
560 | 574 | return(new String[] { title,"" }); |
561 | 575 | } |
562 | - | |
576 | + | |
563 | 577 | // サブタイトル判定条件 |
564 | 578 | private static final String SPEP_EXPR = "(([<<]?[((##♯第全「][第]?[12345678901234567890一二三四五六七八九十百千]+?[回話章]?|「).*)$"; |
565 | - | |
579 | + | |
566 | 580 | // サブタイトル判定条件(ジャンル=ドラマ専用) |
567 | 581 | private static final String SPEP_EXPR_DORAMA = "^(.+?)[ ]*?(([<<]?[((##♯第全「][第]?[12345678901234567890一二三四五六七八九十百千]+?[回話章]?).*)$"; |
568 | - | |
569 | - | |
582 | + | |
583 | + | |
570 | 584 | /** |
571 | 585 | * NGワード |
572 | 586 | */ |
@@ -588,13 +602,13 @@ public class TVProgramUtils implements Cloneable { | ||
588 | 602 | } |
589 | 603 | } |
590 | 604 | } |
591 | - | |
592 | - | |
593 | - | |
605 | + | |
606 | + | |
607 | + | |
594 | 608 | /******************************************************************************* |
595 | 609 | * 番組情報キャッシュ |
596 | 610 | ******************************************************************************/ |
597 | - | |
611 | + | |
598 | 612 | // キャッシュファイルが有効期限内か確認する |
599 | 613 | public boolean isCacheOld(String fname) { |
600 | 614 | // キャッシュ期限が無期限の場合はDL禁止 |
@@ -619,7 +633,7 @@ public class TVProgramUtils implements Cloneable { | ||
619 | 633 | } |
620 | 634 | } |
621 | 635 | else { |
622 | - // ファイルを作成 | |
636 | + // ファイルを作成 | |
623 | 637 | f.createNewFile(); |
624 | 638 | return(true); |
625 | 639 | } |
@@ -630,12 +644,12 @@ public class TVProgramUtils implements Cloneable { | ||
630 | 644 | } |
631 | 645 | return(false); |
632 | 646 | } |
633 | - | |
634 | - | |
647 | + | |
648 | + | |
635 | 649 | /******************************************************************************* |
636 | 650 | * 番組詳細キャッシュ(現在は使われていない) |
637 | 651 | ******************************************************************************/ |
638 | - | |
652 | + | |
639 | 653 | /** |
640 | 654 | * 番組詳細をオンライン取得するかどうか |
641 | 655 | */ |
@@ -657,11 +671,11 @@ public class TVProgramUtils implements Cloneable { | ||
657 | 671 | forceLoadDetInfo = false; |
658 | 672 | } |
659 | 673 | } |
660 | - | |
674 | + | |
661 | 675 | // 番組詳細キャッシュのLOAD |
662 | 676 | @Deprecated |
663 | 677 | protected HashMap<String,String> loadDetCache(){ |
664 | - | |
678 | + | |
665 | 679 | // 設定ファイルが存在していればファイルから |
666 | 680 | File f = new File(getDetCacheFile()); |
667 | 681 | if (f.exists() == true) { |
@@ -670,14 +684,14 @@ public class TVProgramUtils implements Cloneable { | ||
670 | 684 | if ( cache != null ) { |
671 | 685 | return cache; |
672 | 686 | } |
673 | - | |
687 | + | |
674 | 688 | System.out.println(ERRID+"【致命的エラー】番組詳細キャッシュが読み込めません: "+getDetCacheFile()); |
675 | 689 | } |
676 | - | |
690 | + | |
677 | 691 | // キャッシュなし&エラーは空配列を返す |
678 | 692 | return new HashMap<String, String>(); |
679 | 693 | } |
680 | - | |
694 | + | |
681 | 695 | // 番組詳細キャッシュのSAVE |
682 | 696 | @Deprecated |
683 | 697 | protected void saveDetCache(HashMap<String,String> cache) { |
@@ -685,18 +699,18 @@ public class TVProgramUtils implements Cloneable { | ||
685 | 699 | System.err.println(ERRID+"【致命的エラー】番組詳細キャッシュが書き込めません: "+getDetCacheFile()); |
686 | 700 | } |
687 | 701 | } |
688 | - | |
689 | - | |
702 | + | |
703 | + | |
690 | 704 | /******************************************************************************* |
691 | 705 | * 番組情報のリフレッシュ関連 |
692 | 706 | ******************************************************************************/ |
693 | - | |
707 | + | |
694 | 708 | /** |
695 | 709 | * 日付変更線(29:00)をまたいだら過去のデータはカットする |
696 | 710 | * <B> PassedProgramでは使わない |
697 | 711 | */ |
698 | 712 | public void refresh() { |
699 | - | |
713 | + | |
700 | 714 | String critDate = CommonUtils.getDate529(0, true); |
701 | 715 | for ( ProgList p : pcenter ) { |
702 | 716 | int i = 0; |
@@ -711,7 +725,7 @@ public class TVProgramUtils implements Cloneable { | ||
711 | 725 | } |
712 | 726 | } |
713 | 727 | } |
714 | - | |
728 | + | |
715 | 729 | /** |
716 | 730 | * 24時間分番組枠が埋まっているかどうか確認する |
717 | 731 | */ |
@@ -739,30 +753,30 @@ public class TVProgramUtils implements Cloneable { | ||
739 | 753 | } |
740 | 754 | return null; |
741 | 755 | } |
742 | - | |
756 | + | |
743 | 757 | /** |
744 | 758 | * 開始終了日時の整理 |
745 | 759 | */ |
746 | 760 | public void setAccurateDate(ArrayList<ProgDateList> pcenter) { |
747 | - | |
761 | + | |
748 | 762 | // 先頭のエントリの開始時刻が 5:00 以前の場合 |
749 | 763 | for ( ProgDateList pcl : pcenter ) { |
750 | 764 | if (pcl.pdetail.size() <= 0) { |
751 | 765 | continue; |
752 | 766 | } |
753 | - | |
767 | + | |
754 | 768 | ProgDetailList pd = pcl.pdetail.get(0); |
755 | 769 | Matcher ma = Pattern.compile("(\\d\\d):(\\d\\d)").matcher(pd.start); |
756 | 770 | if (ma.find()) { |
757 | 771 | int prelength = 0; |
758 | 772 | int ahh = Integer.valueOf(ma.group(1)); |
759 | 773 | int amm = Integer.valueOf(ma.group(2)); |
760 | - | |
774 | + | |
761 | 775 | GregorianCalendar c = new GregorianCalendar(); |
762 | 776 | c.setTime(new Date()); |
763 | 777 | c.set(Calendar.HOUR_OF_DAY, ahh); |
764 | 778 | c.set(Calendar.MINUTE, amm); |
765 | - | |
779 | + | |
766 | 780 | if ( pd.start.compareTo("05:00") < 0 ) { |
767 | 781 | // 5:00以前 |
768 | 782 | prelength = (5*60+0)-(ahh*60+amm); |
@@ -779,20 +793,20 @@ public class TVProgramUtils implements Cloneable { | ||
779 | 793 | } |
780 | 794 | |
781 | 795 | for ( ProgDateList pcl : pcenter ) { |
782 | - | |
796 | + | |
783 | 797 | GregorianCalendar c = CommonUtils.getCalendar(pcl.Date); |
784 | - | |
798 | + | |
785 | 799 | boolean extend = false; |
786 | 800 | boolean overtwodays = false; |
787 | 801 | for ( int i=0; i<pcl.pdetail.size(); i++ ) { |
788 | - | |
802 | + | |
789 | 803 | ProgDetailList pdl = pcl.pdetail.get(i); |
790 | - | |
804 | + | |
791 | 805 | // 番組情報がありません |
792 | 806 | if (pdl.start.compareTo("") == 0) { |
793 | 807 | continue; |
794 | 808 | } |
795 | - | |
809 | + | |
796 | 810 | // 表示上の開始日時 |
797 | 811 | if ( i == 0 ) { |
798 | 812 | if ( pdl.start.compareTo("18:00") >= 0 && pdl.start.compareTo("24:00") < 0 ) { |
@@ -808,10 +822,10 @@ public class TVProgramUtils implements Cloneable { | ||
808 | 822 | } |
809 | 823 | } |
810 | 824 | pdl.startDateTime = String.format("%s %s", CommonUtils.getDate(c,false), pdl.start); |
811 | - | |
825 | + | |
812 | 826 | // 正確な開始日 |
813 | 827 | pdl.accurateDate = CommonUtils.getDate(c); |
814 | - | |
828 | + | |
815 | 829 | // 表示上の終了日時 |
816 | 830 | if ( overtwodays ) { |
817 | 831 | c.add(Calendar.DAY_OF_MONTH, 1); |
@@ -823,11 +837,11 @@ public class TVProgramUtils implements Cloneable { | ||
823 | 837 | extend = true; |
824 | 838 | } |
825 | 839 | } |
826 | - | |
840 | + | |
827 | 841 | pdl.endDateTime = String.format("%s %s", CommonUtils.getDate(c,false), pdl.end); |
828 | 842 | } |
829 | 843 | } |
830 | - | |
844 | + | |
831 | 845 | // 29時をまたいで同タイトルが続いている場合は同一番組とみなす |
832 | 846 | if ( continueTomorrow ) { |
833 | 847 | for (int w=0; w<pcenter.size()-1; w++) { |
@@ -837,7 +851,7 @@ public class TVProgramUtils implements Cloneable { | ||
837 | 851 | if (pd1.title.equals(pd2.title)) { |
838 | 852 | pd1.end = pd2.end; |
839 | 853 | pd1.endDateTime = pd2.endDateTime; |
840 | - | |
854 | + | |
841 | 855 | pd2.start = pd1.start; |
842 | 856 | pd2.startDateTime = pd1.startDateTime; |
843 | 857 | pd2.accurateDate = pd1.accurateDate; |
@@ -845,11 +859,11 @@ public class TVProgramUtils implements Cloneable { | ||
845 | 859 | else if (pd2.title.equals("承前")) { |
846 | 860 | pd1.end = pd2.end; |
847 | 861 | pd1.endDateTime = pd2.endDateTime; |
848 | - | |
862 | + | |
849 | 863 | pd2.start = pd1.start; |
850 | 864 | pd2.startDateTime = pd1.startDateTime; |
851 | 865 | pd2.accurateDate = pd1.accurateDate; |
852 | - | |
866 | + | |
853 | 867 | pd2.title = pd1.title; |
854 | 868 | pd2.detail = pd1.detail; |
855 | 869 | pd2.setAddedDetail(pd1.getAddedDetail()); |
@@ -865,37 +879,37 @@ public class TVProgramUtils implements Cloneable { | ||
865 | 879 | } |
866 | 880 | } |
867 | 881 | } |
868 | - | |
882 | + | |
869 | 883 | // 以前に取得したデータから当日の取得不能領域のデータを補完する |
870 | 884 | protected void CompensatesPrograms(ArrayList<ProgList> newplist) { |
871 | 885 | // |
872 | 886 | for ( ProgList newpl : newplist ) { |
873 | - | |
887 | + | |
874 | 888 | if ( newpl.enabled != true ) { |
875 | 889 | // 無効局は処理なし |
876 | 890 | continue; |
877 | 891 | } |
878 | - | |
879 | - ArrayList<ProgDateList> newpcla = newpl.pdate; | |
892 | + | |
893 | + ArrayList<ProgDateList> newpcla = newpl.pdate; | |
880 | 894 | if ( newpcla.size() == 0 ) { |
881 | 895 | // 日付リストが存在しない場合は処理なし |
882 | 896 | continue; |
883 | 897 | } |
884 | 898 | ProgDateList newpcl = newpcla.get(0); |
885 | - | |
899 | + | |
886 | 900 | ArrayList<ProgDetailList> newpdla = newpcl.pdetail; |
887 | 901 | if ( newpdla.size() == 0 ) { |
888 | 902 | // 番組情報が存在しない場合は処理なし |
889 | 903 | if (debug) System.out.println(DBGID+"番組表情報がないので過去ログは参照しない: "+newpcl.Date+" "+newpl.Center); |
890 | 904 | continue; |
891 | 905 | } |
892 | - | |
906 | + | |
893 | 907 | if ( newpdla.get(0).start.length() != 0 ) { |
894 | 908 | // 先頭の番組情報が「番組情報がありません」以外の場合は処理なし |
895 | 909 | if (debug) System.out.println(DBGID+"先頭から有効な情報なので過去ログは参照しない: "+newpcl.Date+" "+newpl.Center+" "+newpdla.get(0).start+" "+newpdla.get(0).title); |
896 | 910 | continue; |
897 | 911 | } |
898 | - | |
912 | + | |
899 | 913 | PassedProgram oldplist = new PassedProgram(); |
900 | 914 | if ( ! oldplist.loadByCenter(newpcl.Date, newpl.Center) || oldplist.getProgCount() == 0 ) { |
901 | 915 | // 過去情報が取得できなければ処理なし |
@@ -903,7 +917,7 @@ public class TVProgramUtils implements Cloneable { | ||
903 | 917 | continue; |
904 | 918 | } |
905 | 919 | ProgDateList oldpcl = oldplist.pcenter.get(0).pdate.get(0); |
906 | - | |
920 | + | |
907 | 921 | // 補填候補抽出 |
908 | 922 | ArrayList<ProgDetailList> tmppdla = new ArrayList<ProgDetailList>(); |
909 | 923 | if ( newpdla.size() == 1 ) { |
@@ -930,7 +944,7 @@ public class TVProgramUtils implements Cloneable { | ||
930 | 944 | idx++; |
931 | 945 | } |
932 | 946 | } |
933 | - | |
947 | + | |
934 | 948 | // 先頭の「番組情報はありません」と差し替えて補填 |
935 | 949 | newpdla.remove(0); |
936 | 950 | for ( int i=0; i<tmppdla.size(); i++ ) { |
@@ -949,11 +963,11 @@ public class TVProgramUtils implements Cloneable { | ||
949 | 963 | pcl.pdetail.add(pdl); |
950 | 964 | pcl.row += pdl.length; |
951 | 965 | } |
952 | - | |
966 | + | |
953 | 967 | /******************************************************************************* |
954 | 968 | * フラグ処理関連 |
955 | 969 | ******************************************************************************/ |
956 | - | |
970 | + | |
957 | 971 | /** |
958 | 972 | * 延長警告を設定する |
959 | 973 | */ |
@@ -961,10 +975,10 @@ public class TVProgramUtils implements Cloneable { | ||
961 | 975 | // |
962 | 976 | for ( ProgList p : pcenter ) { |
963 | 977 | // 局ごと |
964 | - | |
978 | + | |
965 | 979 | // キーワード検索用 |
966 | 980 | String centerPop = TraceProgram.replacePop(p.Center); |
967 | - | |
981 | + | |
968 | 982 | for ( ProgDateList c : p.pdate ) { |
969 | 983 | // 日ごと |
970 | 984 | boolean poisoned = false; |
@@ -989,23 +1003,23 @@ public class TVProgramUtils implements Cloneable { | ||
989 | 1003 | if (soi) { |
990 | 1004 | poisoned = true; |
991 | 1005 | } |
992 | - | |
1006 | + | |
993 | 1007 | d.extension = poisoned; |
994 | 1008 | } |
995 | 1009 | } |
996 | 1010 | } |
997 | 1011 | } |
998 | - | |
1012 | + | |
999 | 1013 | /* |
1000 | 1014 | * タイトルからフラグを抽出する |
1001 | 1015 | */ |
1002 | 1016 | protected void doSplitFlags(ProgDetailList pdl, HashMap<String, String> nf) { |
1003 | - | |
1017 | + | |
1004 | 1018 | Matcher md = Pattern.compile("(#1|第1話)\\b").matcher(pdl.title); |
1005 | 1019 | if ( md.find() ) { |
1006 | 1020 | pdl.flag = ProgFlags.NEW; |
1007 | 1021 | } |
1008 | - | |
1022 | + | |
1009 | 1023 | md = Pattern.compile("([ ]?[<<]新[>>]| 新$| NEW$)").matcher(pdl.title); |
1010 | 1024 | if ( md.find() ) { |
1011 | 1025 | pdl.flag = ProgFlags.NEW; |
@@ -1014,7 +1028,7 @@ public class TVProgramUtils implements Cloneable { | ||
1014 | 1028 | md = Pattern.compile("([ ]?[<<]終[>>]| 終$| END$)").matcher(pdl.title); |
1015 | 1029 | if ( md.find() ) { |
1016 | 1030 | pdl.flag = ProgFlags.LAST; |
1017 | - pdl.title = md.replaceAll(""); | |
1031 | + pdl.title = md.replaceAll(""); | |
1018 | 1032 | } |
1019 | 1033 | md = Pattern.compile("[((]終[))]",Pattern.DOTALL).matcher(pdl.detail); |
1020 | 1034 | if ( md.find() ) { |
@@ -1023,9 +1037,9 @@ public class TVProgramUtils implements Cloneable { | ||
1023 | 1037 | md = Pattern.compile("^無料≫").matcher(pdl.title); |
1024 | 1038 | if ( md.find() ) { |
1025 | 1039 | pdl.noscrumble = ProgScrumble.NOSCRUMBLE; |
1026 | - pdl.title = md.replaceAll(""); | |
1040 | + pdl.title = md.replaceAll(""); | |
1027 | 1041 | } |
1028 | - | |
1042 | + | |
1029 | 1043 | Pattern pat = Pattern.compile("初放送",Pattern.DOTALL); |
1030 | 1044 | if ( pat.matcher(pdl.detail).find() ) { |
1031 | 1045 | pdl.addOption(ProgOption.FIRST); |
@@ -1041,13 +1055,13 @@ public class TVProgramUtils implements Cloneable { | ||
1041 | 1055 | else if ( pat.matcher(pdl.title).find() ) { |
1042 | 1056 | pdl.addOption(ProgOption.RATING); |
1043 | 1057 | } |
1044 | - | |
1058 | + | |
1045 | 1059 | if ( pdl.detail.indexOf("5.1サラウンド") != -1 ) { |
1046 | 1060 | pdl.addOption(ProgOption.SURROUND); |
1047 | 1061 | } |
1048 | 1062 | |
1049 | 1063 | HashMap<String, String> xf = new HashMap<String, String>(); |
1050 | - | |
1064 | + | |
1051 | 1065 | String flagExpr = "[\\[[((【](.{1,3})[\\]]))】]"; |
1052 | 1066 | Matcher mx = Pattern.compile(flagExpr).matcher(pdl.title); |
1053 | 1067 | while (mx.find()) { |
@@ -1066,7 +1080,7 @@ public class TVProgramUtils implements Cloneable { | ||
1066 | 1080 | else if (mx.group(1).equals("生")) { |
1067 | 1081 | pdl.addOption(ProgOption.LIVE); |
1068 | 1082 | } |
1069 | - | |
1083 | + | |
1070 | 1084 | else if (mx.group(1).equals("二/吹")) { |
1071 | 1085 | pdl.addOption(ProgOption.BILINGUAL); |
1072 | 1086 | pdl.addOption(ProgOption.STANDIN); |
@@ -1093,7 +1107,7 @@ public class TVProgramUtils implements Cloneable { | ||
1093 | 1107 | //pdl.addOption(ProgOption.NOSCRUMBLE); |
1094 | 1108 | pdl.noscrumble = ProgScrumble.NOSCRUMBLE; |
1095 | 1109 | } |
1096 | - | |
1110 | + | |
1097 | 1111 | else if (mx.group(1).matches("^(S|N|B|映|双|解|手|天|英|日|録|HV)$")) { |
1098 | 1112 | // 無視するフラグ |
1099 | 1113 | if ( mx.group(1).equals("日") && ( ! pdl.title.matches(String.format("^(%s)*[((]日[))].*", flagExpr)) && ! pdl.title.matches(".*[\\[[]日[\\]]].*")) ) { |
@@ -1105,13 +1119,13 @@ public class TVProgramUtils implements Cloneable { | ||
1105 | 1119 | // 削除しないフラグ |
1106 | 1120 | continue; |
1107 | 1121 | } |
1108 | - | |
1122 | + | |
1109 | 1123 | else { |
1110 | 1124 | // 未知のフラグ |
1111 | 1125 | nf.put(mx.group(1),null); |
1112 | 1126 | continue; |
1113 | 1127 | } |
1114 | - | |
1128 | + | |
1115 | 1129 | // 削除するフラグ |
1116 | 1130 | xf.put(mx.group(1), null); |
1117 | 1131 | } |
@@ -1126,7 +1140,7 @@ public class TVProgramUtils implements Cloneable { | ||
1126 | 1140 | pdl.title = pdl.title.replaceAll(repExpr, ""); |
1127 | 1141 | } |
1128 | 1142 | } |
1129 | - | |
1143 | + | |
1130 | 1144 | if ( pdl.title.matches("^特[::].*") ) { |
1131 | 1145 | pdl.option.add(ProgOption.SPECIAL); |
1132 | 1146 | pdl.title = pdl.title.substring(2); |
@@ -1138,7 +1152,7 @@ public class TVProgramUtils implements Cloneable { | ||
1138 | 1152 | pdl.option.add(ProgOption.SPECIAL); |
1139 | 1153 | } |
1140 | 1154 | } |
1141 | - | |
1155 | + | |
1142 | 1156 | /** |
1143 | 1157 | * マルチジャンル処理 |
1144 | 1158 | */ |
@@ -1148,17 +1162,17 @@ public class TVProgramUtils implements Cloneable { | ||
1148 | 1162 | |
1149 | 1163 | // ここに入ってこない限り genrelist == null なので対応プラグイン以外ではマルチジャンルは機能しない |
1150 | 1164 | pdl.genrelist = new ArrayList<TVProgram.ProgGenre>(); |
1151 | - pdl.subgenrelist = new ArrayList<TVProgram.ProgSubgenre>(); | |
1152 | - | |
1165 | + pdl.subgenrelist = new ArrayList<TVProgram.ProgSubgenre>(); | |
1166 | + | |
1153 | 1167 | String gcode = ProgGenre.NOGENRE.toIEPG(); |
1154 | 1168 | String subgcode = ProgSubgenre.NOGENRE_ETC.toIEPG(); |
1155 | - | |
1169 | + | |
1156 | 1170 | // マルチジャンルコードを設定する |
1157 | 1171 | for ( String gstr : genrelist ) { |
1158 | 1172 | // ジャンルコードが複数ある場合は基本的に最初のものを代表にするが、一部例外をもうける(ニュースよりドキュメンタリー優先、など) |
1159 | 1173 | // 鯛ナビの一覧で表示されるジャンルは代表のものだけである |
1160 | - String gv = gstr.substring(0,1); | |
1161 | - String subgv = gstr.substring(1,2); | |
1174 | + String gv = gstr.substring(0,1); | |
1175 | + String subgv = gstr.substring(1,2); | |
1162 | 1176 | if ( gcode.equals(ProgGenre.NOGENRE.toIEPG()) ) { |
1163 | 1177 | gcode = gv; |
1164 | 1178 | subgcode = subgv; |
@@ -1173,7 +1187,7 @@ public class TVProgramUtils implements Cloneable { | ||
1173 | 1187 | subgcode = md.group(2); |
1174 | 1188 | } |
1175 | 1189 | */ |
1176 | - | |
1190 | + | |
1177 | 1191 | // 3.14.12βでマルチジャンル対応を追加した |
1178 | 1192 | // 一覧では代表しか見えないが、検索処理ではすべてのジャンルコードが対象になる |
1179 | 1193 | { |
@@ -1201,7 +1215,7 @@ public class TVProgramUtils implements Cloneable { | ||
1201 | 1215 | pdl.subgenrelist.add(ProgSubgenre.NOGENRE_ETC); |
1202 | 1216 | } |
1203 | 1217 | } |
1204 | - | |
1218 | + | |
1205 | 1219 | // 代表ジャンルコードを設定する |
1206 | 1220 | for ( ProgGenre g : ProgGenre.values() ) { |
1207 | 1221 | if ( g.toIEPG().equals(gcode) ) { |
@@ -1216,19 +1230,19 @@ public class TVProgramUtils implements Cloneable { | ||
1216 | 1230 | } |
1217 | 1231 | } |
1218 | 1232 | } |
1219 | - | |
1220 | - | |
1233 | + | |
1234 | + | |
1221 | 1235 | /******************************************************************************* |
1222 | 1236 | * 通信系 |
1223 | 1237 | ******************************************************************************/ |
1224 | - | |
1238 | + | |
1225 | 1239 | // Web上から取得してファイルにキャッシュする |
1226 | - | |
1240 | + | |
1227 | 1241 | // GET型 |
1228 | 1242 | public void webToFile(String uri, String fname, String thisEncoding) { |
1229 | 1243 | webToFile(uri, null, null, null, fname, thisEncoding); |
1230 | 1244 | } |
1231 | - | |
1245 | + | |
1232 | 1246 | // POST型 |
1233 | 1247 | public void webToFile(String uri, String pstr, String cookie, String referer, String fname, String thisEncoding) { |
1234 | 1248 | int retry = 0; |
@@ -1243,10 +1257,10 @@ public class TVProgramUtils implements Cloneable { | ||
1243 | 1257 | CommonUtils.milSleep(1000); |
1244 | 1258 | } |
1245 | 1259 | } |
1246 | - | |
1260 | + | |
1247 | 1261 | // GET/POST本体 |
1248 | 1262 | private boolean _webToFile(String uri, String pstr, String cookie, String referer, String fname, String thisEncoding) { |
1249 | - | |
1263 | + | |
1250 | 1264 | HttpURLConnection ucon = null; |
1251 | 1265 | BufferedWriter filewriter = null; |
1252 | 1266 | BufferedReader filereader = null; |
@@ -1257,7 +1271,7 @@ public class TVProgramUtils implements Cloneable { | ||
1257 | 1271 | if (ucon == null) { |
1258 | 1272 | return false; |
1259 | 1273 | } |
1260 | - | |
1274 | + | |
1261 | 1275 | // 一時ファイルに書き出し |
1262 | 1276 | if (thisEncoding != null) { |
1263 | 1277 | filewriter = new BufferedWriter(new FileWriter(fname+".tmp")); |
@@ -1287,9 +1301,9 @@ public class TVProgramUtils implements Cloneable { | ||
1287 | 1301 | } |
1288 | 1302 | ucon.disconnect(); |
1289 | 1303 | ucon = null; |
1290 | - | |
1291 | - // クローズしてからじゃないと失敗するよ | |
1292 | - | |
1304 | + | |
1305 | + // クローズしてからじゃないと失敗するよ | |
1306 | + | |
1293 | 1307 | // キャッシュファイルに変換 |
1294 | 1308 | File o = new File(fname); |
1295 | 1309 | if ( o.exists() && ! o.delete() ) { |
@@ -1300,7 +1314,7 @@ public class TVProgramUtils implements Cloneable { | ||
1300 | 1314 | System.err.println("リネームできないよ: "+fname+".tmp to "+fname); |
1301 | 1315 | return false; |
1302 | 1316 | } |
1303 | - | |
1317 | + | |
1304 | 1318 | return true; |
1305 | 1319 | } |
1306 | 1320 | catch (Exception e) { |
@@ -1318,17 +1332,17 @@ public class TVProgramUtils implements Cloneable { | ||
1318 | 1332 | } |
1319 | 1333 | |
1320 | 1334 | // Web上から取得してバッファに格納する |
1321 | - | |
1335 | + | |
1322 | 1336 | // GET型 |
1323 | 1337 | public String webToBuffer(String uri, String thisEncoding, boolean nocr) { |
1324 | 1338 | return webToBuffer(uri, null, null, null, thisEncoding, nocr); |
1325 | 1339 | } |
1326 | - | |
1340 | + | |
1327 | 1341 | // POST型 |
1328 | 1342 | public String webToBuffer(String uri, String pstr, String cookie, String referer, String thisEncoding, boolean nocr) { |
1329 | 1343 | int retry = 0; |
1330 | 1344 | while (true) { |
1331 | - String response = _webToBuffer(uri, pstr, cookie, referer, thisEncoding, nocr); | |
1345 | + String response = _webToBuffer(uri, pstr, cookie, referer, thisEncoding, nocr); | |
1332 | 1346 | if ( response != null ) { |
1333 | 1347 | return response; |
1334 | 1348 | } |
@@ -1340,14 +1354,14 @@ public class TVProgramUtils implements Cloneable { | ||
1340 | 1354 | } |
1341 | 1355 | return null; |
1342 | 1356 | } |
1343 | - | |
1357 | + | |
1344 | 1358 | // 本体 |
1345 | 1359 | private String _webToBuffer(String uri, String pstr, String cookie, String referer, String thisEncoding, boolean nocr) { |
1346 | 1360 | |
1347 | 1361 | if ( thisEncoding == null ) { |
1348 | 1362 | return null; |
1349 | 1363 | } |
1350 | - | |
1364 | + | |
1351 | 1365 | try { |
1352 | 1366 | HttpURLConnection ucon = null; |
1353 | 1367 | BufferedReader reader = null; |
@@ -1356,7 +1370,7 @@ public class TVProgramUtils implements Cloneable { | ||
1356 | 1370 | if (ucon == null) { |
1357 | 1371 | return null; |
1358 | 1372 | } |
1359 | - | |
1373 | + | |
1360 | 1374 | // バッファ作成 |
1361 | 1375 | StringBuilder sb = new StringBuilder(); |
1362 | 1376 | reader = new BufferedReader(new InputStreamReader(ucon.getInputStream(), thisEncoding)); |
@@ -1387,11 +1401,11 @@ public class TVProgramUtils implements Cloneable { | ||
1387 | 1401 | } |
1388 | 1402 | return null; |
1389 | 1403 | } |
1390 | - | |
1404 | + | |
1391 | 1405 | /* |
1392 | 1406 | * File/Bufferの共通部品 |
1393 | 1407 | */ |
1394 | - | |
1408 | + | |
1395 | 1409 | private HttpURLConnection _webToXXX(String uri, String pstr, String cookie, String referer, String thisEncoding) { |
1396 | 1410 | try { |
1397 | 1411 | URL url = new URL(uri); |
@@ -1404,17 +1418,17 @@ public class TVProgramUtils implements Cloneable { | ||
1404 | 1418 | } |
1405 | 1419 | ucon.setConnectTimeout(conntout*1000); |
1406 | 1420 | ucon.setReadTimeout(readtout*1000); |
1407 | - | |
1421 | + | |
1408 | 1422 | ucon.addRequestProperty("User-Agent", getUserAgent()); |
1409 | - | |
1423 | + | |
1410 | 1424 | if ( referer != null ) { |
1411 | 1425 | ucon.addRequestProperty("Referer", referer); |
1412 | 1426 | } |
1413 | - | |
1427 | + | |
1414 | 1428 | if ( cookie != null ) { |
1415 | 1429 | ucon.addRequestProperty("Cookie", cookie); |
1416 | 1430 | } |
1417 | - | |
1431 | + | |
1418 | 1432 | // Cookie処理(CookieManagerはなぜうまく動かないんだ…orz) |
1419 | 1433 | if ( cookie_cache.size() > 0 ) { |
1420 | 1434 | String cStr = ""; |
@@ -1423,7 +1437,7 @@ public class TVProgramUtils implements Cloneable { | ||
1423 | 1437 | } |
1424 | 1438 | ucon.addRequestProperty("Cookie", cStr); |
1425 | 1439 | } |
1426 | - | |
1440 | + | |
1427 | 1441 | if (pstr != null) { |
1428 | 1442 | ucon.setRequestMethod("POST"); |
1429 | 1443 | ucon.setDoOutput(true); |
@@ -1441,7 +1455,7 @@ public class TVProgramUtils implements Cloneable { | ||
1441 | 1455 | writer.flush(); |
1442 | 1456 | writer.close(); |
1443 | 1457 | } |
1444 | - | |
1458 | + | |
1445 | 1459 | // Cookie処理 |
1446 | 1460 | if ( uri.matches(".*dimora.jp.*") || uri.matches(".*\\.yahoo\\.co\\.jp.*") ) { |
1447 | 1461 | List<String> hf = ucon.getHeaderFields().get("Set-Cookie"); |
@@ -1453,18 +1467,18 @@ public class TVProgramUtils implements Cloneable { | ||
1453 | 1467 | } |
1454 | 1468 | } |
1455 | 1469 | } |
1456 | - | |
1470 | + | |
1457 | 1471 | return ucon; |
1458 | - | |
1472 | + | |
1459 | 1473 | } catch (MalformedURLException e) { |
1460 | 1474 | e.printStackTrace(); |
1461 | 1475 | } catch (IOException e) { |
1462 | 1476 | e.printStackTrace(); |
1463 | 1477 | } |
1464 | - | |
1478 | + | |
1465 | 1479 | return null; |
1466 | 1480 | } |
1467 | - | |
1481 | + | |
1468 | 1482 | protected String getCookie(String key) { |
1469 | 1483 | return cookie_cache.get(key); |
1470 | 1484 | } |
@@ -1477,22 +1491,22 @@ public class TVProgramUtils implements Cloneable { | ||
1477 | 1491 | protected void clrCookie() { |
1478 | 1492 | cookie_cache.clear(); |
1479 | 1493 | } |
1480 | - | |
1494 | + | |
1481 | 1495 | // Cookieの情報をキャッシュするよ |
1482 | 1496 | private HashMap<String,String> cookie_cache = new HashMap<String, String>(); |
1483 | - | |
1484 | - | |
1497 | + | |
1498 | + | |
1485 | 1499 | /******************************************************************************* |
1486 | 1500 | * ここから下は該当機能が無効なプラグイン用のダミー |
1487 | 1501 | ******************************************************************************/ |
1488 | - | |
1502 | + | |
1489 | 1503 | public String getTVProgramId() { return "DUMMY"; } |
1490 | - | |
1504 | + | |
1491 | 1505 | public String getDefaultArea() { return "東京"; } |
1492 | - | |
1506 | + | |
1493 | 1507 | // 番組詳細キャッシュファイル名 |
1494 | 1508 | protected String getDetCacheFile() { return ""; } |
1495 | - | |
1509 | + | |
1496 | 1510 | // 番組詳細をattachする |
1497 | 1511 | protected void attachDetails(ArrayList<ProgList> plist, HashMap<String,String> oldcache, HashMap<String,String> newcache) { |
1498 | 1512 | // ダミー |
@@ -1501,5 +1515,5 @@ public class TVProgramUtils implements Cloneable { | ||
1501 | 1515 | // フリーテキストによるオプション指定 |
1502 | 1516 | public boolean setOptString(String s) { return true; } // ダミー |
1503 | 1517 | public String getOptString() { return null; } // ダミー |
1504 | - | |
1518 | + | |
1505 | 1519 | } |
@@ -17,15 +17,17 @@ import javax.swing.WindowConstants; | ||
17 | 17 | public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { |
18 | 18 | |
19 | 19 | private static final long serialVersionUID = 1L; |
20 | - | |
20 | + | |
21 | 21 | private static final int WIN_COLS = 70; |
22 | 22 | private static final int WIN_ROWS = 8; |
23 | 23 | |
24 | 24 | private final JScrollPane jsp = new JScrollPane(); |
25 | 25 | private final JTextArea jta = new JTextAreaWithPopup(); |
26 | - | |
26 | + | |
27 | 27 | private WindowAdapter wl_closing = null; |
28 | - | |
28 | + | |
29 | + private boolean window_close_requested = false; | |
30 | + | |
29 | 31 | /** |
30 | 32 | * 鯛ナビでは1個インスタンスを作ったらずっと使いまわすので自身を返す。まあ、特殊。 |
31 | 33 | */ |
@@ -40,14 +42,14 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
40 | 42 | jta.setColumns(WIN_COLS); |
41 | 43 | jta.setLineWrap(false); |
42 | 44 | jta.setEditable(false); |
43 | - | |
45 | + | |
44 | 46 | jsp.setViewportView(jta); |
45 | 47 | jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); |
46 | 48 | jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); |
47 | - | |
49 | + | |
48 | 50 | return jsp; |
49 | 51 | } |
50 | - | |
52 | + | |
51 | 53 | // デフォルトコンストラクタ |
52 | 54 | public VWStatusWindow() { |
53 | 55 | // |
@@ -55,23 +57,24 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
55 | 57 | // |
56 | 58 | this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); |
57 | 59 | this.setModal(true); |
58 | - | |
60 | + | |
59 | 61 | setClosingEnabled(true); |
60 | - | |
62 | + | |
61 | 63 | this.setContentPane(getJScrollPane()); |
62 | 64 | this.pack(); |
63 | - | |
65 | + | |
64 | 66 | // this.setResizable(false); |
65 | 67 | |
66 | 68 | //this.setLocationRelativeTo(owner); // 画面の真ん中に |
67 | - | |
69 | + | |
68 | 70 | // |
69 | 71 | this.setTitle("タイニー番組ナビゲータ ステータスウィンドウ"); |
70 | 72 | } |
71 | - | |
73 | + | |
72 | 74 | private final WindowAdapter wl_closing_exitdisabled = new WindowAdapter() { |
73 | 75 | @Override |
74 | 76 | public void windowClosing(WindowEvent e) { |
77 | + window_close_requested = true; | |
75 | 78 | jta.append("処理中です。しばらくお待ちください…\n"); |
76 | 79 | } |
77 | 80 | }; |
@@ -79,6 +82,7 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
79 | 82 | private final WindowAdapter wl_closing_exitenabled = new WindowAdapter() { |
80 | 83 | @Override |
81 | 84 | public void windowClosing(WindowEvent e) { |
85 | + window_close_requested = true; | |
82 | 86 | System.out.println("強制終了します。"); |
83 | 87 | System.exit(1); |
84 | 88 | } |
@@ -87,7 +91,7 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
87 | 91 | /* |
88 | 92 | * StatusWindow用のメソッド |
89 | 93 | */ |
90 | - | |
94 | + | |
91 | 95 | public void setClosingEnabled(boolean b) { |
92 | 96 | if ( wl_closing != null ) this.removeWindowListener(wl_closing); |
93 | 97 | if ( b ) { |
@@ -97,30 +101,30 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
97 | 101 | this.addWindowListener(wl_closing = wl_closing_exitdisabled); |
98 | 102 | } |
99 | 103 | } |
100 | - | |
104 | + | |
101 | 105 | @Override |
102 | 106 | public void clear() { |
103 | 107 | jta.setText(""); |
104 | 108 | } |
105 | - | |
109 | + | |
106 | 110 | @Override |
107 | 111 | public void append(String message) { |
108 | 112 | jta.append(message+"\n"); |
109 | 113 | jta.setCaretPosition(jta.getText().length()); |
110 | 114 | } |
111 | - | |
115 | + | |
112 | 116 | @Override |
113 | 117 | public void appendMessage(String message) { |
114 | 118 | this.append(message); |
115 | 119 | System.out.println(message); |
116 | 120 | } |
117 | - | |
121 | + | |
118 | 122 | @Override |
119 | 123 | public void appendError(String message) { |
120 | 124 | this.append(message); |
121 | 125 | System.err.println(message); |
122 | 126 | } |
123 | - | |
127 | + | |
124 | 128 | @Override |
125 | 129 | public void setVisible(boolean b) { |
126 | 130 | try { |
@@ -130,4 +134,14 @@ public class VWStatusWindow extends JDialog implements StatusWindow,Cloneable { | ||
130 | 134 | System.err.println("HOGEHOEG"); |
131 | 135 | } |
132 | 136 | } |
137 | + | |
138 | + /* | |
139 | + * 画面の「×」ボタンが押されたか | |
140 | + */ | |
141 | + @Override | |
142 | + public void setWindowCloseRequested(boolean b){ window_close_requested = b; } | |
143 | + @Override | |
144 | + public boolean isWindowCloseRequested(){ return window_close_requested; } | |
145 | + @Override | |
146 | + public void resetWindowCloseRequested(){ setWindowCloseRequested(false); } | |
133 | 147 | } |
@@ -5,7 +5,7 @@ import java.util.regex.Pattern; | ||
5 | 5 | |
6 | 6 | |
7 | 7 | public class VersionInfo { |
8 | - private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.7"; | |
8 | + private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.8"; | |
9 | 9 | |
10 | 10 | private static final String OSname = System.getProperty("os.name"); |
11 | 11 | private static final String OSvers = System.getProperty("os.version"); |
@@ -47,6 +47,7 @@ import java.util.GregorianCalendar; | ||
47 | 47 | import java.util.HashMap; |
48 | 48 | import java.util.LinkedHashMap; |
49 | 49 | import java.util.ServiceLoader; |
50 | +import java.util.TimeZone; | |
50 | 51 | import java.util.regex.Matcher; |
51 | 52 | import java.util.regex.Pattern; |
52 | 53 |
@@ -145,6 +146,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
145 | 146 | private String pxaddr = null; // ProxyAddress指定 |
146 | 147 | private String pxport = null; // ProxtPort指定 |
147 | 148 | |
149 | + private boolean downloadInProgress = false; // TVプログラムを取得中か | |
148 | 150 | |
149 | 151 | /******************************************************************************* |
150 | 152 | * 定数 |
@@ -1426,7 +1428,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
1426 | 1428 | chdatsetting.updateChannelDatTable(); |
1427 | 1429 | |
1428 | 1430 | // 番組情報の再取得 |
1429 | - loadTVProgram(false,LoadFor.ALL); // 部品呼び出し | |
1431 | + loadTVProgram(false,LoadFor.ALL, false); // 部品呼び出し | |
1430 | 1432 | |
1431 | 1433 | // ツールバーに反映 |
1432 | 1434 | toolBar.setPagerItems(); |
@@ -1924,19 +1926,16 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
1924 | 1926 | |
1925 | 1927 | @Override |
1926 | 1928 | protected boolean doLoadTVProgram(String selected) { |
1927 | - timer_now.pause(); | |
1928 | - | |
1929 | 1929 | LoadFor lf = (selected != null) ? LoadFor.get(selected) : LoadFor.ALL; |
1930 | - boolean b = Viewer.this.doLoadTVProgram(true, lf); | |
1930 | + boolean b = Viewer.this.doLoadTVProgram(true, lf, env.getDownloadProgramInBackground()); | |
1931 | 1931 | |
1932 | 1932 | if ( b && lf == LoadFor.CSwSD ) { |
1933 | 1933 | // ロード後シャットダウン |
1934 | 1934 | CommonUtils.executeCommand(env.getShutdownCmd()); |
1935 | 1935 | } |
1936 | 1936 | |
1937 | - Viewer.this.doRedrawTVProgram(); // か き な お し | |
1937 | +// Viewer.this.doRedrawTVProgram(); // か き な お し | |
1938 | 1938 | |
1939 | - timer_now.start(); | |
1940 | 1939 | return b; |
1941 | 1940 | } |
1942 | 1941 |
@@ -2015,6 +2014,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
2015 | 2014 | public void timerRised(TickTimerRiseEvent e) { |
2016 | 2015 | if (env.getDebug()) System.out.println("Timer Rised: now="+CommonUtils.getDateTimeYMDx(e.getCalendar())); |
2017 | 2016 | setTitleBar(); |
2017 | + checkDownloadProgramTime(e.getCalendar()); | |
2018 | 2018 | } |
2019 | 2019 | |
2020 | 2020 |
@@ -3792,18 +3792,41 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3792 | 3792 | * <P>部品実行の場合はこちらを呼び出す:{@link #loadTVProgram(boolean, LoadFor)} |
3793 | 3793 | * @see #doRedrawTVProgram() |
3794 | 3794 | */ |
3795 | - private boolean doLoadTVProgram(final boolean force, final LoadFor lf) { | |
3795 | + private boolean doLoadTVProgram(final boolean force, final LoadFor lf, boolean background) { | |
3796 | + if (downloadInProgress){ | |
3797 | + mwin.appendError("[Web番組表取得]実行中の取得処理を中止します。"); | |
3798 | + TVProgramUtils.setCancelRequested(true); | |
3799 | + return false; | |
3800 | + } | |
3801 | + | |
3802 | + if (force){ | |
3803 | + GregorianCalendar c = new GregorianCalendar(); | |
3804 | + c.setTimeZone(TimeZone.getDefault()); | |
3805 | + | |
3806 | + if (env != null){ | |
3807 | + env.setLastDownloadTime(CommonUtils.getCalendarAsString(c)); | |
3808 | + env.save(); | |
3809 | + } | |
3810 | + } | |
3811 | + | |
3796 | 3812 | // |
3797 | - StWinClear(); | |
3813 | + downloadInProgress = true; | |
3814 | + toolBar.setReloadTVProgramsInProgress(true); | |
3815 | + | |
3816 | + if (background){ | |
3817 | + TVProgramUtils.setProgressAreaBackground(mwin); | |
3818 | + } | |
3819 | + else{ | |
3820 | + StWinClear(); | |
3821 | + } | |
3798 | 3822 | |
3799 | 3823 | new SwingBackgroundWorker(false) { |
3800 | 3824 | |
3801 | 3825 | @Override |
3802 | 3826 | protected Object doWorks() throws Exception { |
3803 | - | |
3804 | 3827 | TatCount tc = new TatCount(); |
3805 | 3828 | |
3806 | - loadTVProgram(force, lf); | |
3829 | + loadTVProgram(force, lf, background); | |
3807 | 3830 | |
3808 | 3831 | mwin.appendMessage(String.format("[Web番組表取得] 【完了しました】 所要時間: %.2f秒",tc.end())); |
3809 | 3832 | return null; |
@@ -3811,12 +3834,26 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3811 | 3834 | |
3812 | 3835 | @Override |
3813 | 3836 | protected void doFinally() { |
3814 | - StWinSetVisible(false); | |
3837 | + timer_now.pause(); | |
3838 | + | |
3839 | + if (background){ | |
3840 | + TVProgramUtils.setProgressAreaBackground(null); | |
3841 | + } | |
3842 | + else{ | |
3843 | + StWinSetVisible(false); | |
3844 | + } | |
3845 | + downloadInProgress = false; | |
3846 | + toolBar.setReloadTVProgramsInProgress(false); | |
3847 | + doRedrawTVProgram(); | |
3848 | + | |
3849 | + timer_now.start(); | |
3815 | 3850 | } |
3816 | 3851 | }.execute(); |
3817 | 3852 | |
3818 | - StWinSetLocationCenter(this); | |
3819 | - StWinSetVisible(true); | |
3853 | + if (!background){ | |
3854 | + StWinSetLocationCenter(this); | |
3855 | + StWinSetVisible(true); | |
3856 | + } | |
3820 | 3857 | |
3821 | 3858 | return true; |
3822 | 3859 | } |
@@ -3847,56 +3884,87 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3847 | 3884 | * 自クラス内呼び出しによる |
3848 | 3885 | **************************************/ |
3849 | 3886 | |
3887 | + /* | |
3888 | + * Web番組表のDLの進捗を報告する | |
3889 | + */ | |
3890 | + private void reportTVProgramProgress(String msg){ | |
3891 | + TVProgramUtils.reportProgress(msg); | |
3892 | + } | |
3893 | + | |
3850 | 3894 | /** |
3851 | 3895 | * Web番組表をDLする |
3852 | 3896 | * <P>単体実行の場合はこちらを呼び出す:{@link #doLoadTVProgram(boolean, tainavi.Viewer.LoadFor)} |
3853 | 3897 | * <P>部品実行の場合はこちらを呼び出す |
3854 | 3898 | */ |
3855 | - private boolean loadTVProgram(final boolean force, final LoadFor lf) { | |
3899 | + private boolean loadTVProgram(final boolean force, final LoadFor lf, boolean background) { | |
3856 | 3900 | |
3857 | 3901 | final String FUNCID = "[Web番組表取得] "; |
3858 | 3902 | final String ERRID = "[ERROR]"+FUNCID; |
3859 | 3903 | |
3860 | 3904 | try { |
3905 | + stwin.resetWindowCloseRequested(); | |
3906 | + TVProgramUtils.setCancelRequested(false); | |
3907 | + | |
3861 | 3908 | String msg; |
3862 | 3909 | TVProgram tvp; |
3863 | 3910 | |
3911 | + if (TVProgramUtils.isCancelRequested()){ | |
3912 | + return false; | |
3913 | + } | |
3914 | + | |
3864 | 3915 | tvp = tvprograms.getTvProgPlugin(null); |
3865 | 3916 | if ( tvp != null ) |
3866 | 3917 | { |
3867 | 3918 | String sType = "地上波&BS番組表"; |
3868 | 3919 | if (lf == LoadFor.ALL || lf == LoadFor.TERRA) { |
3869 | - loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force); | |
3920 | + if (!loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force)){ | |
3921 | + return false; | |
3922 | + } | |
3870 | 3923 | } |
3871 | 3924 | else { |
3872 | - stwin.appendMessage(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3925 | + reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3873 | 3926 | } |
3874 | 3927 | } |
3875 | 3928 | |
3929 | + if (TVProgramUtils.isCancelRequested()){ | |
3930 | + return false; | |
3931 | + } | |
3876 | 3932 | tvp = tvprograms.getCsProgPlugin(null); |
3877 | 3933 | if ( tvp != null ) |
3878 | 3934 | { |
3879 | 3935 | String sType = "CS番組表[プライマリ]"; |
3880 | 3936 | if (lf == LoadFor.ALL || lf == LoadFor.CS || lf == LoadFor.CSo1 || lf == LoadFor.CSwSD) { |
3881 | - loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force); | |
3937 | + if (!loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force)){ | |
3938 | + return false; | |
3939 | + } | |
3882 | 3940 | } |
3883 | 3941 | else { |
3884 | - stwin.appendMessage(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3942 | + reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3885 | 3943 | } |
3886 | 3944 | } |
3887 | 3945 | |
3946 | + if (TVProgramUtils.isCancelRequested()){ | |
3947 | + return false; | |
3948 | + } | |
3949 | + | |
3888 | 3950 | tvp = tvprograms.getCs2ProgPlugin(null); |
3889 | 3951 | if ( tvp != null ) |
3890 | 3952 | { |
3891 | 3953 | String sType = "CS番組表[セカンダリ]"; |
3892 | 3954 | if (lf == LoadFor.ALL || lf == LoadFor.CS || lf == LoadFor.CSo2 || lf == LoadFor.CSwSD) { |
3893 | - loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force); | |
3955 | + if (!loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force)){ | |
3956 | + return false; | |
3957 | + } | |
3894 | 3958 | } |
3895 | 3959 | else { |
3896 | - stwin.appendMessage(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3960 | + reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); | |
3897 | 3961 | } |
3898 | 3962 | } |
3899 | 3963 | |
3964 | + if (TVProgramUtils.isCancelRequested()){ | |
3965 | + return false; | |
3966 | + } | |
3967 | + | |
3900 | 3968 | tvp = tvprograms.getSyobo(); |
3901 | 3969 | if ( tvp != null ) { |
3902 | 3970 | String sType = "しょぼかる"; |
@@ -3905,13 +3973,17 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3905 | 3973 | loadTVProgramOnce(tvp, sType, null, true, force); |
3906 | 3974 | } |
3907 | 3975 | else { |
3908 | - stwin.appendMessage(FUNCID+sType+"へのアクセスはスキップされました."); | |
3976 | + reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました."); | |
3909 | 3977 | } |
3910 | 3978 | |
3911 | 3979 | // しょぼかるの新番組マークを引き継ぐ |
3912 | 3980 | attachSyoboNew(); |
3913 | 3981 | } |
3914 | 3982 | |
3983 | + if (TVProgramUtils.isCancelRequested()){ | |
3984 | + return false; | |
3985 | + } | |
3986 | + | |
3915 | 3987 | PickedProgram pickup = tvprograms.getPickup(); |
3916 | 3988 | if ( tvp != null ) { |
3917 | 3989 | pickup.refresh(); |
@@ -3923,23 +3995,26 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3923 | 3995 | fixDetail(); |
3924 | 3996 | |
3925 | 3997 | // 検索結果の再構築 |
3926 | - stwin.appendMessage(FUNCID+"検索結果を生成します."); | |
3998 | + reportTVProgramProgress(FUNCID+"検索結果を生成します."); | |
3927 | 3999 | mpList.clear(env.getDisableFazzySearch(), env.getDisableFazzySearchReverse()); |
3928 | 4000 | mpList.build(tvprograms, trKeys.getTraceKeys(), srKeys.getSearchKeys()); |
3929 | 4001 | |
3930 | 4002 | // 過去ローグ |
3931 | - if ( env.getUsePassedProgram() ) { | |
4003 | + if ( !env.getUsePassedProgram()) { | |
4004 | + reportTVProgramProgress(FUNCID+"過去ログは記録されません."); | |
4005 | + } | |
4006 | + else if (!force){ | |
4007 | + reportTVProgramProgress(FUNCID+"キャッシュからの読み込み時は過去ログは記録されません."); | |
4008 | + } | |
4009 | + else { | |
3932 | 4010 | TatCount tc = new TatCount(); |
3933 | - stwin.appendMessage(FUNCID+"過去ログを生成します."); | |
4011 | + reportTVProgramProgress(FUNCID+"過去ログを生成します."); | |
3934 | 4012 | if ( tvprograms.getPassed().save(tvprograms.getIterator(), chsort.getClst(), env.getPrepPassedProgramCount()) ) { |
3935 | 4013 | msg = String.format(FUNCID+"過去ログを生成しました [%.2f秒].",tc.end()); |
3936 | - StdAppendMessage(msg); | |
4014 | + reportTVProgramProgress(msg); | |
3937 | 4015 | } |
3938 | 4016 | //PassedProgramList.getDateList(env.getPassedLogLimit()); |
3939 | 4017 | } |
3940 | - else { | |
3941 | - stwin.appendMessage(FUNCID+"過去ログは記録されません."); | |
3942 | - } | |
3943 | 4018 | } |
3944 | 4019 | catch (Exception e) { |
3945 | 4020 | e.printStackTrace(); |
@@ -3952,22 +4027,25 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3952 | 4027 | } |
3953 | 4028 | |
3954 | 4029 | // 分割 |
3955 | - private void loadTVProgramOnce(TVProgram tvp, String sType, String aName, boolean loadonly, boolean force) { | |
4030 | + private boolean loadTVProgramOnce(TVProgram tvp, String sType, String aName, boolean loadonly, boolean force) { | |
3956 | 4031 | |
3957 | 4032 | final String FUNCID = "[Web番組表取得] "; |
3958 | 4033 | // final String ERRID = "[ERROR]"+FUNCID; |
3959 | 4034 | |
3960 | 4035 | // ログ |
3961 | 4036 | String msg = FUNCID+sType+"を取得します: "+tvp.getTVProgramId(); |
3962 | - stwin.appendMessage(msg); | |
3963 | - if (aName!=null) stwin.appendMessage(FUNCID+"+選択されているエリア="+aName); | |
4037 | + reportTVProgramProgress(msg); | |
4038 | + if (aName!=null) reportTVProgramProgress(FUNCID+"+選択されているエリア="+aName); | |
3964 | 4039 | |
3965 | 4040 | // 読み込み |
3966 | 4041 | //tvp.setProgressArea(stwin); |
3967 | - tvp.loadProgram(tvp.getSelectedCode(), force); | |
4042 | + if (!tvp.loadProgram(tvp.getSelectedCode(), force)){ | |
4043 | + if (mwin!=null) mwin.appendMessage(FUNCID+"番組情報の取得に失敗しました。"); | |
4044 | + return false; | |
4045 | + } | |
3968 | 4046 | |
3969 | 4047 | if (loadonly) { |
3970 | - return; | |
4048 | + return true; | |
3971 | 4049 | } |
3972 | 4050 | |
3973 | 4051 | // 延長警告 |
@@ -3977,10 +4055,14 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3977 | 4055 | // 抜けチェック |
3978 | 4056 | String errmsg = tvp.chkComplete(); |
3979 | 4057 | if (errmsg != null) { |
3980 | - stwin.appendError(FUNCID+"取得した情報が不正です:"+errmsg); | |
4058 | + msg = FUNCID+"取得した情報が不正です:"+errmsg; | |
4059 | + reportTVProgramProgress(msg); | |
3981 | 4060 | if (mainWindow!=null) mwin.appendMessage(msg); |
3982 | 4061 | ringBeep(); |
4062 | + return false; | |
3983 | 4063 | } |
4064 | + | |
4065 | + return true; | |
3984 | 4066 | } |
3985 | 4067 | |
3986 | 4068 | // しょぼかるの番組詳細を番組表に反映する |
@@ -4456,7 +4538,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4456 | 4538 | |
4457 | 4539 | // 番組情報の再取得 |
4458 | 4540 | if ( reload_prog ) { |
4459 | - loadTVProgram(false, LoadFor.ALL); // 部品呼び出し | |
4541 | + loadTVProgram(false, LoadFor.ALL, false); // 部品呼び出し | |
4460 | 4542 | } |
4461 | 4543 | |
4462 | 4544 | // Web番組表の再構築 |
@@ -5517,6 +5599,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5517 | 5599 | final String SELECT_ACTION_RECEDTAB = "recedtab"; |
5518 | 5600 | final String SELECT_ACTION_AUTORESTAB = "autorestab"; |
5519 | 5601 | final String SELECT_ACTION_TITLETAB = "titletab"; |
5602 | + final String SELECT_ACTION_SETTINGTAB = "settingtab"; | |
5520 | 5603 | |
5521 | 5604 | final String BUTTON_ACTION_KEYWORD_ADDED = "keyword_added"; |
5522 | 5605 | final String BUTTON_ACTION_RELOAD_PROGRAM = "reload_program"; |
@@ -5581,6 +5664,12 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5581 | 5664 | mainWindow.setSelectedTab(MWinTab.TITLED); |
5582 | 5665 | } |
5583 | 5666 | }; |
5667 | + final Action select_action_settingtab = new AbstractAction() { | |
5668 | + @Override | |
5669 | + public void actionPerformed(ActionEvent e) { | |
5670 | + mainWindow.setSelectedTab(MWinTab.SETTING); | |
5671 | + } | |
5672 | + }; | |
5584 | 5673 | |
5585 | 5674 | final Action sc_keyword_added = new AbstractAction() { |
5586 | 5675 | @Override |
@@ -5720,6 +5809,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5720 | 5809 | sca.add(new ShortCut(SELECT_ACTION_RECEDTAB, KeyEvent.VK_4, KeyEvent.ALT_DOWN_MASK, select_action_recedtab)); |
5721 | 5810 | sca.add(new ShortCut(SELECT_ACTION_AUTORESTAB, KeyEvent.VK_5, KeyEvent.ALT_DOWN_MASK, select_action_autorestab)); |
5722 | 5811 | sca.add(new ShortCut(SELECT_ACTION_TITLETAB, KeyEvent.VK_6, KeyEvent.ALT_DOWN_MASK, select_action_titletab)); |
5812 | + sca.add(new ShortCut(SELECT_ACTION_SETTINGTAB, KeyEvent.VK_7, KeyEvent.ALT_DOWN_MASK, select_action_settingtab)); | |
5723 | 5813 | |
5724 | 5814 | sca.add(new ShortCut(BUTTON_ACTION_KEYWORD_ADDED, KeyEvent.VK_K, KeyEvent.CTRL_DOWN_MASK, sc_keyword_added)); |
5725 | 5815 |
@@ -5778,6 +5868,40 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5778 | 5868 | } |
5779 | 5869 | } |
5780 | 5870 | |
5871 | + private void checkDownloadProgramTime( GregorianCalendar gc){ | |
5872 | + if (! env.getDownloadProgramOnFixedTime()) | |
5873 | + return; | |
5874 | + | |
5875 | + GregorianCalendar c = (GregorianCalendar)gc.clone(); | |
5876 | + c.setTimeZone(TimeZone.getDefault()); | |
5877 | + | |
5878 | + String timeLast = "00:00"; | |
5879 | + GregorianCalendar cl = CommonUtils.getCalendarFromString(env.getLastDownloadTime()); | |
5880 | + | |
5881 | + if (cl != null){ | |
5882 | + if (cl.get(Calendar.DAY_OF_YEAR) == c.get(Calendar.DAY_OF_YEAR) && | |
5883 | + cl.get(Calendar.HOUR_OF_DAY) == c.get(Calendar.HOUR_OF_DAY) && | |
5884 | + cl.get(Calendar.MINUTE) == c.get(Calendar.MINUTE)){ | |
5885 | + return; | |
5886 | + } | |
5887 | + | |
5888 | + if (cl.get(Calendar.DAY_OF_YEAR) == c.get(Calendar.DAY_OF_YEAR)) | |
5889 | + timeLast = String.format("%02d:%02d", cl.get(Calendar.HOUR_OF_DAY), cl.get(Calendar.MINUTE)); | |
5890 | + } | |
5891 | + | |
5892 | + String timeNow = String.format("%02d:%02d", c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE)); | |
5893 | + | |
5894 | + for (String time : env.getDownloadProgramTimeList().split(";")){ | |
5895 | + if (time.compareTo(timeLast) <= 0) | |
5896 | + continue; | |
5897 | + | |
5898 | + if (time.compareTo(timeNow) <= 0){ | |
5899 | + doLoadTVProgram(true, LoadFor.ALL, env.getDownloadProgramInBackground()); | |
5900 | + return; | |
5901 | + } | |
5902 | + } | |
5903 | + } | |
5904 | + | |
5781 | 5905 | /******************************************************************************* |
5782 | 5906 | * main() |
5783 | 5907 | ******************************************************************************/ |
@@ -5968,7 +6092,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5968 | 6092 | // 検索結果リストの初期化(loadTVProgram()中で使うので) |
5969 | 6093 | initMpList(); |
5970 | 6094 | // データのロード |
5971 | - loadTVProgram(true,LoadFor.ALL); | |
6095 | + loadTVProgram(true,LoadFor.ALL, false); | |
5972 | 6096 | stwin.appendMessage("番組表を取得したので終了します"); |
5973 | 6097 | CommonUtils.milSleep(3000); |
5974 | 6098 | System.exit(1); |
@@ -5993,7 +6117,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5993 | 6117 | initMpList(); |
5994 | 6118 | |
5995 | 6119 | // データのロード |
5996 | - loadTVProgram(false,LoadFor.ALL); | |
6120 | + loadTVProgram(false,LoadFor.ALL, false); | |
5997 | 6121 | |
5998 | 6122 | // 放送局の並び順もロード |
5999 | 6123 | chsort.load(); |
@@ -75,26 +75,39 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
75 | 75 | * 番組情報を取得する |
76 | 76 | ******************************************************************************/ |
77 | 77 | @Override |
78 | - public void loadProgram(String areaCode, boolean force) { | |
78 | + public boolean loadProgram(String areaCode, boolean force) { | |
79 | 79 | |
80 | 80 | // 入れ物を空にする |
81 | - newplist.clear(); | |
81 | + newplist = new ArrayList<ProgList>(); | |
82 | 82 | nf.clear(); |
83 | 83 | |
84 | 84 | // |
85 | 85 | int counterMax = getSortedCRlist().size(); |
86 | 86 | int counter=1; |
87 | 87 | for ( Center c : getSortedCRlist() ) { |
88 | - _loadProgram(c, force, counter++, counterMax); | |
88 | + if (!_loadProgram(c, force, counter++, counterMax)){ | |
89 | + newplist = null; | |
90 | + return false; | |
91 | + } | |
92 | + | |
93 | + if (isCancelRequested()){ | |
94 | + reportProgress(ERRID+"中止要求があったので番組表の取得にを中止します。"); | |
95 | + newplist = null; | |
96 | + return false; | |
97 | + } | |
89 | 98 | } |
90 | 99 | |
91 | 100 | debugNF(); |
92 | 101 | |
93 | 102 | // 古い番組データを置き換える |
103 | + if (pcenter != null) | |
104 | + pcenter.clear(); | |
94 | 105 | pcenter = newplist; |
106 | + newplist = null; | |
107 | + return true; | |
95 | 108 | } |
96 | 109 | |
97 | - private void _loadProgram(Center cr, boolean force, int counter, int counterMax) { | |
110 | + private boolean _loadProgram(Center cr, boolean force, int counter, int counterMax) { | |
98 | 111 | // |
99 | 112 | try { |
100 | 113 | // 局リストの追加 |
@@ -129,7 +142,7 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
129 | 142 | |
130 | 143 | response = webToBuffer(url, thisEncoding, true); |
131 | 144 | if ( response == null ) { |
132 | - return; | |
145 | + return false; | |
133 | 146 | } |
134 | 147 | CommonUtils.write2file(progCacheFile, response); |
135 | 148 |
@@ -141,14 +154,14 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
141 | 154 | else if (f.exists()) { |
142 | 155 | response = CommonUtils.read4file(progCacheFile, true); |
143 | 156 | if ( response == null ) { |
144 | - return; | |
157 | + return false; | |
145 | 158 | } |
146 | 159 | |
147 | 160 | reportProgress(String.format("%s (キャッシュ)を取得しました: (%d/%d) %s %s",getTVProgramId(),counter,counterMax,pl.Center,progCacheFile)); |
148 | 161 | } |
149 | 162 | else { |
150 | 163 | reportProgress(String.format("%s (キャッシュ)がみつかりません: (%d/%d) %s %s",getTVProgramId(),counter,counterMax,pl.Center,progCacheFile)); |
151 | - return; | |
164 | + return false; | |
152 | 165 | } |
153 | 166 | |
154 | 167 | // 日付リストの追加 |
@@ -164,7 +177,10 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
164 | 177 | // 例外 |
165 | 178 | System.out.println("Exception: _loadProgram()"); |
166 | 179 | e.printStackTrace(); |
180 | + return false; | |
167 | 181 | } |
182 | + | |
183 | + return true; | |
168 | 184 | } |
169 | 185 | |
170 | 186 | // |
@@ -8,24 +8,22 @@ import tainavi.Center; | ||
8 | 8 | import tainavi.CommonUtils; |
9 | 9 | import tainavi.ProgList; |
10 | 10 | import tainavi.TVProgram; |
11 | -import tainavi.TVProgram.ProgSubtype; | |
12 | -import tainavi.TVProgram.ProgType; | |
13 | 11 | |
14 | 12 | |
15 | 13 | |
16 | 14 | public class PlugIn_CSPtheTelevisionA extends PlugIn_TVPtheTelevision implements TVProgram,Cloneable { |
17 | 15 | |
18 | 16 | final String thisEncoding = "UTF-8"; |
19 | - | |
17 | + | |
20 | 18 | /* 必須コード - ここから */ |
21 | - | |
19 | + | |
22 | 20 | // 種族の特性 |
23 | 21 | @Override |
24 | 22 | public String getTVProgramId() { return "webザテレビジョン(CSアナ)"; } |
25 | - | |
23 | + | |
26 | 24 | @Override |
27 | 25 | public boolean isAreaSelectSupported() { return false; } |
28 | - | |
26 | + | |
29 | 27 | @Override |
30 | 28 | public ProgType getType() { return ProgType.PROG; } |
31 | 29 | @Override |
@@ -39,38 +37,39 @@ public class PlugIn_CSPtheTelevisionA extends PlugIn_TVPtheTelevision implements | ||
39 | 37 | private final String MSGID = "["+getTVProgramId()+"] "; |
40 | 38 | private final String ERRID = "[ERROR]"+MSGID; |
41 | 39 | private final String DBGID = "[DEBUG]"+MSGID; |
42 | - | |
40 | + | |
43 | 41 | // |
44 | - public void loadProgram(String areaCode, boolean force) { | |
45 | - | |
42 | + public boolean loadProgram(String areaCode, boolean force) { | |
43 | + | |
46 | 44 | // 新しい入れ物(トップ)を用意する |
47 | 45 | newplist = new ArrayList<ProgList>(); |
48 | - | |
46 | + | |
49 | 47 | // |
50 | 48 | int counterMax = getSortedCRlist().size(); |
51 | 49 | int counter=1; |
52 | 50 | for ( Center c : getSortedCRlist() ) { |
53 | 51 | _loadProgram(c, force, counter++, counterMax); |
54 | 52 | } |
55 | - | |
53 | + | |
56 | 54 | // 古い番組データを置き換える |
57 | 55 | pcenter = newplist; |
56 | + return true; | |
58 | 57 | } |
59 | - | |
60 | - | |
58 | + | |
59 | + | |
61 | 60 | /* |
62 | 61 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
63 | 62 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここから ★★★★★ |
64 | 63 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
65 | 64 | */ |
66 | - | |
65 | + | |
67 | 66 | /* |
68 | 67 | * 公開メソッド |
69 | 68 | */ |
70 | - | |
69 | + | |
71 | 70 | public String getDefaultArea() {return "全国";} |
72 | 71 | public String getDefaultCode() {return "tokyo";} |
73 | - | |
72 | + | |
74 | 73 | public void loadAreaCode() { |
75 | 74 | aclist = new ArrayList<AreaCode>(); |
76 | 75 | AreaCode ac = new AreaCode(); |
@@ -80,55 +79,55 @@ public class PlugIn_CSPtheTelevisionA extends PlugIn_TVPtheTelevision implements | ||
80 | 79 | aclist.add(ac); |
81 | 80 | } |
82 | 81 | public void saveAreaCode() {} |
83 | - | |
82 | + | |
84 | 83 | public String getArea(String code) { return(getDefaultArea()); } |
85 | 84 | public String getCode(String area) { return(getDefaultCode()); } |
86 | 85 | public String setSelectedAreaByName(String area) { return(getDefaultCode()); } |
87 | 86 | public String getSelectedArea() { return(getDefaultArea()); } |
88 | 87 | public String getSelectedCode() { return(getDefaultCode()); } |
89 | - | |
88 | + | |
90 | 89 | /* |
91 | 90 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
92 | 91 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここまで ★★★★★ |
93 | 92 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
94 | 93 | */ |
95 | - | |
96 | - | |
97 | - | |
94 | + | |
95 | + | |
96 | + | |
98 | 97 | /* |
99 | 98 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
100 | 99 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここから ★★★★★ |
101 | 100 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
102 | 101 | */ |
103 | - | |
102 | + | |
104 | 103 | /* |
105 | 104 | * 公開メソッド |
106 | 105 | */ |
107 | 106 | |
108 | 107 | // 設定ファイルがなければWebから取得 |
109 | 108 | public void loadCenter(String code, boolean force) { |
110 | - | |
109 | + | |
111 | 110 | if ( code == null ) { |
112 | 111 | System.out.println(ERRID+"地域コードがnullです."); |
113 | 112 | return; |
114 | 113 | } |
115 | - | |
114 | + | |
116 | 115 | String centerListFile = getCenterListFile(getTVProgramId(), code); |
117 | - | |
116 | + | |
118 | 117 | if (force) { |
119 | 118 | File f = new File(centerListFile); |
120 | 119 | f.delete(); |
121 | 120 | } |
122 | - | |
121 | + | |
123 | 122 | File f = new File(centerListFile); |
124 | 123 | if (f.exists() == true) { |
125 | 124 | @SuppressWarnings("unchecked") |
126 | 125 | ArrayList<Center> tmp = (ArrayList<Center>) CommonUtils.readXML(centerListFile); |
127 | 126 | if ( tmp != null ) { |
128 | - | |
127 | + | |
129 | 128 | crlist = tmp; |
130 | 129 | attachChFilters(); // 放送局名変換 |
131 | - | |
130 | + | |
132 | 131 | System.out.println("放送局リストを読み込みました: "+centerListFile); |
133 | 132 | return; |
134 | 133 | } |
@@ -136,15 +135,15 @@ public class PlugIn_CSPtheTelevisionA extends PlugIn_TVPtheTelevision implements | ||
136 | 135 | System.err.println("放送局リストの読み込みに失敗しました: "+centerListFile); |
137 | 136 | } |
138 | 137 | } |
139 | - | |
138 | + | |
140 | 139 | // Web上から放送局の一覧を取得する |
141 | 140 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
142 | - | |
141 | + | |
143 | 142 | String url = "http://www.television.co.jp/programlist/guide.php?type=cs&page=1"; |
144 | 143 | if ( _loadCenter(newcrlist, code,"csa",url) ) { |
145 | 144 | reportProgress("放送局情報を取得しました: (1/1) "+url); |
146 | 145 | } |
147 | - | |
146 | + | |
148 | 147 | if ( newcrlist.size() == 0 ) { |
149 | 148 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
150 | 149 | return; |
@@ -162,12 +161,12 @@ public class PlugIn_CSPtheTelevisionA extends PlugIn_TVPtheTelevision implements | ||
162 | 161 | } |
163 | 162 | tmpcrlist.add(idx, cr); |
164 | 163 | } |
165 | - | |
164 | + | |
166 | 165 | crlist = tmpcrlist; |
167 | 166 | attachChFilters(); // 放送局名変換 |
168 | 167 | saveCenter(); |
169 | 168 | } |
170 | - | |
169 | + | |
171 | 170 | /* |
172 | 171 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
173 | 172 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここまで ★★★★★ |
@@ -8,24 +8,22 @@ import tainavi.Center; | ||
8 | 8 | import tainavi.CommonUtils; |
9 | 9 | import tainavi.ProgList; |
10 | 10 | import tainavi.TVProgram; |
11 | -import tainavi.TVProgram.ProgSubtype; | |
12 | -import tainavi.TVProgram.ProgType; | |
13 | 11 | |
14 | 12 | |
15 | 13 | |
16 | 14 | public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements TVProgram,Cloneable { |
17 | 15 | |
18 | 16 | final String thisEncoding = "UTF-8"; |
19 | - | |
17 | + | |
20 | 18 | /* 必須コード - ここから */ |
21 | - | |
19 | + | |
22 | 20 | // 種族の特性 |
23 | 21 | @Override |
24 | 22 | public String getTVProgramId() { return "webザテレビジョン(CSデジ)"; } |
25 | - | |
23 | + | |
26 | 24 | @Override |
27 | 25 | public boolean isAreaSelectSupported() { return false; } |
28 | - | |
26 | + | |
29 | 27 | @Override |
30 | 28 | public ProgType getType() { return ProgType.PROG; } |
31 | 29 | public ProgSubtype getSubtype() { return ProgSubtype.CS2; } |
@@ -38,10 +36,10 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
38 | 36 | private final String MSGID = "["+getTVProgramId()+"] "; |
39 | 37 | private final String ERRID = "[ERROR]"+MSGID; |
40 | 38 | private final String DBGID = "[DEBUG]"+MSGID; |
41 | - | |
39 | + | |
42 | 40 | // |
43 | - public void loadProgram(String areaCode, boolean force) { | |
44 | - | |
41 | + public boolean loadProgram(String areaCode, boolean force) { | |
42 | + | |
45 | 43 | // 新しい入れ物(トップ)を用意する |
46 | 44 | newplist = new ArrayList<ProgList>(); |
47 | 45 |
@@ -51,25 +49,26 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
51 | 49 | for ( Center c : getSortedCRlist() ) { |
52 | 50 | _loadProgram(c, force, counter++, counterMax); |
53 | 51 | } |
54 | - | |
52 | + | |
55 | 53 | // 古い番組データを置き換える |
56 | 54 | pcenter = newplist; |
55 | + return true; | |
57 | 56 | } |
58 | - | |
59 | - | |
57 | + | |
58 | + | |
60 | 59 | /* |
61 | 60 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
62 | 61 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここから ★★★★★ |
63 | 62 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
64 | 63 | */ |
65 | - | |
64 | + | |
66 | 65 | /* |
67 | 66 | * 公開メソッド |
68 | 67 | */ |
69 | - | |
68 | + | |
70 | 69 | public String getDefaultArea() {return "全国";} |
71 | 70 | public String getDefaultCode() {return "tokyo";} |
72 | - | |
71 | + | |
73 | 72 | public void loadAreaCode() { |
74 | 73 | aclist = new ArrayList<AreaCode>(); |
75 | 74 | AreaCode ac = new AreaCode(); |
@@ -79,55 +78,55 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
79 | 78 | aclist.add(ac); |
80 | 79 | } |
81 | 80 | public void saveAreaCode() {} |
82 | - | |
81 | + | |
83 | 82 | public String getArea(String code) { return(getDefaultArea()); } |
84 | 83 | public String getCode(String area) { return(getDefaultCode()); } |
85 | 84 | public String setSelectedAreaByName(String area) { return(getDefaultCode()); } |
86 | 85 | public String getSelectedArea() { return(getDefaultArea()); } |
87 | 86 | public String getSelectedCode() { return(getDefaultCode()); } |
88 | - | |
87 | + | |
89 | 88 | /* |
90 | 89 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
91 | 90 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここまで ★★★★★ |
92 | 91 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
93 | 92 | */ |
94 | - | |
95 | - | |
96 | - | |
93 | + | |
94 | + | |
95 | + | |
97 | 96 | /* |
98 | 97 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
99 | 98 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここから ★★★★★ |
100 | 99 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
101 | 100 | */ |
102 | - | |
101 | + | |
103 | 102 | /* |
104 | 103 | * 公開メソッド |
105 | 104 | */ |
106 | 105 | |
107 | 106 | // 設定ファイルがなければWebから取得 |
108 | 107 | public void loadCenter(String code, boolean force) { |
109 | - | |
108 | + | |
110 | 109 | if ( code == null ) { |
111 | 110 | System.out.println(ERRID+"地域コードがnullです."); |
112 | 111 | return; |
113 | 112 | } |
114 | - | |
113 | + | |
115 | 114 | String centerListFile = getCenterListFile(getTVProgramId(), code); |
116 | - | |
115 | + | |
117 | 116 | if (force) { |
118 | 117 | File f = new File(centerListFile); |
119 | 118 | f.delete(); |
120 | 119 | } |
121 | - | |
120 | + | |
122 | 121 | File f = new File(centerListFile); |
123 | 122 | if (f.exists() == true) { |
124 | 123 | @SuppressWarnings("unchecked") |
125 | 124 | ArrayList<Center> tmp = (ArrayList<Center>) CommonUtils.readXML(centerListFile); |
126 | 125 | if ( tmp != null ) { |
127 | - | |
126 | + | |
128 | 127 | crlist = tmp; |
129 | 128 | attachChFilters(); // 放送局名変換 |
130 | - | |
129 | + | |
131 | 130 | System.out.println("放送局リストを読み込みました: "+centerListFile); |
132 | 131 | return; |
133 | 132 | } |
@@ -135,15 +134,15 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
135 | 134 | System.out.println("放送局リストの読み込みに失敗しました: "+centerListFile); |
136 | 135 | } |
137 | 136 | } |
138 | - | |
137 | + | |
139 | 138 | // Web上から放送局の一覧を取得する |
140 | 139 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
141 | - | |
140 | + | |
142 | 141 | String url = "http://www.television.co.jp/digitalguide/guide.php?type=cs&page=1"; |
143 | 142 | if ( _loadCenter(newcrlist, code,"csd",url) ) { |
144 | 143 | reportProgress("放送局情報を取得しました: (1/1) "+url); |
145 | 144 | } |
146 | - | |
145 | + | |
147 | 146 | if ( newcrlist.size() == 0 ) { |
148 | 147 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
149 | 148 | return; |
@@ -161,12 +160,12 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
161 | 160 | } |
162 | 161 | tmpcrlist.add(idx, cr); |
163 | 162 | } |
164 | - | |
163 | + | |
165 | 164 | crlist = tmpcrlist; |
166 | 165 | attachChFilters(); // 放送局名変換 |
167 | 166 | saveCenter(); |
168 | 167 | } |
169 | - | |
168 | + | |
170 | 169 | /* |
171 | 170 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
172 | 171 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここまで ★★★★★ |
@@ -26,78 +26,78 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
26 | 26 | public PlugIn_TVPDimora clone() { |
27 | 27 | return (PlugIn_TVPDimora) super.clone(); |
28 | 28 | } |
29 | - | |
29 | + | |
30 | 30 | private static final String thisEncoding = "UTF-8"; |
31 | - | |
32 | - | |
31 | + | |
32 | + | |
33 | 33 | /******************************************************************************* |
34 | 34 | * 種族の特性 |
35 | 35 | ******************************************************************************/ |
36 | - | |
36 | + | |
37 | 37 | @Override |
38 | 38 | public String getTVProgramId() { return "Dimora"; } |
39 | - | |
39 | + | |
40 | 40 | @Override |
41 | 41 | public ProgType getType() { return ProgType.PROG; } |
42 | 42 | @Override |
43 | 43 | public ProgSubtype getSubtype() { return ProgSubtype.TERRA; } |
44 | 44 | |
45 | - | |
45 | + | |
46 | 46 | /******************************************************************************* |
47 | 47 | * 個体の特性 |
48 | 48 | ******************************************************************************/ |
49 | - | |
49 | + | |
50 | 50 | @Override |
51 | 51 | public int getTimeBarStart() {return 5;} |
52 | - | |
52 | + | |
53 | 53 | private int getDogDays() { return ((getExpandTo8())?(8):(7)); } |
54 | 54 | |
55 | - | |
55 | + | |
56 | 56 | /******************************************************************************* |
57 | 57 | * 定数 |
58 | 58 | ******************************************************************************/ |
59 | - | |
59 | + | |
60 | 60 | private final String MSGID = "["+getTVProgramId()+"] "; |
61 | 61 | private final String ERRID = "[ERROR]"+MSGID; |
62 | 62 | private final String DBGID = "[DEBUG]"+MSGID; |
63 | - | |
64 | - | |
63 | + | |
64 | + | |
65 | 65 | /******************************************************************************* |
66 | 66 | * 部品 |
67 | 67 | ******************************************************************************/ |
68 | 68 | |
69 | 69 | // 新しい入れ物の臨時格納場所 |
70 | - protected final ArrayList<ProgList> newplist = new ArrayList<ProgList>(); | |
71 | - | |
70 | + protected ArrayList<ProgList> newplist = new ArrayList<ProgList>(); | |
71 | + | |
72 | 72 | // 未定義のフラグの回収場所 |
73 | 73 | private final HashMap<String,String> nf = new HashMap<String, String>(); |
74 | 74 | |
75 | 75 | protected String getCenterInfoId() { return "ChannelTypeDB"; } |
76 | 76 | protected String getChType() { return "6"; } |
77 | 77 | protected String getCenterCode(String id, String code) { return id.matches("^3.*$")?(bsCode):(code); } |
78 | - | |
78 | + | |
79 | 79 | protected String getProgCacheFile(String areacode, String adate) { return String.format(getProgDir()+File.separator+"Dimora_%s_%s.html", areacode, adate.substring(6,8)); } |
80 | 80 | |
81 | - | |
81 | + | |
82 | 82 | /******************************************************************************* |
83 | 83 | * コンストラクタ |
84 | 84 | ******************************************************************************/ |
85 | - | |
86 | - | |
85 | + | |
86 | + | |
87 | 87 | /******************************************************************************* |
88 | 88 | * 番組情報を取得する |
89 | 89 | ******************************************************************************/ |
90 | 90 | |
91 | 91 | @Override |
92 | - public void loadProgram(String areaCode, boolean force) { | |
93 | - | |
92 | + public boolean loadProgram(String areaCode, boolean force) { | |
93 | + | |
94 | 94 | // 入れ物を空にする |
95 | - newplist.clear(); | |
96 | - nf.clear(); | |
97 | - | |
95 | + newplist = new ArrayList<ProgList>(); | |
96 | + nf.clear(); | |
97 | + | |
98 | 98 | // 地域コードごとの参照ページ数の入れ物を用意する |
99 | 99 | LinkedHashMap<String,Integer> pages = new LinkedHashMap<String, Integer>(); |
100 | - | |
100 | + | |
101 | 101 | // 参照する地域コードをまとめる |
102 | 102 | if ( areaCode.equals(allCode) ) { |
103 | 103 | // 「全国」 |
@@ -119,7 +119,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
122 | - | |
122 | + | |
123 | 123 | // トップの下に局ごとのリストを生やす |
124 | 124 | for ( String ac : pages.keySet() ) { |
125 | 125 | for ( Center cr : crlist ) { |
@@ -134,12 +134,12 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
134 | 134 | pl.Center = cr.getCenter(); |
135 | 135 | pl.BgColor = cr.getBgColor(); |
136 | 136 | pl.enabled = true; |
137 | - | |
137 | + | |
138 | 138 | newplist.add(pl); |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | - | |
142 | + | |
143 | 143 | // 局の下に日付ごとのリストを生やす |
144 | 144 | GregorianCalendar cal = CommonUtils.getCalendar(0); |
145 | 145 | if ( CommonUtils.isLateNight(cal) ) { |
@@ -156,7 +156,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
156 | 156 | } |
157 | 157 | cale.add(Calendar.DATE, 1); |
158 | 158 | } |
159 | - | |
159 | + | |
160 | 160 | // 参照する総ページ数を計算 |
161 | 161 | int counterMax = 0; |
162 | 162 | for ( String ac : pages.keySet() ) { |
@@ -165,9 +165,9 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
165 | 165 | } |
166 | 166 | counterMax += pages.get(ac)*getDogDays(); |
167 | 167 | } |
168 | - | |
168 | + | |
169 | 169 | clrCookie(); |
170 | - | |
170 | + | |
171 | 171 | // 日付の下に番組情報ごとのリストを生やす |
172 | 172 | int counter = 1; |
173 | 173 | for ( String ac : pages.keySet() ) { |
@@ -179,38 +179,51 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
179 | 179 | String adate = CommonUtils.getDateYMD(cale); |
180 | 180 | cale.add(Calendar.DATE, 1); |
181 | 181 | String edate = CommonUtils.getDateYMD(cale); |
182 | - _loadProgram(ac, adate, edate, force, i, counter++, counterMax); | |
182 | + if (!_loadProgram(ac, adate, edate, force, i, counter++, counterMax)){ | |
183 | + newplist = null; | |
184 | + return false; | |
185 | + } | |
186 | + | |
187 | + if (isCancelRequested()){ | |
188 | + newplist = null; | |
189 | + reportProgress(ERRID+"中止要求があったので番組表の取得にを中止します。"); | |
190 | + return false; | |
191 | + } | |
183 | 192 | } |
184 | 193 | } |
185 | - | |
194 | + | |
186 | 195 | // 開始・終了日時を正しい値に計算しなおす |
187 | 196 | for ( ProgList pl : newplist ) { |
188 | 197 | setAccurateDate(pl.pdate); |
189 | 198 | } |
190 | - | |
199 | + | |
191 | 200 | // 古いデータから補完できないかな? |
192 | 201 | CompensatesPrograms(newplist); |
193 | - | |
202 | + | |
194 | 203 | // 解析用 |
195 | 204 | { |
196 | 205 | for ( String f : nf.keySet() ) { |
197 | 206 | System.out.println(String.format(DBGID+"未定義のフラグです: [%s]",f)); |
198 | 207 | } |
199 | 208 | } |
200 | - | |
209 | + | |
201 | 210 | // 古い番組データを置き換える |
211 | + if (pcenter != null) | |
212 | + pcenter.clear(); | |
202 | 213 | pcenter = newplist; |
214 | + newplist = null; | |
215 | + return true; | |
203 | 216 | } |
204 | - | |
217 | + | |
205 | 218 | /* ここまで */ |
206 | 219 | |
207 | - | |
208 | - | |
220 | + | |
221 | + | |
209 | 222 | /* |
210 | 223 | * 非公開メソッド |
211 | 224 | */ |
212 | - | |
213 | - protected void _loadProgram(String areacode, String adate, String edate, boolean force, int wdaycol, int counter, int counterMax) { | |
225 | + | |
226 | + protected boolean _loadProgram(String areacode, String adate, String edate, boolean force, int wdaycol, int counter, int counterMax) { | |
214 | 227 | // |
215 | 228 | final String progCacheFile = getProgCacheFile(areacode,adate); |
216 | 229 | String dt = adate.substring(6,8); |
@@ -223,10 +236,10 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
223 | 236 | if (force == true || |
224 | 237 | (f.exists() == true && isCacheOld(progCacheFile) == true) || |
225 | 238 | (f.exists() == false && isCacheOld(null) == true)) { |
226 | - | |
239 | + | |
227 | 240 | GregorianCalendar c = new GregorianCalendar(); |
228 | 241 | c.setTime(new Date()); |
229 | - | |
242 | + | |
230 | 243 | String hh = String.valueOf(CommonUtils.getCalendar(0).get(Calendar.HOUR_OF_DAY)); |
231 | 244 | String tvParam = "1%2C1%2C1%2CDR%2C10%2C1%2C1%2C1%2C1%2C1%2C1"; |
232 | 245 | String url = "http://dimora.jp/dc/pc/P4501.do"; |
@@ -240,7 +253,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
240 | 253 | "%2C"+hh+"%2C", |
241 | 254 | getChType(), |
242 | 255 | "%2C0%2C"+tvParam); |
243 | - | |
256 | + | |
244 | 257 | // 本体 |
245 | 258 | //clrCookie(); -> もっと上に |
246 | 259 | addCookie("KEY_AREA", areacode); |
@@ -252,14 +265,19 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
252 | 265 | url, |
253 | 266 | pstr, |
254 | 267 | null, |
255 | - url, | |
268 | + url, | |
256 | 269 | thisEncoding, |
257 | 270 | false); |
258 | - | |
271 | + | |
272 | + if ( response == null ){ | |
273 | + reportProgress(ERRID+"番組表(オンライン)の取得に失敗しました["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+url+"?"+pstr+"("+areacode+")"); | |
274 | + return false; | |
275 | + } | |
276 | + | |
259 | 277 | if ( ! CommonUtils.write2file(progCacheFile, "<!-- "+url+"?"+pstr+" -->\n"+response) ) { |
260 | 278 | reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: ("+counter+"/"+counterMax+") "+progCacheFile); |
261 | 279 | } |
262 | - | |
280 | + | |
263 | 281 | reportProgress(MSGID+"番組表(オンライン)を取得しました["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+url+"?"+pstr+"("+areacode+")"); |
264 | 282 | } |
265 | 283 | else if (CommonUtils.isFileAvailable(f,10)) { |
@@ -267,38 +285,41 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
267 | 285 | response = CommonUtils.read4file(progCacheFile, false); |
268 | 286 | if ( response == null ) { |
269 | 287 | reportProgress(ERRID+"番組表(キャッシュ)の取得に失敗しました["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+progCacheFile); |
270 | - return; | |
288 | + return false; | |
271 | 289 | } |
272 | 290 | reportProgress(MSGID+"番組表(キャッシュ)を取得しました["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+progCacheFile); |
273 | 291 | } |
274 | 292 | else { |
275 | 293 | reportProgress(ERRID+"番組表(キャッシュ)がみつかりません["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+progCacheFile); |
276 | - return; | |
294 | + return false; | |
277 | 295 | } |
278 | - | |
296 | + | |
279 | 297 | // 番組リストの追加 |
280 | 298 | getPrograms(areacode, wdaycol, response); |
281 | 299 | } |
282 | 300 | catch (Exception e) { |
283 | 301 | reportProgress(ERRID+"番組表の取得で例外が発生しました: "+e.toString()); |
284 | 302 | e.printStackTrace(); |
303 | + return false; | |
285 | 304 | } |
305 | + | |
306 | + return true; | |
286 | 307 | } |
287 | - | |
308 | + | |
288 | 309 | // |
289 | 310 | private void getPrograms(String areacode, int wdaycol, String src) { |
290 | - | |
311 | + | |
291 | 312 | for ( Center cr : crlist ) { |
292 | - | |
313 | + | |
293 | 314 | if ( ! cr.getAreaCode().equals(areacode) && ! cr.getAreaCode().equals(bsCode) ) { |
294 | 315 | continue; |
295 | 316 | } |
296 | - | |
317 | + | |
297 | 318 | Matcher ma = Pattern.compile(String.format("<div\\s+id=\"%s\">([\\s\\S]*?)</div>",cr.getLink())).matcher(src); |
298 | 319 | if ( ! ma.find() ) { |
299 | 320 | continue; |
300 | 321 | } |
301 | - | |
322 | + | |
302 | 323 | ProgDateList pcl = null; |
303 | 324 | for ( ProgList pl : newplist ) { |
304 | 325 | if ( (pl.Area.equals(areacode)||pl.Area.equals(bsCode)) && pl.Center.equals(cr.getCenter()) ) { |
@@ -310,20 +331,20 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
310 | 331 | // 複数地域を同時に選択していると、BSの番組情報が重複して取得されるので、既得(pcl.row>0)ならスキップ |
311 | 332 | continue; |
312 | 333 | } |
313 | - | |
334 | + | |
314 | 335 | String sdat = String.format("%s %02d:00",pcl.Date,getTimeBarStart()); |
315 | 336 | GregorianCalendar cx = CommonUtils.getCalendar(sdat); |
316 | 337 | GregorianCalendar cy = (GregorianCalendar) cx.clone(); |
317 | 338 | cy.add(Calendar.DAY_OF_MONTH, 1); |
318 | - | |
339 | + | |
319 | 340 | GregorianCalendar pcz = null; |
320 | 341 | Matcher mb = Pattern.compile("([\\s\\S]+?)\\|").matcher(ma.group(1)); |
321 | 342 | while ( mb.find() && pcl.row < 1440 ) { |
322 | - | |
343 | + | |
323 | 344 | String[] dat = mb.group(1).split(","); |
324 | - | |
345 | + | |
325 | 346 | ProgDetailList pdl = new ProgDetailList(); |
326 | - | |
347 | + | |
327 | 348 | // 開始・終了日時 |
328 | 349 | GregorianCalendar ca = CommonUtils.getCalendar(dat[1]); |
329 | 350 | if ( ca == null ) { |
@@ -334,13 +355,13 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
334 | 355 | continue; |
335 | 356 | } |
336 | 357 | pdl.start = CommonUtils.getTime(ca); |
337 | - | |
358 | + | |
338 | 359 | GregorianCalendar cz = CommonUtils.getCalendar(dat[2]); |
339 | 360 | if ( cz == null ) { |
340 | 361 | continue; |
341 | 362 | } |
342 | 363 | pdl.end = CommonUtils.getTime(cz); |
343 | - | |
364 | + | |
344 | 365 | pdl.length = (int)(CommonUtils.getDiffDateTime(dat[1], dat[2])/60000L); |
345 | 366 | |
346 | 367 | if ( pcz == null ) { |
@@ -363,12 +384,12 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
363 | 384 | addEmptyInfo(pcl, CommonUtils.getDateTime(pcz), dat[1]); |
364 | 385 | } |
365 | 386 | } |
366 | - | |
387 | + | |
367 | 388 | pcz = (GregorianCalendar) cz.clone(); |
368 | - | |
389 | + | |
369 | 390 | // タイトル&番組詳細 |
370 | 391 | pdl.title = CommonUtils.unEscape(dat[3]); |
371 | - | |
392 | + | |
372 | 393 | dat[4] = CommonUtils.unEscape(dat[4]).trim(); |
373 | 394 | dat[5] = CommonUtils.unEscape(dat[5]).trim(); |
374 | 395 | dat[6] = CommonUtils.unEscape(dat[6]).trim(); |
@@ -379,10 +400,10 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
379 | 400 | pdl.detail = pdl.detail.replaceAll("\\^", " "); |
380 | 401 | // 改行が挟まっているサブタイトルを1行にしたい |
381 | 402 | pdl.detail = Pattern.compile("(#\\s*\\d+\\s*「[^」]*?)[\r\n]+[ ]*(.*?」)",Pattern.DOTALL).matcher(pdl.detail).replaceAll("$1 $2"); |
382 | - | |
403 | + | |
383 | 404 | // タイトルから各種フラグを分離する |
384 | 405 | doSplitFlags(pdl, nf); |
385 | - | |
406 | + | |
386 | 407 | // ジャンル |
387 | 408 | { |
388 | 409 | ArrayList<String> genrelist = new ArrayList<String>(); |
@@ -395,23 +416,23 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
395 | 416 | |
396 | 417 | // サブタイトル分離 |
397 | 418 | doSplitSubtitle(pdl); |
398 | - | |
419 | + | |
399 | 420 | // 検索対象外領域にこっそりジャンル文字列を入れる |
400 | 421 | pdl.setGenreStr(); |
401 | - | |
422 | + | |
402 | 423 | // プログラムID? |
403 | 424 | String chid = ContentIdDIMORA.getChId(cr.getLink()); |
404 | 425 | ContentIdDIMORA.decodeChId(chid); |
405 | 426 | pdl.progid = ContentIdDIMORA.getContentId(0,dat[8]); |
406 | - | |
427 | + | |
407 | 428 | // その他フラグ |
408 | 429 | pdl.extension = false; |
409 | 430 | //pdl.flag = ProgFlags.NOFLAG; |
410 | 431 | pdl.nosyobo = false; |
411 | - | |
432 | + | |
412 | 433 | // |
413 | 434 | pcl.pdetail.add(pdl); |
414 | - | |
435 | + | |
415 | 436 | // |
416 | 437 | pcl.row += pdl.length; |
417 | 438 | } |
@@ -425,20 +446,20 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
425 | 446 | } |
426 | 447 | } |
427 | 448 | } |
428 | - | |
429 | - | |
449 | + | |
450 | + | |
430 | 451 | /******************************************************************************* |
431 | 452 | * 地域情報を取得する |
432 | 453 | ******************************************************************************/ |
433 | - | |
454 | + | |
434 | 455 | // 普通は東京 |
435 | 456 | @Override |
436 | 457 | public String getDefaultArea() {return "東京";} |
437 | - | |
458 | + | |
438 | 459 | // |
439 | 460 | @Override |
440 | 461 | public void loadAreaCode() { |
441 | - | |
462 | + | |
442 | 463 | // 設定ファイルが存在していればファイルから |
443 | 464 | File f = new File(getAreaSelectedFile()); |
444 | 465 | if (f.exists() == true) { |
@@ -464,7 +485,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
464 | 485 | |
465 | 486 | // 地域一覧の作成 |
466 | 487 | ArrayList<AreaCode> newaclist = new ArrayList<AreaCode>(); |
467 | - | |
488 | + | |
468 | 489 | Matcher ma = Pattern.compile("<div\\s+id=\"includeAreaList\">(.+?)</div>").matcher(response); |
469 | 490 | if ( ma.find() ) { |
470 | 491 | Matcher mb = Pattern.compile("(.+?),(.+?)\\|").matcher(ma.group(1)); |
@@ -475,12 +496,12 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
475 | 496 | newaclist.add(ac); |
476 | 497 | } |
477 | 498 | } |
478 | - | |
499 | + | |
479 | 500 | if ( newaclist.size() == 0 ) { |
480 | 501 | System.err.println(ERRID+"地域一覧の取得結果が0件だったため情報を更新しません"); |
481 | 502 | return; |
482 | 503 | } |
483 | - | |
504 | + | |
484 | 505 | { |
485 | 506 | AreaCode ac = new AreaCode(); |
486 | 507 | ac.setArea("全国"); |
@@ -493,12 +514,12 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
493 | 514 | ac.setCode(bsCode); |
494 | 515 | newaclist.add(ac); |
495 | 516 | } |
496 | - | |
517 | + | |
497 | 518 | aclist = newaclist; |
498 | 519 | saveAreaCode(); |
499 | 520 | } |
500 | - | |
501 | - | |
521 | + | |
522 | + | |
502 | 523 | /******************************************************************************* |
503 | 524 | * 放送局情報を取得する |
504 | 525 | ******************************************************************************/ |
@@ -506,28 +527,28 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
506 | 527 | // 設定ファイルがなければWebから取得 |
507 | 528 | @Override |
508 | 529 | public void loadCenter(String code, boolean force) { |
509 | - | |
530 | + | |
510 | 531 | if ( code == null ) { |
511 | 532 | System.out.println(ERRID+"地域コードがnullです."); |
512 | 533 | return; |
513 | 534 | } |
514 | - | |
535 | + | |
515 | 536 | String centerListFile = getCenterListFile(getTVProgramId(), code); |
516 | - | |
537 | + | |
517 | 538 | if (force) { |
518 | 539 | File f = new File(centerListFile); |
519 | 540 | f.delete(); |
520 | 541 | } |
521 | - | |
542 | + | |
522 | 543 | File f = new File(centerListFile); |
523 | 544 | if (f.exists() == true) { |
524 | 545 | @SuppressWarnings("unchecked") |
525 | 546 | ArrayList<Center> tmp = (ArrayList<Center>) CommonUtils.readXML(centerListFile); |
526 | 547 | if ( tmp != null ) { |
527 | - | |
548 | + | |
528 | 549 | crlist = tmp; |
529 | 550 | attachChFilters(); // 放送局名変換 |
530 | - | |
551 | + | |
531 | 552 | System.out.println(MSGID+"放送局リストを読み込みました: "+centerListFile); |
532 | 553 | return; |
533 | 554 | } |
@@ -535,13 +556,13 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
535 | 556 | System.err.println(ERRID+"放送局リストの読み込みに失敗しました: "+centerListFile); |
536 | 557 | } |
537 | 558 | } |
538 | - | |
559 | + | |
539 | 560 | // Web上から放送局の一覧を取得する |
540 | 561 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
541 | - | |
562 | + | |
542 | 563 | int cntMax = ((code.equals(allCode))?(aclist.size()-2):(1)); |
543 | 564 | int cnt = 1; |
544 | - | |
565 | + | |
545 | 566 | if ( code.equals(allCode) ) { |
546 | 567 | for ( AreaCode ac : aclist ) { |
547 | 568 | if ( ! ac.getCode().equals(allCode) && ! ac.getCode().equals(bsCode) ) { |
@@ -556,7 +577,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
556 | 577 | reportProgress(MSGID+"放送局情報を取得しました: ("+cnt+"/"+cntMax+") "); |
557 | 578 | cnt++; |
558 | 579 | } |
559 | - | |
580 | + | |
560 | 581 | if ( newcrlist.size() == 0 ) { |
561 | 582 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
562 | 583 | return; |
@@ -566,17 +587,17 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
566 | 587 | attachChFilters(); // 放送局名変換 |
567 | 588 | saveCenter(); |
568 | 589 | } |
569 | - | |
590 | + | |
570 | 591 | private boolean _loadCenter(ArrayList<Center> newcrlist, String code, boolean bsexist) { |
571 | 592 | // 本体 |
572 | 593 | String uri = "http://dimora.jp/dc/pc/P4501.do"; |
573 | - | |
594 | + | |
574 | 595 | GregorianCalendar c = CommonUtils.getCalendar(0); |
575 | 596 | String cdate = CommonUtils.getDateTimeYMD(c); |
576 | 597 | String adate = CommonUtils.getDateYMD(c); |
577 | 598 | c.add(Calendar.DAY_OF_MONTH, 1); |
578 | 599 | String edate = CommonUtils.getDateYMD(c); |
579 | - | |
600 | + | |
580 | 601 | clrCookie(); |
581 | 602 | addCookie("KEY_AREA", code); |
582 | 603 | String response = webToBuffer( |
@@ -595,12 +616,12 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
595 | 616 | thisEncoding, |
596 | 617 | true); |
597 | 618 | if ( response == null ) { |
598 | - System.err.println(ERRID+"放送局情報の取得に失敗しました: "+uri); | |
619 | + reportProgress(ERRID+"番組表の取得に失敗しました: "+uri); | |
599 | 620 | return false; |
600 | 621 | } |
601 | - | |
622 | + | |
602 | 623 | //CommonUtils.write2file("TMP.htm", response); |
603 | - | |
624 | + | |
604 | 625 | String expr = String.format("<div\\s+id=\"%s\"\\s*>(.+?)</div>", getCenterInfoId()); |
605 | 626 | Matcher ma = Pattern.compile(expr).matcher(response); |
606 | 627 | if ( ma.find() ) { |
@@ -609,13 +630,13 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
609 | 630 | String centerName = CommonUtils.unEscape(mb.group(3)); |
610 | 631 | String chNo = mb.group(2); |
611 | 632 | String centerId = mb.group(1); |
612 | - | |
633 | + | |
613 | 634 | String areacode = getCenterCode(centerId,code); |
614 | 635 | if ( bsexist && areacode.equals(bsCode) ) { |
615 | 636 | // 重複するBSは排除 |
616 | 637 | continue; |
617 | 638 | } |
618 | - | |
639 | + | |
619 | 640 | // NHK関連 |
620 | 641 | if ( areacode.equals(bsCode) ) { |
621 | 642 | if ( centerName.startsWith("NHK") ) { |
@@ -643,7 +664,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
643 | 664 | } |
644 | 665 | } |
645 | 666 | } |
646 | - | |
667 | + | |
647 | 668 | Center cr = new Center(); |
648 | 669 | cr.setAreaCode(areacode); |
649 | 670 | cr.setCenterOrig(centerName); |
@@ -655,7 +676,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
655 | 676 | } |
656 | 677 | } |
657 | 678 | } |
658 | - | |
679 | + | |
659 | 680 | return true; |
660 | 681 | } |
661 | 682 |
@@ -10,24 +10,21 @@ import java.util.HashMap; | ||
10 | 10 | import java.util.regex.Matcher; |
11 | 11 | import java.util.regex.Pattern; |
12 | 12 | |
13 | +import epgdump.EIT_CONTROL; | |
14 | +import epgdump.Epgdump; | |
15 | +import epgdump.SVT_CONTROL; | |
13 | 16 | import tainavi.AreaCode; |
14 | 17 | import tainavi.Center; |
15 | 18 | import tainavi.CommonUtils; |
16 | 19 | import tainavi.ContentIdEDCB; |
17 | 20 | import tainavi.MapCtrl; |
21 | +import tainavi.MapCtrl.KeyType; | |
18 | 22 | import tainavi.ProgDateList; |
19 | 23 | import tainavi.ProgDetailList; |
20 | 24 | import tainavi.ProgList; |
21 | 25 | import tainavi.TVProgram; |
22 | 26 | import tainavi.TVProgramUtils; |
23 | 27 | import tainavi.TatCount; |
24 | -import tainavi.MapCtrl.KeyType; | |
25 | -import tainavi.TVProgram.ProgSubtype; | |
26 | -import tainavi.TVProgram.ProgType; | |
27 | - | |
28 | -import epgdump.EIT_CONTROL; | |
29 | -import epgdump.Epgdump; | |
30 | -import epgdump.SVT_CONTROL; | |
31 | 28 | |
32 | 29 | |
33 | 30 | public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneable { |
@@ -37,44 +34,44 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
37 | 34 | } |
38 | 35 | |
39 | 36 | private static final String thisEncoding = "UTF-8"; |
40 | - | |
41 | - | |
37 | + | |
38 | + | |
42 | 39 | /******************************************************************************* |
43 | 40 | * 種族の特性 |
44 | 41 | ******************************************************************************/ |
45 | - | |
42 | + | |
46 | 43 | @Override |
47 | 44 | public String getTVProgramId() { return "EDCB"; } |
48 | - | |
45 | + | |
49 | 46 | @Override |
50 | 47 | public ProgType getType() { return ProgType.PROG; } |
51 | 48 | @Override |
52 | 49 | public ProgSubtype getSubtype() { return ProgSubtype.TERRA; } |
53 | 50 | |
54 | - | |
51 | + | |
55 | 52 | /******************************************************************************* |
56 | 53 | * 個体の特性 |
57 | 54 | ******************************************************************************/ |
58 | - | |
55 | + | |
59 | 56 | @Override |
60 | 57 | public int getTimeBarStart() {return 5;} |
61 | - | |
58 | + | |
62 | 59 | private int getDogDays() { return ((getExpandTo8())?(8):(7)); } |
63 | - | |
64 | - | |
60 | + | |
61 | + | |
65 | 62 | /******************************************************************************* |
66 | 63 | * 定数 |
67 | 64 | ******************************************************************************/ |
68 | - | |
65 | + | |
69 | 66 | private static final String OPTKEY_DIR = "datdir"; |
70 | 67 | private static final String OPTVAL_DIR_DEFAULT = "D:/PT2/EpgDataCap_Bon/Setting/EpgData/"; |
71 | 68 | private static final String fnext = "_epg.dat"; |
72 | 69 | |
73 | 70 | private static final String OPTKEY_URL = "url"; |
74 | 71 | private static final String OPTVAL_URL_DEFAULT = "http://127.0.0.1:5510/(dat参照をやめる場合はこのコメントを削除)"; |
75 | - | |
72 | + | |
76 | 73 | private static final String TEXT_NANSHICHO_HEADER = "臨)"; |
77 | - | |
74 | + | |
78 | 75 | private final String MSGID = "["+getTVProgramId()+"] "; |
79 | 76 | private final String ERRID = "[ERROR]"+MSGID; |
80 | 77 | private final String DBGID = "[DEBUG]"+MSGID; |
@@ -82,22 +79,22 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
82 | 79 | /******************************************************************************* |
83 | 80 | * 部品 |
84 | 81 | ******************************************************************************/ |
85 | - | |
82 | + | |
86 | 83 | // 新しい入れ物の臨時格納場所 |
87 | 84 | private ArrayList<ProgList> newplist; |
88 | 85 | private ArrayList<SVT_CONTROL> svtlist; |
89 | - | |
86 | + | |
90 | 87 | // 未定義のフラグの回収場所 |
91 | 88 | private HashMap<String,String> nf = null; |
92 | - | |
89 | + | |
93 | 90 | private String getProgCacheFile() { return getProgDir()+File.separator+"EDCB.xml"; } |
94 | - | |
91 | + | |
95 | 92 | /* |
96 | 93 | * フリーオプション用のクラス |
97 | 94 | */ |
98 | 95 | |
99 | 96 | private OptMap opts = null; |
100 | - | |
97 | + | |
101 | 98 | private class OptMap extends MapCtrl { |
102 | 99 | @Override |
103 | 100 | protected boolean chkOptString() { |
@@ -127,11 +124,11 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
127 | 124 | System.out.println(MSGID+"[EDCB番組表未使用の方は無視してください] EDCBのURLは設定値になります: "+optval); |
128 | 125 | } |
129 | 126 | } |
130 | - | |
127 | + | |
131 | 128 | return true; |
132 | 129 | } |
133 | 130 | } |
134 | - | |
131 | + | |
135 | 132 | // datファイルをリストアップする |
136 | 133 | private ArrayList<String> getDatFiles(String path, String ext) { |
137 | 134 | ArrayList<String> dfiles = new ArrayList<String>(); |
@@ -150,30 +147,30 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
150 | 147 | return new ArrayList<String>(); |
151 | 148 | } |
152 | 149 | } |
153 | - | |
150 | + | |
154 | 151 | |
155 | 152 | /******************************************************************************* |
156 | 153 | * コンストラクタ |
157 | 154 | ******************************************************************************/ |
158 | - | |
155 | + | |
159 | 156 | public PlugIn_TVPEDCB() { |
160 | - | |
157 | + | |
161 | 158 | super(); |
162 | - | |
159 | + | |
163 | 160 | opts = new OptMap(); |
164 | - | |
161 | + | |
165 | 162 | // 保存先の設定 |
166 | 163 | opts.setFilename("env"+File.separator+"options_"+getTVProgramId()+".xml"); |
167 | - | |
164 | + | |
168 | 165 | // オプションキーリストの設定 |
169 | 166 | opts.putdef(OPTKEY_DIR, KeyType.DIR); |
170 | 167 | opts.putdef(OPTKEY_URL, KeyType.URL); |
171 | 168 | |
172 | 169 | // |
173 | 170 | opts.initOptString(); |
174 | - | |
171 | + | |
175 | 172 | } |
176 | - | |
173 | + | |
177 | 174 | @Override |
178 | 175 | public boolean setOptString(String s) { |
179 | 176 | if ( s == null ) { |
@@ -182,34 +179,34 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
182 | 179 | } |
183 | 180 | return opts.setOptString(s); |
184 | 181 | } |
185 | - | |
182 | + | |
186 | 183 | @Override |
187 | 184 | public String getOptString() { |
188 | 185 | // ちょっとちょーだい |
189 | 186 | return opts.toString(); |
190 | 187 | } |
191 | - | |
192 | - | |
188 | + | |
189 | + | |
193 | 190 | /******************************************************************************* |
194 | 191 | * 番組情報を取得する |
195 | 192 | ******************************************************************************/ |
196 | - | |
193 | + | |
197 | 194 | @Override |
198 | - public void loadProgram(String areaCode, boolean force) { | |
199 | - | |
195 | + public boolean loadProgram(String areaCode, boolean force) { | |
196 | + | |
200 | 197 | // 新しい入れ物(トップ)を用意する |
201 | 198 | newplist = new ArrayList<ProgList>(); |
202 | 199 | svtlist = new ArrayList<SVT_CONTROL>(); |
203 | 200 | nf = new HashMap<String, String>(); |
204 | - | |
201 | + | |
205 | 202 | // トップの下に局ごとのリストを生やす |
206 | 203 | for ( Center cr : crlist ) { |
207 | - | |
204 | + | |
208 | 205 | if ( cr.getOrder() <= 0 ) { |
209 | 206 | // 設定上無効な局はいらない |
210 | 207 | continue; |
211 | 208 | } |
212 | - | |
209 | + | |
213 | 210 | // ProgList |
214 | 211 | ProgList pl = new ProgList(); |
215 | 212 | pl.Area = cr.getAreaCode(); |
@@ -219,17 +216,17 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
219 | 216 | pl.CenterId = cr.getLink(); |
220 | 217 | pl.enabled = true; |
221 | 218 | newplist.add(pl); |
222 | - | |
219 | + | |
223 | 220 | // SVT |
224 | 221 | SVT_CONTROL svt = new SVT_CONTROL(); |
225 | 222 | svt.setServicename(pl.Center); |
226 | 223 | setCenterLink(svt,cr.getLink()); |
227 | 224 | svt.setEnabled(true); |
228 | 225 | svtlist.add(svt); |
229 | - | |
226 | + | |
230 | 227 | if (getDebug()) System.err.println(DBGID+"Center added: "+pl.Center+"("+pl.CenterId+")"); |
231 | 228 | } |
232 | - | |
229 | + | |
233 | 230 | // 局の下に日付ごとのリストを生やす(当日前日からの日跨りを考慮して、前日から7+1日分) |
234 | 231 | GregorianCalendar cal = new GregorianCalendar(); |
235 | 232 | cal.setTime(new Date()); |
@@ -248,7 +245,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
248 | 245 | } |
249 | 246 | cale.add(Calendar.DATE, 1); |
250 | 247 | } |
251 | - | |
248 | + | |
252 | 249 | // 日付の下に番組情報ごとのリストを生やす |
253 | 250 | if ( opts.get(OPTKEY_URL) != null && opts.get(OPTKEY_URL).matches("^https?://[^/]+?:\\d+/$") ) { |
254 | 251 | // |
@@ -261,49 +258,50 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
261 | 258 | else { |
262 | 259 | _loadProgramFromDAT(force); |
263 | 260 | } |
264 | - | |
261 | + | |
265 | 262 | // 隙間を埋める |
266 | 263 | for ( ProgList pl : newplist ) { |
267 | 264 | refreshList(pl.pdate); |
268 | 265 | } |
269 | - | |
266 | + | |
270 | 267 | // 余分に作成した前日分はカット |
271 | 268 | for ( ProgList pl : newplist ) { |
272 | 269 | pl.pdate.remove(0); |
273 | 270 | } |
274 | - | |
271 | + | |
275 | 272 | // 開始・終了日時を正しい値に計算しなおす |
276 | 273 | for ( ProgList pl : newplist ) { |
277 | 274 | setAccurateDate(pl.pdate); |
278 | 275 | } |
279 | - | |
276 | + | |
280 | 277 | // 古いデータから補完できないかな? |
281 | 278 | CompensatesPrograms(newplist); |
282 | - | |
279 | + | |
283 | 280 | // 解析用 |
284 | 281 | { |
285 | 282 | for ( String f : nf.keySet() ) { |
286 | 283 | System.err.println(String.format(DBGID+"未定義のフラグです: [%s]",f)); |
287 | 284 | } |
288 | 285 | } |
289 | - | |
286 | + | |
290 | 287 | // 古い番組データを置き換える |
291 | 288 | pcenter = newplist; |
292 | 289 | svtlist = null; |
290 | + return true; | |
293 | 291 | } |
294 | - | |
292 | + | |
295 | 293 | /* ここまで */ |
296 | 294 | |
297 | - | |
298 | - | |
295 | + | |
296 | + | |
299 | 297 | /* |
300 | 298 | * 非公開メソッド |
301 | 299 | */ |
302 | - | |
300 | + | |
303 | 301 | private void _loadProgramFromAPI(Center cr, boolean force, int counter, int counterMax) { |
304 | 302 | // |
305 | 303 | try { |
306 | - | |
304 | + | |
307 | 305 | // いれるところ |
308 | 306 | SVT_CONTROL svt = new SVT_CONTROL(); |
309 | 307 | ContentIdEDCB.decodeChId(cr.getLink()); |
@@ -312,28 +310,28 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
312 | 310 | svt.setServive_id(ContentIdEDCB.getSId()); |
313 | 311 | svt.setServicename(cr.getCenterOrig()); |
314 | 312 | svt.setEnabled(true); |
315 | - | |
313 | + | |
316 | 314 | svtlist = new ArrayList<SVT_CONTROL>(); |
317 | 315 | svtlist.add(svt); |
318 | - | |
316 | + | |
319 | 317 | final String progCacheFile = String.format(getProgDir()+File.separator+"TVEDCB_%s.xml.zip", cr.getLink()); // getLink()はCHコード |
320 | 318 | String response = null; |
321 | - | |
319 | + | |
322 | 320 | File f = new File(progCacheFile); |
323 | 321 | if (force == true || |
324 | 322 | (f.exists() == true && isCacheOld(progCacheFile) == true) || |
325 | 323 | (f.exists() == false && isCacheOld(null) == true)) { |
326 | - | |
324 | + | |
327 | 325 | String url = opts.get(OPTKEY_URL)+"api/EnumEventInfo?ONID="+svt.getOriginal_network_id()+"&TSID="+svt.getTransport_stream_id()+"&SID="+svt.getServive_id()+"&basic=0&count=2000"; |
328 | - | |
326 | + | |
329 | 327 | // Web番組表の読み出し |
330 | 328 | response = webToBuffer(url, thisEncoding, true); |
331 | - | |
329 | + | |
332 | 330 | // キャッシュファイルの保存 |
333 | 331 | if ( ! CommonUtils.write2file(progCacheFile, response) ) { |
334 | 332 | reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: ("+counter+"/"+counterMax+") "+progCacheFile); |
335 | 333 | } |
336 | - | |
334 | + | |
337 | 335 | reportProgress(MSGID+"(オンライン)を取得しました: ("+counter+"/"+counterMax+") "+cr.getCenter()+" "+url); |
338 | 336 | } |
339 | 337 | else if (f.exists()) { |
@@ -350,7 +348,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
350 | 348 | } |
351 | 349 | |
352 | 350 | // |
353 | - | |
351 | + | |
354 | 352 | Matcher ma = Pattern.compile("<eventinfo>(.+?)</eventinfo>", Pattern.DOTALL).matcher(response); |
355 | 353 | while ( ma.find() ) { |
356 | 354 |
@@ -361,9 +359,9 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
361 | 359 | Integer length = null; |
362 | 360 | String title = null; |
363 | 361 | String subtitle = null; |
364 | - String detail = null; | |
362 | + String detail = null; | |
365 | 363 | ArrayList<String> content_type = new ArrayList<String>(); |
366 | - | |
364 | + | |
367 | 365 | Matcher mb = Pattern.compile("<(.+?)>(.+?)</\\1>", Pattern.DOTALL).matcher(ma.group(1)); |
368 | 366 | while ( mb.find() ) { |
369 | 367 | if ( mb.group(1).equals("eventID") ) { |
@@ -416,45 +414,45 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
416 | 414 | } |
417 | 415 | } |
418 | 416 | } |
419 | - | |
417 | + | |
420 | 418 | // |
421 | - | |
419 | + | |
422 | 420 | EIT_CONTROL eit = new EIT_CONTROL(); |
423 | - | |
421 | + | |
424 | 422 | eit.setEvent_id(evid); |
425 | - | |
423 | + | |
426 | 424 | eit.setYy(cal.get(Calendar.YEAR)); |
427 | 425 | eit.setMm(cal.get(Calendar.MONTH)+1); |
428 | 426 | eit.setDd(cal.get(Calendar.DAY_OF_MONTH)); |
429 | - | |
427 | + | |
430 | 428 | cal.set(Calendar.HOUR, hh); |
431 | 429 | cal.set(Calendar.MINUTE, hm); |
432 | 430 | eit.setHh(hh); |
433 | 431 | eit.setHm(hm); |
434 | 432 | eit.setSs(0); |
435 | - | |
433 | + | |
436 | 434 | int dhm = length % 60; |
437 | 435 | int dhh = (length-dhm) / 60; |
438 | - | |
436 | + | |
439 | 437 | eit.setDhh(dhh); |
440 | 438 | eit.setDhm(dhm); |
441 | - | |
439 | + | |
442 | 440 | /* - 使わないので要らない - |
443 | 441 | cal.add(Calendar.MINUTE, length); |
444 | 442 | eit.setEhh(cal.get(Calendar.HOUR)); |
445 | 443 | eit.setEhm(cal.get(Calendar.DAY_OF_MONTH)); |
446 | 444 | eit.setEss(0); |
447 | 445 | */ |
448 | - | |
446 | + | |
449 | 447 | eit.setTitle(title); |
450 | 448 | eit.setSubtitle(subtitle); |
451 | 449 | eit.setDetail(detail); |
452 | 450 | eit.setContent_type(content_type); |
453 | - | |
451 | + | |
454 | 452 | /* - 使わないので要らない - |
455 | 453 | eit.setPerformer(null) |
456 | 454 | */ |
457 | - | |
455 | + | |
458 | 456 | int n = 0; |
459 | 457 | for ( EIT_CONTROL etmp : svt.getEittop() ) { |
460 | 458 | String a = String.format("%04d%02d%02d%02d%02d", etmp.getYy(), etmp.getMm(), etmp.getDd(), etmp.getHh(), etmp.getHm()); |
@@ -464,10 +462,10 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
464 | 462 | } |
465 | 463 | n++; |
466 | 464 | } |
467 | - | |
465 | + | |
468 | 466 | svt.getEittop().add(n,eit); |
469 | 467 | } |
470 | - | |
468 | + | |
471 | 469 | // データ形式の変換 |
472 | 470 | convEpg2Programs(); |
473 | 471 | } |
@@ -476,7 +474,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
476 | 474 | e.printStackTrace(); |
477 | 475 | } |
478 | 476 | } |
479 | - | |
477 | + | |
480 | 478 | private void _loadProgramFromDAT(boolean force) { |
481 | 479 | // |
482 | 480 | final String progCacheFile = getProgCacheFile(); |
@@ -487,10 +485,10 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
487 | 485 | if (force == true || |
488 | 486 | (f.exists() == true && isCacheOld(progCacheFile) == true) || |
489 | 487 | (f.exists() == false && isCacheOld(null) == true)) { |
490 | - | |
488 | + | |
491 | 489 | // 参照するファイルの一覧 |
492 | 490 | ArrayList<String> dfiles = getDatFiles(opts.get(OPTKEY_DIR),fnext); |
493 | - | |
491 | + | |
494 | 492 | // 参照する総ファイル数 |
495 | 493 | int counterMax = dfiles.size(); |
496 | 494 |
@@ -513,11 +511,11 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
513 | 511 | } |
514 | 512 | reportProgress(String.format("%s(EPGデータ)を取得しました[%5.1fMB,%.2f秒]: (%d/%d) %s",getTVProgramId(),new File(dfiles.get(i)).length()/1000000.0D,tc.end(),i+1,counterMax,dfiles.get(i))); |
515 | 513 | } |
516 | - | |
514 | + | |
517 | 515 | reportProgress(String.format("%s(EPGデータ)をすべて取得しました[%.2f秒]",getTVProgramId(),tcall.end())); |
518 | - | |
516 | + | |
519 | 517 | epg = null; |
520 | - | |
518 | + | |
521 | 519 | tc.restart(); |
522 | 520 | reportProgress(String.format("%s(キャッシュ)を保存します: %s",getTVProgramId(),progCacheFile)); |
523 | 521 | if ( ! CommonUtils.writeXML(progCacheFile, svtlist) ) { |
@@ -545,16 +543,16 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
545 | 543 | reportProgress(getTVProgramId()+"(キャッシュ)がみつかりません: "+progCacheFile); |
546 | 544 | return; |
547 | 545 | } |
548 | - | |
546 | + | |
549 | 547 | if (getDebug()) { |
550 | 548 | for ( SVT_CONTROL svt : svtlist ) { |
551 | 549 | System.err.println("[DEBUG] programs loaded: "+svt.getServicename()+" ("+svt.getEittop().size()+")"); |
552 | 550 | } |
553 | 551 | } |
554 | - | |
552 | + | |
555 | 553 | // データ形式の変換 |
556 | 554 | convEpg2Programs(); |
557 | - | |
555 | + | |
558 | 556 | } |
559 | 557 | catch (Exception e) { |
560 | 558 | // 例外 |
@@ -562,20 +560,20 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
562 | 560 | e.printStackTrace(); |
563 | 561 | } |
564 | 562 | } |
565 | - | |
563 | + | |
566 | 564 | // |
567 | 565 | private void convEpg2Programs() { |
568 | - | |
566 | + | |
569 | 567 | for ( SVT_CONTROL svt : svtlist ) { |
570 | - | |
568 | + | |
571 | 569 | // 不要になる領域は早々に処分する |
572 | 570 | ArrayList<EIT_CONTROL> eittop = svt.getEittop(); |
573 | 571 | svt.setEittop(null); |
574 | - | |
572 | + | |
575 | 573 | if ( eittop.size() == 0 ) { |
576 | 574 | continue; |
577 | 575 | } |
578 | - | |
576 | + | |
579 | 577 | // 登録先の放送局をみつける |
580 | 578 | ProgList pl = null; |
581 | 579 | for ( int i=0; i<newplist.size(); i++ ) { |
@@ -587,11 +585,11 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
587 | 585 | if ( pl == null ) { |
588 | 586 | continue; |
589 | 587 | } |
590 | - | |
588 | + | |
591 | 589 | for ( EIT_CONTROL eit : eittop ) { |
592 | - | |
590 | + | |
593 | 591 | ProgDetailList pdl = new ProgDetailList(); |
594 | - | |
592 | + | |
595 | 593 | // 開始日時 |
596 | 594 | GregorianCalendar ca = new GregorianCalendar(); |
597 | 595 | ca.set(Calendar.YEAR, eit.getYy()); |
@@ -602,7 +600,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
602 | 600 | ca.set(Calendar.SECOND, 0); |
603 | 601 | pdl.start = CommonUtils.getTime(ca); |
604 | 602 | pdl.startDateTime = CommonUtils.getDateTime(ca); |
605 | - | |
603 | + | |
606 | 604 | // 登録先の日付をみつける |
607 | 605 | GregorianCalendar ct = (GregorianCalendar) ca.clone(); |
608 | 606 | if ( CommonUtils.isLateNight(ca) ) { |
@@ -619,10 +617,10 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
619 | 617 | if ( pcl == null ) { |
620 | 618 | continue; |
621 | 619 | } |
622 | - | |
620 | + | |
623 | 621 | // 長さ |
624 | 622 | pdl.length = eit.getDhh()*60 + eit.getDhm(); |
625 | - | |
623 | + | |
626 | 624 | // 終了日時 |
627 | 625 | GregorianCalendar cz = (GregorianCalendar) ca.clone(); |
628 | 626 | cz.add(Calendar.MINUTE, pdl.length); |
@@ -631,44 +629,44 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
631 | 629 | |
632 | 630 | // 番組ID |
633 | 631 | pdl.progid = ContentIdEDCB.getContentId(pl.CenterId,eit.getEvent_id()); |
634 | - | |
632 | + | |
635 | 633 | // タイトル&番組詳細 |
636 | 634 | pdl.title = (eit.getTitle() == null) ? "" : eit.getTitle(); |
637 | - pdl.detail = | |
635 | + pdl.detail = | |
638 | 636 | ((eit.getSubtitle() != null) ? (eit.getSubtitle()+DETAIL_SEP):("")) |
639 | 637 | +((eit.getDetail() != null) ? (eit.getDetail()+DETAIL_SEP):("")) |
640 | 638 | +((eit.getPerformer() != null) ? (eit.getPerformer()+DETAIL_SEP):("")); |
641 | 639 | pdl.detail = pdl.detail.replaceFirst("[\r\n]+$", ""); |
642 | - | |
640 | + | |
643 | 641 | // タイトルから各種フラグを分離する |
644 | 642 | doSplitFlags(pdl, nf); |
645 | - | |
643 | + | |
646 | 644 | // ジャンル |
647 | 645 | setMultiGenre(pdl,eit.getContent_type()); |
648 | - | |
646 | + | |
649 | 647 | // サブタイトル分離 |
650 | 648 | doSplitSubtitle(pdl); |
651 | - | |
649 | + | |
652 | 650 | // 検索対象外領域にこっそりジャンル文字列を入れる |
653 | 651 | pdl.setGenreStr(); |
654 | - | |
652 | + | |
655 | 653 | // 検索対象外領域にこっそりID文字列を入れる(progidもここで入る) |
656 | 654 | pdl.setContentIdStr(); |
657 | - | |
655 | + | |
658 | 656 | // その他フラグ |
659 | 657 | pdl.extension = false; |
660 | 658 | //pdl.flag = ProgFlags.NOFLAG; |
661 | 659 | pdl.nosyobo = false; |
662 | - | |
660 | + | |
663 | 661 | // |
664 | 662 | pcl.pdetail.add(pdl); |
665 | - | |
663 | + | |
666 | 664 | // |
667 | 665 | pcl.row += pdl.length; |
668 | 666 | } |
669 | 667 | } |
670 | 668 | } |
671 | - | |
669 | + | |
672 | 670 | // |
673 | 671 | private void refreshList(ArrayList<ProgDateList> pcenter) { |
674 | 672 | // 日付(29時)をまたいでいるものをコピーする |
@@ -689,7 +687,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
689 | 687 | pdl = pdl.clone(); |
690 | 688 | pdl.length = (int) ((cz.getTimeInMillis() - tbca.getTimeInMillis())/60000L); |
691 | 689 | pcenter.get(i+1).pdetail.add(0,pdl); |
692 | - | |
690 | + | |
693 | 691 | if (getDebug()) System.err.println("[DEBUG] copy "+pdl.startDateTime+" - "+pdl.endDateTime+" to "+pcenter.get(i+1).Date); |
694 | 692 | } |
695 | 693 | } |
@@ -712,7 +710,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
712 | 710 | } |
713 | 711 | pl.pdetail = cur; |
714 | 712 | } |
715 | - | |
713 | + | |
716 | 714 | // 総時間数等を整理する |
717 | 715 | for ( ProgDateList pl : pcenter ) { |
718 | 716 | // 1日の合計分数を足し合わせる |
@@ -731,16 +729,16 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
731 | 729 | } |
732 | 730 | } |
733 | 731 | } |
734 | - | |
735 | - | |
732 | + | |
733 | + | |
736 | 734 | /******************************************************************************* |
737 | 735 | * 地域情報を取得する |
738 | 736 | ******************************************************************************/ |
739 | - | |
737 | + | |
740 | 738 | // EDCBは地元というか実際に視聴できる局しか情報がとれないね |
741 | 739 | @Override |
742 | 740 | public String getDefaultArea() { return "すべて"; } |
743 | - | |
741 | + | |
744 | 742 | // |
745 | 743 | @Override |
746 | 744 | public void loadAreaCode() { |
@@ -771,38 +769,38 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
771 | 769 | aclist.add(ac); |
772 | 770 | } |
773 | 771 | } |
774 | - | |
772 | + | |
775 | 773 | @Override |
776 | 774 | public void saveAreaCode() { |
777 | 775 | } |
778 | - | |
779 | - | |
776 | + | |
777 | + | |
780 | 778 | /******************************************************************************* |
781 | 779 | * 放送局情報を取得する |
782 | 780 | ******************************************************************************/ |
783 | - | |
781 | + | |
784 | 782 | // 設定ファイルがなければWebから取得 |
785 | 783 | @SuppressWarnings("unchecked") |
786 | 784 | @Override |
787 | 785 | public void loadCenter(String code, boolean force) { |
788 | - | |
786 | + | |
789 | 787 | String centerListFile = getCenterListFile(getTVProgramId(), code); |
790 | - | |
788 | + | |
791 | 789 | if (force) { |
792 | 790 | File f = new File(centerListFile); |
793 | 791 | f.delete(); |
794 | 792 | } |
795 | - | |
793 | + | |
796 | 794 | File f = new File(centerListFile); |
797 | 795 | if (f.exists() == true) { |
798 | 796 | ArrayList<Center> tmp = (ArrayList<Center>) CommonUtils.readXML(centerListFile); |
799 | 797 | if ( tmp != null ) { |
800 | - | |
798 | + | |
801 | 799 | crlist = tmp; |
802 | - | |
800 | + | |
803 | 801 | // 放送局名変換 |
804 | 802 | attachChFilters(); |
805 | - | |
803 | + | |
806 | 804 | System.out.println(MSGID+"放送局リストを読み込みました: "+centerListFile); |
807 | 805 | return; |
808 | 806 | } |
@@ -810,25 +808,25 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
810 | 808 | System.out.println(ERRID+"放送局リストの読み込みに失敗しました: "+centerListFile); |
811 | 809 | } |
812 | 810 | } |
813 | - | |
811 | + | |
814 | 812 | // Web上から放送局の一覧を取得する |
815 | 813 | ArrayList<Center> tmpCrList = new ArrayList<Center>(); |
816 | 814 | ArrayList<Center> trCrList = new ArrayList<Center>(); |
817 | 815 | ArrayList<Center> bsCrList = new ArrayList<Center>(); |
818 | 816 | ArrayList<Center> csCrList = new ArrayList<Center>(); |
819 | 817 | ArrayList<Center> otCrList = new ArrayList<Center>(); |
820 | - | |
818 | + | |
821 | 819 | if ( opts.get(OPTKEY_URL) != null && opts.get(OPTKEY_URL).matches("^https?://[^/]+?:\\d+/$") ) { |
822 | 820 | // APIを使う |
823 | - String url = opts.get(OPTKEY_URL)+"api/EnumService"; | |
821 | + String url = opts.get(OPTKEY_URL)+"api/EnumService"; | |
824 | 822 | String response = webToBuffer(url,thisEncoding,true); |
825 | 823 | if ( response == null ) { |
826 | 824 | System.err.println(ERRID+"放送局情報の取得に失敗しました: "+url); |
827 | 825 | return; |
828 | 826 | } |
829 | - | |
827 | + | |
830 | 828 | reportProgress(MSGID+"放送局情報を取得しました: "+url); |
831 | - | |
829 | + | |
832 | 830 | Matcher ma = Pattern.compile("<serviceinfo>(.+?)</serviceinfo>", Pattern.DOTALL).matcher(response); |
833 | 831 | while ( ma.find() ) { |
834 | 832 | Integer onid = null; |
@@ -840,7 +838,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
840 | 838 | /* |
841 | 839 | * 解析 |
842 | 840 | */ |
843 | - | |
841 | + | |
844 | 842 | if ( mb.group(1).equals("service_name") ) { |
845 | 843 | ch_name = mb.group(2); |
846 | 844 | } |
@@ -854,24 +852,24 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
854 | 852 | sid = Integer.valueOf(mb.group(2)); |
855 | 853 | } |
856 | 854 | } |
857 | - | |
855 | + | |
858 | 856 | String chid = ContentIdEDCB.getChId(onid, tsid, sid); |
859 | - | |
857 | + | |
860 | 858 | Center cr = new Center(); |
861 | 859 | cr.setLink(chid); |
862 | 860 | cr.setAreaCode(getCenterCode(cr.getLink())); |
863 | - | |
861 | + | |
864 | 862 | if ( tsid == 0x4310 || tsid == 0x4311 ) { |
865 | 863 | cr.setCenterOrig(TEXT_NANSHICHO_HEADER+ch_name); |
866 | 864 | } |
867 | 865 | else { |
868 | 866 | cr.setCenterOrig(ch_name); |
869 | 867 | } |
870 | - | |
868 | + | |
871 | 869 | cr.setCenter(null); |
872 | 870 | cr.setType(""); |
873 | 871 | cr.setEnabled(true); |
874 | - | |
872 | + | |
875 | 873 | tmpCrList.add(cr); |
876 | 874 | } |
877 | 875 | } |
@@ -881,9 +879,9 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
881 | 879 | System.out.println(ERRID+".datファイルの場所が正しくないため放送局リストの読み込みはキャンセルされました: "+opts.get(OPTKEY_DIR)); |
882 | 880 | return; |
883 | 881 | } |
884 | - | |
882 | + | |
885 | 883 | Epgdump epg = new Epgdump(); |
886 | - | |
884 | + | |
887 | 885 | ArrayList<String> dfiles = getDatFiles(opts.get(OPTKEY_DIR),fnext); |
888 | 886 | if ( dfiles != null ) { |
889 | 887 | // SVT |
@@ -901,18 +899,18 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
901 | 899 | Center cr = new Center(); |
902 | 900 | cr.setLink(getCenterLink(svt)); |
903 | 901 | cr.setAreaCode(getCenterCode(cr.getLink())); |
904 | - | |
902 | + | |
905 | 903 | if ( svt.getTransport_stream_id() == 0x4310 || svt.getTransport_stream_id() == 0x4311 ) { |
906 | 904 | cr.setCenterOrig(TEXT_NANSHICHO_HEADER+svt.getServicename()); |
907 | 905 | } |
908 | 906 | else { |
909 | 907 | cr.setCenterOrig(svt.getServicename()); |
910 | 908 | } |
911 | - | |
909 | + | |
912 | 910 | cr.setCenter(null); |
913 | 911 | cr.setType(""); |
914 | 912 | cr.setEnabled(true); |
915 | - | |
913 | + | |
916 | 914 | int n = 0; |
917 | 915 | for ( Center ctmp : tmpCrList ) { |
918 | 916 | if ( ctmp.getLink().compareTo(cr.getLink()) < 0 ) { |
@@ -943,9 +941,9 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
943 | 941 | //otCrList.add(cr); |
944 | 942 | } |
945 | 943 | } |
946 | - | |
944 | + | |
947 | 945 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
948 | - | |
946 | + | |
949 | 947 | for ( Center cr : trCrList ) { |
950 | 948 | newcrlist.add(cr); |
951 | 949 | } |
@@ -958,18 +956,18 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
958 | 956 | for ( Center cr : otCrList ) { |
959 | 957 | newcrlist.add(cr); |
960 | 958 | } |
961 | - | |
959 | + | |
962 | 960 | if ( newcrlist.size() == 0 ) { |
963 | 961 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
964 | 962 | return; |
965 | 963 | } |
966 | - | |
967 | - crlist = newcrlist; | |
964 | + | |
965 | + crlist = newcrlist; | |
968 | 966 | chkCrNameDuped(crlist); // 放送局名の重複排除 |
969 | 967 | attachChFilters(); // 放送局名変換 |
970 | 968 | saveCenter(); |
971 | 969 | } |
972 | - | |
970 | + | |
973 | 971 | private void addCenter(ArrayList<Center> newcrlist, Center cr) { |
974 | 972 | int n=0; |
975 | 973 | for ( ; n<newcrlist.size(); n++ ) { |
@@ -979,12 +977,12 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
979 | 977 | } |
980 | 978 | newcrlist.add(n,cr); |
981 | 979 | } |
982 | - | |
980 | + | |
983 | 981 | // |
984 | 982 | private String getCenterLink(SVT_CONTROL svt) { |
985 | 983 | return ContentIdEDCB.getChId(svt.getOriginal_network_id(),svt.getTransport_stream_id(),svt.getServive_id()); |
986 | 984 | } |
987 | - | |
985 | + | |
988 | 986 | // |
989 | 987 | private void setCenterLink(SVT_CONTROL svt, String link) { |
990 | 988 | if ( ContentIdEDCB.decodeChId(link) ) { |
@@ -993,7 +991,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
993 | 991 | svt.setServive_id(ContentIdEDCB.getSId()); |
994 | 992 | } |
995 | 993 | } |
996 | - | |
994 | + | |
997 | 995 | // |
998 | 996 | private void chkCrNameDuped(ArrayList<Center> crList) { |
999 | 997 | HashMap<String,String> crNameMap = new HashMap<String, String>(); |
@@ -1013,7 +1011,7 @@ public class PlugIn_TVPEDCB extends TVProgramUtils implements TVProgram,Cloneabl | ||
1013 | 1011 | } |
1014 | 1012 | } |
1015 | 1013 | } |
1016 | - | |
1014 | + | |
1017 | 1015 | // |
1018 | 1016 | private String getCenterCode(String id) { |
1019 | 1017 | Matcher ma = Pattern.compile("^(..)(..)").matcher(id); |
@@ -71,7 +71,7 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
71 | 71 | ******************************************************************************/ |
72 | 72 | |
73 | 73 | // 新しい入れ物の臨時格納場所 |
74 | - protected final ArrayList<ProgList> newplist = new ArrayList<ProgList>(); | |
74 | + protected ArrayList<ProgList> newplist = new ArrayList<ProgList>(); | |
75 | 75 | |
76 | 76 | // 未定義のフラグの回収場所 |
77 | 77 | protected final HashMap<String,String> nf = new HashMap<String, String>(); |
@@ -97,10 +97,10 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
97 | 97 | ******************************************************************************/ |
98 | 98 | |
99 | 99 | @Override |
100 | - public void loadProgram(String areaCode, boolean force) { | |
100 | + public boolean loadProgram(String areaCode, boolean force) { | |
101 | 101 | |
102 | 102 | // 入れ物を空にする |
103 | - newplist.clear(); | |
103 | + newplist = new ArrayList<ProgList>(); | |
104 | 104 | nf.clear(); |
105 | 105 | |
106 | 106 | // 地域コードごとの参照ページ数の入れ物を用意する |
@@ -210,8 +210,18 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
210 | 210 | } |
211 | 211 | } |
212 | 212 | if ( url != null ) { |
213 | - _loadProgram(ac, d, dMax, url, cookie, force, i, cale.get(Calendar.MONTH)+1, cale.get(Calendar.DATE), counter++, counterMax); | |
213 | + if (!_loadProgram(ac, d, dMax, url, cookie, force, i, cale.get(Calendar.MONTH)+1, cale.get(Calendar.DATE), counter++, counterMax)){ | |
214 | + newplist = null; | |
215 | + return false; | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + if (isCancelRequested()){ | |
220 | + newplist = null; | |
221 | + reportProgress(ERRID+"中止要求があったので番組表の取得にを中止します。"); | |
222 | + return false; | |
214 | 223 | } |
224 | + | |
215 | 225 | } |
216 | 226 | |
217 | 227 | cale.add(Calendar.DATE, 1); |
@@ -227,7 +237,11 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
227 | 237 | debugNF(); |
228 | 238 | |
229 | 239 | // 古い番組データを置き換える |
240 | + if (pcenter != null) | |
241 | + pcenter.clear(); | |
230 | 242 | pcenter = newplist; |
243 | + newplist = null; | |
244 | + return true; | |
231 | 245 | } |
232 | 246 | |
233 | 247 | /* ここまで */ |
@@ -239,7 +253,7 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
239 | 253 | */ |
240 | 254 | |
241 | 255 | // |
242 | - private void _loadProgram(String ac, int page, int pmax, String url, String cookie, boolean force, int wdaycol, int month, int day, int counter, int counterMax) { | |
256 | + private boolean _loadProgram(String ac, int page, int pmax, String url, String cookie, boolean force, int wdaycol, int month, int day, int counter, int counterMax) { | |
243 | 257 | // progfilesの読み出し |
244 | 258 | // |
245 | 259 | final String progCacheFile = String.format(getProgDir()+File.separator+"TVK_%s_%s_%04d.html", ac, page, day); |
@@ -258,17 +272,21 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
258 | 272 | } |
259 | 273 | else { |
260 | 274 | reportProgress(String.format("%s (キャッシュ)がみつかりません: (%d/%d) %s - %d日[%d/%d] %s",getTVProgramId(),counter,counterMax,getArea(ac),day,page,pmax,progCacheFile)); |
261 | - return; | |
275 | + return false; | |
262 | 276 | } |
263 | 277 | |
264 | 278 | // キャッシュファイルの読み込み |
265 | 279 | String response = CommonUtils.read4file(progCacheFile, true); |
280 | + if ( response == null ) { | |
281 | + reportProgress(ERRID+"番組表の取得に失敗しました: "+url); | |
282 | + return false; | |
283 | + } | |
266 | 284 | |
267 | 285 | // キャッシュが不整合を起こしていたら投げ捨てる |
268 | 286 | Matcher ma = Pattern.compile(String.format("<title>%d月 %d日",month,day)).matcher(response); |
269 | 287 | if ( ! ma.find() ) { |
270 | 288 | reportProgress(String.format("%s (キャッシュ)が無効です: (%d/%d) %s - %d日[%d/%d] %s",getTVProgramId(),counter,counterMax,getArea(ac),day,page,pmax,progCacheFile)); |
271 | - return; | |
289 | + return false; | |
272 | 290 | } |
273 | 291 | |
274 | 292 | // 番組リストの追加 |
@@ -278,7 +296,11 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
278 | 296 | // 例外 |
279 | 297 | System.out.println("Exception: _loadProgram()"); |
280 | 298 | e.printStackTrace(); |
299 | + reportProgress(ERRID+"番組表の取得に失敗しました: "+url); | |
300 | + return false; | |
281 | 301 | } |
302 | + | |
303 | + return true; | |
282 | 304 | } |
283 | 305 | |
284 | 306 | // |
@@ -18,12 +18,6 @@ import tainavi.ProgDetailList; | ||
18 | 18 | import tainavi.ProgList; |
19 | 19 | import tainavi.TVProgram; |
20 | 20 | import tainavi.TVProgramUtils; |
21 | -import tainavi.TVProgram.ProgFlags; | |
22 | -import tainavi.TVProgram.ProgGenre; | |
23 | -import tainavi.TVProgram.ProgOption; | |
24 | -import tainavi.TVProgram.ProgScrumble; | |
25 | -import tainavi.TVProgram.ProgSubtype; | |
26 | -import tainavi.TVProgram.ProgType; | |
27 | 21 | |
28 | 22 | |
29 | 23 | public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram,Cloneable { |
@@ -31,33 +25,33 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
31 | 25 | public PlugIn_TVPtheTelevision clone() { |
32 | 26 | return (PlugIn_TVPtheTelevision) super.clone(); |
33 | 27 | } |
34 | - | |
28 | + | |
35 | 29 | private static final String thisEncoding = "UTF-8"; |
36 | - | |
37 | - | |
30 | + | |
31 | + | |
38 | 32 | /******************************************************************************* |
39 | 33 | * 種族の特性 |
40 | 34 | ******************************************************************************/ |
41 | - | |
35 | + | |
42 | 36 | @Override |
43 | 37 | public String getTVProgramId() { return "webザテレビジョン"; } |
44 | - | |
38 | + | |
45 | 39 | @Override |
46 | 40 | public ProgType getType() { return ProgType.PROG; } |
47 | 41 | @Override |
48 | 42 | public ProgSubtype getSubtype() { return ProgSubtype.TERRA; } |
49 | 43 | |
50 | - | |
44 | + | |
51 | 45 | /******************************************************************************* |
52 | 46 | * 個体の特性 |
53 | 47 | ******************************************************************************/ |
54 | 48 | |
55 | 49 | @Override |
56 | 50 | public int getTimeBarStart() {return 5;} |
57 | - | |
51 | + | |
58 | 52 | //private int getDogDays() { return 7; } |
59 | - | |
60 | - | |
53 | + | |
54 | + | |
61 | 55 | /******************************************************************************* |
62 | 56 | * 定数 |
63 | 57 | ******************************************************************************/ |
@@ -65,58 +59,59 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
65 | 59 | private final String MSGID = "["+getTVProgramId()+"] "; |
66 | 60 | private final String ERRID = "[ERROR]"+MSGID; |
67 | 61 | private final String DBGID = "[DEBUG]"+MSGID; |
68 | - | |
69 | - | |
62 | + | |
63 | + | |
70 | 64 | /******************************************************************************* |
71 | 65 | * 部品 |
72 | 66 | ******************************************************************************/ |
73 | - | |
67 | + | |
74 | 68 | // 新しい入れ物の臨時格納場所 |
75 | 69 | protected ArrayList<ProgList> newplist = new ArrayList<ProgList>(); |
76 | - | |
70 | + | |
77 | 71 | // 未定義のフラグの回収場所 |
78 | 72 | private final HashMap<String,String> nf = new HashMap<String, String>(); |
79 | - | |
80 | - | |
73 | + | |
74 | + | |
81 | 75 | /******************************************************************************* |
82 | 76 | * コンストラクタ |
83 | 77 | ******************************************************************************/ |
84 | - | |
85 | - | |
78 | + | |
79 | + | |
86 | 80 | /******************************************************************************* |
87 | 81 | * 番組情報を取得する |
88 | 82 | ******************************************************************************/ |
89 | - | |
90 | - public void loadProgram(String areaCode, boolean force) { | |
91 | - | |
83 | + | |
84 | + public boolean loadProgram(String areaCode, boolean force) { | |
85 | + | |
92 | 86 | // 入れ物を空にする |
93 | 87 | newplist.clear(); |
94 | - nf.clear(); | |
95 | - | |
88 | + nf.clear(); | |
89 | + | |
96 | 90 | // |
97 | 91 | int counterMax = getSortedCRlist().size(); |
98 | 92 | int counter=1; |
99 | 93 | for ( Center c : getSortedCRlist() ) { |
100 | 94 | _loadProgram(c, force, counter++, counterMax); |
101 | 95 | } |
102 | - | |
96 | + | |
103 | 97 | // 古い番組データを置き換える |
104 | 98 | pcenter = newplist; |
99 | + return true; | |
105 | 100 | } |
106 | - | |
101 | + | |
107 | 102 | /* ここまで */ |
108 | 103 | |
109 | - | |
110 | - | |
104 | + | |
105 | + | |
111 | 106 | /* |
112 | 107 | * 非公開メソッド |
113 | 108 | */ |
114 | - | |
109 | + | |
115 | 110 | protected void _loadProgram(Center cr, boolean force, int counter, int counterMax) { |
116 | 111 | // |
117 | 112 | try { |
118 | 113 | // progfilesの読み出し |
119 | - | |
114 | + | |
120 | 115 | // 局リストの追加 |
121 | 116 | ProgList pl = new ProgList(); |
122 | 117 | pl.Center = cr.getCenter(); |
@@ -147,15 +142,15 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
147 | 142 | else { |
148 | 143 | url = "http://www.television.co.jp/digitalguide/guide24.php?area_pref_key="+pl.Area+"&range=24&type="+pl.Type+"&channel="+pl.CenterId; |
149 | 144 | } |
150 | - | |
145 | + | |
151 | 146 | // Web番組表の読み出し |
152 | 147 | response = webToBuffer(url, thisEncoding, true); |
153 | - | |
148 | + | |
154 | 149 | // キャッシュファイルの保存 |
155 | 150 | if ( ! CommonUtils.write2file(progCacheFile, response) ) { |
156 | 151 | reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: ("+counter+"/"+counterMax+") "+pl.Center+" "+progCacheFile); |
157 | 152 | } |
158 | - | |
153 | + | |
159 | 154 | reportProgress(MSGID+"(オンライン)を取得しました: ("+counter+"/"+counterMax+") "+pl.Center+" "+url); |
160 | 155 | } |
161 | 156 | else if (f.exists()) { |
@@ -173,10 +168,10 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
173 | 168 | |
174 | 169 | // 日付リストの追加 |
175 | 170 | getDateList(pl, response); |
176 | - | |
171 | + | |
177 | 172 | // 番組リストの追加 |
178 | 173 | getPrograms(pl, response); |
179 | - | |
174 | + | |
180 | 175 | // 日付の調整 |
181 | 176 | setAccurateDate(pl.pdate); |
182 | 177 | } |
@@ -185,7 +180,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
185 | 180 | e.printStackTrace(); |
186 | 181 | } |
187 | 182 | } |
188 | - | |
183 | + | |
189 | 184 | // |
190 | 185 | private void getDateList(ProgList pl, String response) { |
191 | 186 | // 日付の処理 |
@@ -195,24 +190,24 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
195 | 190 | while ( mb.find() ) { |
196 | 191 | ProgDateList cl = new ProgDateList(); |
197 | 192 | cl.row = 0; |
198 | - | |
193 | + | |
199 | 194 | int month = Integer.valueOf(mb.group(1)); |
200 | 195 | int day = Integer.valueOf(mb.group(2)); |
201 | 196 | int wday = CommonUtils.getWday(mb.group(3)); |
202 | 197 | cl.Date = CommonUtils.getDateByMD(month, day, wday, true); |
203 | - | |
198 | + | |
204 | 199 | pl.pdate.add(cl); |
205 | 200 | } |
206 | - | |
201 | + | |
207 | 202 | // 8日目は取得できない |
208 | 203 | } |
209 | 204 | } |
210 | - | |
205 | + | |
211 | 206 | // |
212 | 207 | private void getPrograms(ProgList pl, String src) { |
213 | 208 | |
214 | 209 | ArrayList<ProgDateList> pdate = pl.pdate; |
215 | - | |
210 | + | |
216 | 211 | HashMap<String,ProgOption> marks = new HashMap<String,ProgOption>(); |
217 | 212 | marks.put("/function-50.", ProgOption.FIRST); |
218 | 213 | marks.put("/function-201.", ProgOption.BILINGUAL); |
@@ -222,15 +217,15 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
222 | 217 | marks.put("/function-601.", ProgOption.DATA); |
223 | 218 | marks.put("/function-711.", ProgOption.PV); |
224 | 219 | marks.put("/function-nama.", ProgOption.LIVE); |
225 | - | |
220 | + | |
226 | 221 | Matcher ma = Pattern.compile("<td class=\"program (category-(\\d*?)|overhead)\" rowspan=\"(\\d+?)\">(.+?)</td>").matcher(src); |
227 | 222 | while ( ma.find() ) { |
228 | 223 | |
229 | 224 | ProgDetailList pdl = new ProgDetailList(); |
230 | - | |
225 | + | |
231 | 226 | // 番組長 |
232 | 227 | pdl.length = Integer.valueOf(ma.group(3)); |
233 | - | |
228 | + | |
234 | 229 | // 挿入位置決定 |
235 | 230 | int col = -1; |
236 | 231 | int rowMin = 9999; |
@@ -244,10 +239,10 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
244 | 239 | System.err.println(ERRID+"番組情報の挿入先がみつかりません"); |
245 | 240 | return; |
246 | 241 | } |
247 | - | |
242 | + | |
248 | 243 | pdate.get(col).pdetail.add(pdl); |
249 | 244 | pdate.get(col).row += pdl.length; |
250 | - | |
245 | + | |
251 | 246 | // 詳細設定 |
252 | 247 | if ( ma.group(2) == null ) { |
253 | 248 | pdl.title = pdl.splitted_title = "番組情報がありません"; |
@@ -291,7 +286,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
291 | 286 | pdl.genre = ProgGenre.WELFARE; |
292 | 287 | } |
293 | 288 | else if (ma.group(2).equals("14")) { |
294 | - // 拡張エリア - 広帯域CS デジタル放送拡張用情報 映画 - 邦画 | |
289 | + // 拡張エリア - 広帯域CS デジタル放送拡張用情報 映画 - 邦画 | |
295 | 290 | pdl.genre = ProgGenre.MOVIE; |
296 | 291 | } |
297 | 292 | else if (ma.group(2).equals("15")) { |
@@ -303,13 +298,13 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
303 | 298 | } |
304 | 299 | pdl.genre = ProgGenre.NOGENRE; |
305 | 300 | } |
306 | - | |
301 | + | |
307 | 302 | // 番組タイトル+α |
308 | 303 | // 1 : dummy |
309 | 304 | // 2 : id-a |
310 | 305 | // 3 : id-b |
311 | 306 | // 4 : title |
312 | - | |
307 | + | |
313 | 308 | // マークを取り出してみる |
314 | 309 | Matcher mb = Pattern.compile("(/function-.+?\\.)").matcher(ma.group(4)); |
315 | 310 | while ( mb.find() ) { |
@@ -320,14 +315,14 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
320 | 315 | } |
321 | 316 | } |
322 | 317 | } |
323 | - | |
318 | + | |
324 | 319 | // 番組詳細 |
325 | 320 | { |
326 | 321 | mb = Pattern.compile("<div class=\"subtitle\">(.*?)</div>").matcher(ma.group(4)); |
327 | 322 | if ( mb.find() ) { |
328 | 323 | pdl.detail = mb.group(1); |
329 | 324 | } |
330 | - | |
325 | + | |
331 | 326 | mb = Pattern.compile("<div name=\"programcontent\" class=\"content\">((【.+?】)*)(.*?)</div>").matcher(ma.group(4)); |
332 | 327 | if ( mb.find() ) { |
333 | 328 | // 番組詳細の「先頭」に新番組マークなどがある場合がある。ない場合もある。 |
@@ -350,7 +345,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
350 | 345 | // マーク以降 |
351 | 346 | pdl.detail += mb.group(3); |
352 | 347 | } |
353 | - | |
348 | + | |
354 | 349 | // 記号を文字化する |
355 | 350 | pdl.detail = Pattern.compile("(<img .+? alt=\"(.+?)\"/>)",Pattern.DOTALL).matcher(pdl.detail).replaceAll("$2").trim(); |
356 | 351 | } |
@@ -363,7 +358,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
363 | 358 | while ( mc.find() ) { |
364 | 359 | pdl.title = pdl.title.replace(mc.group(1),mc.group(3)); |
365 | 360 | } |
366 | - | |
361 | + | |
367 | 362 | if (mb.group(2) != null) { |
368 | 363 | pdl.link = "http://www.television.co.jp/digitalguide/detail.php?id="+mb.group(2); |
369 | 364 | } |
@@ -380,30 +375,30 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
380 | 375 | |
381 | 376 | // サブタイトル分離 |
382 | 377 | doSplitSubtitle(pdl); |
383 | - | |
378 | + | |
384 | 379 | if ( ma.group(4).indexOf("\"再放送\"") >= 0 ) { |
385 | 380 | pdl.addOption(ProgOption.REPEAT); |
386 | 381 | } |
387 | - | |
382 | + | |
388 | 383 | if ( ma.group(4).indexOf("\"生放送\"") >= 0 ) { |
389 | 384 | pdl.addOption(ProgOption.LIVE); |
390 | 385 | } |
391 | - | |
386 | + | |
392 | 387 | if ( ma.group(4).indexOf("\"無料放送\"") >= 0 ) { |
393 | 388 | pdl.noscrumble = ProgScrumble.NOSCRUMBLE; |
394 | 389 | } |
395 | - | |
390 | + | |
396 | 391 | if ( ma.group(4).indexOf("function-a.") >= 0 ) { |
397 | 392 | pdl.flag = ProgFlags.NEW; |
398 | 393 | } |
399 | 394 | else if ( ma.group(4).indexOf("function-l.") >= 0 ) { |
400 | 395 | pdl.flag = ProgFlags.LAST; |
401 | 396 | } |
402 | - | |
397 | + | |
403 | 398 | if ( ma.group(4).indexOf("function-50.") >= 0 ) { |
404 | 399 | pdl.addOption(ProgOption.FIRST); |
405 | 400 | } |
406 | - | |
401 | + | |
407 | 402 | // 番組ID |
408 | 403 | try { |
409 | 404 | int hdr = 0; |
@@ -424,22 +419,22 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
424 | 419 | catch (NumberFormatException e) { |
425 | 420 | System.err.println("[ERROR] invalid chcode format "+pl.Center+" "+pl.CenterId+" "+e.toString()); |
426 | 421 | } |
427 | - | |
422 | + | |
428 | 423 | // 開始・終了時刻 |
429 | 424 | mb = Pattern.compile("<b>(\\d+):(\\d+)</b>").matcher(ma.group(4)); |
430 | 425 | if ( mb.find() ) { |
431 | 426 | GregorianCalendar c = new GregorianCalendar(Locale.JAPAN); |
432 | - | |
427 | + | |
433 | 428 | int ahh = Integer.valueOf(mb.group(1)); |
434 | 429 | int amm = Integer.valueOf(mb.group(2)); |
435 | 430 | pdl.start = String.format("%02d:%02d", ahh, amm); |
436 | - | |
431 | + | |
437 | 432 | c.set(Calendar.HOUR_OF_DAY, ahh); |
438 | 433 | c.set(Calendar.MINUTE, amm); |
439 | 434 | c.add(Calendar.MINUTE,pdl.length); |
440 | 435 | pdl.end = String.format("%02d:%02d", c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE)); |
441 | 436 | } |
442 | - | |
437 | + | |
443 | 438 | // |
444 | 439 | pdl.extension = false; |
445 | 440 | //pdl.flag = ProgFlags.NOFLAG; |
@@ -447,28 +442,28 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
447 | 442 | } |
448 | 443 | } |
449 | 444 | } |
450 | - | |
451 | - | |
445 | + | |
446 | + | |
452 | 447 | /******************************************************************************* |
453 | 448 | * 地域情報を取得する |
454 | 449 | ******************************************************************************/ |
455 | - | |
450 | + | |
456 | 451 | // 普通は東京 |
457 | 452 | @Override |
458 | 453 | public String getDefaultArea() {return "東京";} |
459 | - | |
454 | + | |
460 | 455 | // |
461 | 456 | public void loadAreaCode() { |
462 | - | |
457 | + | |
463 | 458 | // 設定ファイルが存在していればファイルから |
464 | 459 | File f = new File(getAreaSelectedFile()); |
465 | 460 | if (f.exists() == true) { |
466 | 461 | @SuppressWarnings("unchecked") |
467 | 462 | ArrayList<AreaCode> tmp = (ArrayList<AreaCode>) CommonUtils.readXML(getAreaSelectedFile()); |
468 | 463 | if ( tmp != null ) { |
469 | - | |
464 | + | |
470 | 465 | aclist = tmp; |
471 | - | |
466 | + | |
472 | 467 | // 後方互換 |
473 | 468 | { |
474 | 469 | boolean bsflg = false; |
@@ -483,11 +478,11 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
483 | 478 | ac.setArea("BS"); |
484 | 479 | ac.setCode(bsCode); |
485 | 480 | aclist.add(ac); |
486 | - | |
481 | + | |
487 | 482 | saveAreaCode(); |
488 | 483 | } |
489 | 484 | } |
490 | - | |
485 | + | |
491 | 486 | System.out.println("地域リストを読み込みました: "+getAreaSelectedFile()); |
492 | 487 | return; |
493 | 488 | } |
@@ -498,7 +493,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
498 | 493 | |
499 | 494 | // 地域一覧の作成 |
500 | 495 | ArrayList<AreaCode> newaclist = new ArrayList<AreaCode>(); |
501 | - | |
496 | + | |
502 | 497 | // 存在していなければWeb上から |
503 | 498 | String uri = "http://www.television.co.jp/digitalguide/map.html"; |
504 | 499 | String response = webToBuffer(uri,thisEncoding,true); |
@@ -506,7 +501,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
506 | 501 | System.out.println("地域情報の取得に失敗しました: "+uri); |
507 | 502 | return; |
508 | 503 | } |
509 | - | |
504 | + | |
510 | 505 | { |
511 | 506 | // 北海道 |
512 | 507 | Matcher ma = Pattern.compile("<option value=\"([^\"]+?)\">(.+?)</option>").matcher(response); |
@@ -516,7 +511,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
516 | 511 | ac.setCode(ma.group(1)); |
517 | 512 | newaclist.add(ac); |
518 | 513 | } |
519 | - | |
514 | + | |
520 | 515 | // 北海道以外 |
521 | 516 | ma = Pattern.compile("\"javascript:setPref\\('(.+?)'\\)\">(.+?)</a>").matcher(response); |
522 | 517 | while (ma.find()) { |
@@ -526,12 +521,12 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
526 | 521 | newaclist.add(ac); |
527 | 522 | } |
528 | 523 | } |
529 | - | |
524 | + | |
530 | 525 | if ( newaclist.size() == 0 ) { |
531 | 526 | System.err.println(ERRID+"地域一覧の取得結果が0件だったため情報を更新しません"); |
532 | 527 | return; |
533 | 528 | } |
534 | - | |
529 | + | |
535 | 530 | { |
536 | 531 | { |
537 | 532 | AreaCode ac = new AreaCode(); |
@@ -546,11 +541,11 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
546 | 541 | newaclist.add(ac); |
547 | 542 | } |
548 | 543 | } |
549 | - | |
544 | + | |
550 | 545 | aclist = newaclist; |
551 | 546 | saveAreaCode(); |
552 | 547 | } |
553 | - | |
548 | + | |
554 | 549 | |
555 | 550 | /******************************************************************************* |
556 | 551 | * 放送局情報を取得する |
@@ -558,28 +553,28 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
558 | 553 | |
559 | 554 | // 設定ファイルがなければWebから取得 |
560 | 555 | public void loadCenter(String code, boolean force) { |
561 | - | |
556 | + | |
562 | 557 | if ( code == null ) { |
563 | 558 | System.out.println(ERRID+"地域コードがnullです."); |
564 | 559 | return; |
565 | 560 | } |
566 | - | |
561 | + | |
567 | 562 | String centerListFile = getCenterListFile(getTVProgramId(), code); |
568 | - | |
563 | + | |
569 | 564 | if (force) { |
570 | 565 | File f = new File(centerListFile); |
571 | 566 | f.delete(); |
572 | 567 | } |
573 | - | |
568 | + | |
574 | 569 | File f = new File(centerListFile); |
575 | 570 | if (f.exists() == true) { |
576 | 571 | @SuppressWarnings("unchecked") |
577 | 572 | ArrayList<Center> tmp = (ArrayList<Center>) CommonUtils.readXML(centerListFile); |
578 | 573 | if ( tmp != null ) { |
579 | - | |
574 | + | |
580 | 575 | crlist = tmp; |
581 | 576 | attachChFilters(); // 放送局名変換 |
582 | - | |
577 | + | |
583 | 578 | // 後方互換 |
584 | 579 | for (Center c : crlist) { |
585 | 580 | if ( c.getType().equals(bsCode) && ! c.getAreaCode().equals(bsCode)) { |
@@ -594,13 +589,13 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
594 | 589 | System.err.println("放送局リストの読み込みに失敗しました: "+centerListFile); |
595 | 590 | } |
596 | 591 | } |
597 | - | |
592 | + | |
598 | 593 | // Web上から放送局の一覧を取得する |
599 | 594 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
600 | - | |
595 | + | |
601 | 596 | int cntMax = ((code.equals(allCode))?(aclist.size()-2):(1)) + 1; |
602 | 597 | int cnt = 1; |
603 | - | |
598 | + | |
604 | 599 | // 地上波 |
605 | 600 | if (code.equals(allCode)) { |
606 | 601 | for (AreaCode ac : aclist) { |
@@ -620,7 +615,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
620 | 615 | } |
621 | 616 | cnt++; |
622 | 617 | } |
623 | - | |
618 | + | |
624 | 619 | // BS |
625 | 620 | { |
626 | 621 | String url = "http://www.television.co.jp/digitalguide/guide.php?type=bs"; |
@@ -629,34 +624,34 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
629 | 624 | } |
630 | 625 | cnt++; |
631 | 626 | } |
632 | - | |
627 | + | |
633 | 628 | if ( newcrlist.size() == 0 ) { |
634 | 629 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
635 | 630 | return; |
636 | 631 | } |
637 | - | |
632 | + | |
638 | 633 | crlist = newcrlist; |
639 | 634 | attachChFilters(); // 放送局名変換 |
640 | 635 | saveCenter(); // 保存 |
641 | 636 | } |
642 | - | |
637 | + | |
643 | 638 | protected boolean _loadCenter(ArrayList<Center> newcrlist, String code, String type, String uri) { |
644 | - | |
639 | + | |
645 | 640 | String response = webToBuffer(uri,thisEncoding,true); |
646 | 641 | if ( response == null ) { |
647 | 642 | System.err.println("放送局情報の取得に失敗しました: "+uri); |
648 | 643 | return false; |
649 | 644 | } |
650 | - | |
645 | + | |
651 | 646 | // 局名リストに追加する |
652 | - | |
647 | + | |
653 | 648 | Matcher ma = Pattern.compile("<td><select(.+?)</select>").matcher(response); |
654 | 649 | if (ma.find()) { |
655 | 650 | Matcher mb = Pattern.compile("<option value=\"([^\"]+?)\">\\s*( )*(.+?)\\s*</option>").matcher(ma.group(1)); |
656 | 651 | while (mb.find()) { |
657 | 652 | String centerName = CommonUtils.unEscape(mb.group(3)); |
658 | 653 | String centerId = mb.group(1); |
659 | - | |
654 | + | |
660 | 655 | // NHK総合・NHK教育 |
661 | 656 | if ( type.equals("tv") ) { |
662 | 657 | Matcher mc = Pattern.compile("^NHK(総合|Eテレ)(\\d+)・?(.+)$").matcher(centerName); |
@@ -679,7 +674,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
679 | 674 | } |
680 | 675 | } |
681 | 676 | } |
682 | - | |
677 | + | |
683 | 678 | Center cr = new Center(); |
684 | 679 | cr.setAreaCode(code); |
685 | 680 | cr.setCenterOrig(centerName); |
@@ -689,8 +684,8 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
689 | 684 | newcrlist.add(cr); |
690 | 685 | } |
691 | 686 | } |
692 | - | |
687 | + | |
693 | 688 | return true; |
694 | 689 | } |
695 | - | |
690 | + | |
696 | 691 | } |
@@ -1,7 +1,5 @@ | ||
1 | 1 | package tainavi.plugintv; |
2 | 2 | |
3 | -import tainavi.*; | |
4 | - | |
5 | 3 | import java.io.File; |
6 | 4 | import java.util.ArrayList; |
7 | 5 | import java.util.Calendar; |
@@ -9,37 +7,47 @@ import java.util.GregorianCalendar; | ||
9 | 7 | import java.util.regex.Matcher; |
10 | 8 | import java.util.regex.Pattern; |
11 | 9 | |
10 | +import tainavi.Center; | |
11 | +import tainavi.CommonUtils; | |
12 | +import tainavi.ContentIdSyobo; | |
13 | +import tainavi.ProgDateList; | |
14 | +import tainavi.ProgDetailList; | |
15 | +import tainavi.ProgList; | |
16 | +import tainavi.TVProgram; | |
17 | +import tainavi.TVProgramUtils; | |
18 | +import tainavi.TraceProgram; | |
19 | + | |
12 | 20 | /** |
13 | 21 | * しょぼかるから番組表と放送局リストを取得する。プラグインではないよ。 |
14 | 22 | */ |
15 | 23 | public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { |
16 | 24 | |
17 | 25 | private final String thisEncoding = "UTF-8"; |
18 | - | |
26 | + | |
19 | 27 | public void setDebug(boolean b) { debug = b; } |
20 | - | |
28 | + | |
21 | 29 | private boolean debug = false; |
22 | - | |
30 | + | |
23 | 31 | private boolean rss2 = false; |
24 | 32 | |
25 | 33 | /* 必須コード - ここから */ |
26 | - | |
34 | + | |
27 | 35 | // 種族の特性 |
28 | 36 | private static final String tvProgId = "Syobocal"; |
29 | - | |
37 | + | |
30 | 38 | //private final String progCacheFile = getProgDir()+File.separator+"syobocal.xml"; |
31 | - private final String centerFile = "env"+File.separator+"center."+getTVProgramId()+".xml"; | |
32 | - | |
39 | + private final String centerFile = "env"+File.separator+"center."+getTVProgramId()+".xml"; | |
40 | + | |
33 | 41 | private final String MSGID = "[しょぼかる] "; |
34 | 42 | private final String ERRID = "[ERROR]"+MSGID; |
35 | 43 | private final String DBGID = "[DEBUG]"+MSGID; |
36 | - | |
44 | + | |
37 | 45 | @Override |
38 | 46 | public String getTVProgramId() { return tvProgId; } |
39 | - | |
47 | + | |
40 | 48 | @Override |
41 | 49 | public boolean isAreaSelectSupported() { return false; } |
42 | - | |
50 | + | |
43 | 51 | @Override |
44 | 52 | public ProgType getType() { return ProgType.SYOBO; } |
45 | 53 | public ProgSubtype getSubtype() { return ProgSubtype.NONE; } |
@@ -50,16 +58,16 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
50 | 58 | } |
51 | 59 | |
52 | 60 | // 個体の特性 |
53 | - | |
61 | + | |
54 | 62 | // |
55 | 63 | @Override |
56 | 64 | public int getTimeBarStart() {return 5;} |
57 | 65 | |
58 | 66 | private int getDogDays() { return ((getExpandTo8())?(8):(7)); } |
59 | - | |
67 | + | |
60 | 68 | // |
61 | 69 | @Override |
62 | - public void loadProgram(String areaCode, boolean force) { | |
70 | + public boolean loadProgram(String areaCode, boolean force) { | |
63 | 71 | |
64 | 72 | String progCacheFile = null; |
65 | 73 | if ( rss2 ) { |
@@ -68,22 +76,22 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
68 | 76 | else { |
69 | 77 | progCacheFile = getProgDir()+File.separator+"syobocal.rss"; |
70 | 78 | } |
71 | - | |
79 | + | |
72 | 80 | // 新しい番組データの入れ物を作る |
73 | 81 | ArrayList<ProgList> newplist = new ArrayList<ProgList>(); |
74 | 82 | |
75 | 83 | int cnt = 0; |
76 | - | |
84 | + | |
77 | 85 | try { |
78 | 86 | String response = null; |
79 | - | |
87 | + | |
80 | 88 | String cirtDateTimeYMD = CommonUtils.getCritDateTime().replaceAll("[/: ]", ""); |
81 | - | |
89 | + | |
82 | 90 | File f = new File(progCacheFile); |
83 | 91 | if (force == true || |
84 | 92 | (f.exists() == true && isCacheOld(progCacheFile) == true) || |
85 | 93 | (f.exists() == false && isCacheOld(null) == true)) { |
86 | - | |
94 | + | |
87 | 95 | String url = null; |
88 | 96 | if ( rss2 ) { |
89 | 97 | url = "http://cal.syoboi.jp/rss2.php?start="+cirtDateTimeYMD+"&days="+getDogDays()+"&titlefmt=$(Flag)^^^$(FlagW)^^^$(Cat)^^^$(ChName)^^^$(EdTime)^^^$(Title)^^^$(SubTitleB)"; |
@@ -94,9 +102,9 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
94 | 102 | response = webToBuffer(url, thisEncoding, true); |
95 | 103 | if ( response == null ) { |
96 | 104 | reportProgress(ERRID+"RSS2.0(オンライン)の取得に失敗しました: "+url); |
97 | - return; | |
105 | + return false; | |
98 | 106 | } |
99 | - | |
107 | + | |
100 | 108 | reportProgress(MSGID+"RSS2.0(オンライン)を取得しました: "+url); |
101 | 109 | CommonUtils.write2file(progCacheFile, response); |
102 | 110 | } |
@@ -105,42 +113,42 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
105 | 113 | response = CommonUtils.read4file(progCacheFile, true); |
106 | 114 | if ( response == null ) { |
107 | 115 | reportProgress(ERRID+"RSS2.0(キャッシュ)の取得に失敗しました: "+progCacheFile); |
108 | - return; | |
116 | + return false; | |
109 | 117 | } |
110 | 118 | reportProgress(MSGID+"RSS2.0(キャッシュ)を取得しました: "+progCacheFile); |
111 | 119 | } |
112 | 120 | else { |
113 | 121 | reportProgress(ERRID+"RSS2.0(キャッシュ)がみつかりません: "+progCacheFile); |
114 | - return; | |
122 | + return false; | |
115 | 123 | } |
116 | - | |
124 | + | |
117 | 125 | // 情報解析 |
118 | - | |
126 | + | |
119 | 127 | Matcher ma = Pattern.compile("<item(.+?)</item>",Pattern.DOTALL).matcher(response); |
120 | 128 | while (ma.find()) { |
121 | 129 | |
122 | 130 | // 入れ物 |
123 | 131 | ProgDetailList pDetail = new ProgDetailList(); |
124 | - | |
125 | - // <title>金曜ロードショー ヱヴァンゲリヲン新劇場版:破 TV版</title> | |
132 | + | |
133 | + // <title>金曜ロードショー ヱヴァンゲリヲン新劇場版:破 TV版</title> | |
126 | 134 | Matcher mb = Pattern.compile("<title>(.+?)</title>",Pattern.DOTALL).matcher(ma.group(1)); |
127 | 135 | if ( ! mb.find()) { |
128 | 136 | continue; |
129 | 137 | } |
130 | - | |
138 | + | |
131 | 139 | String[] t = mb.group(1).split("\\^\\^\\^",7); |
132 | - | |
140 | + | |
133 | 141 | if (t.length < 7) { |
134 | 142 | System.err.println(ERRID+"書式が不正: "+mb.group(1)); |
135 | 143 | } |
136 | - | |
144 | + | |
137 | 145 | pDetail.title = CommonUtils.unEscape(t[5]); |
138 | - | |
146 | + | |
139 | 147 | pDetail.detail = CommonUtils.unEscape(t[6]); |
140 | 148 | if ( pDetail.detail.matches("^#1$|^#1[^0-9].*$") ) { |
141 | 149 | // まあなにもしなくていいか |
142 | 150 | } |
143 | - | |
151 | + | |
144 | 152 | if (t[0] != null && t[0].length() > 0) { |
145 | 153 | int flag = Integer.valueOf(t[0]); |
146 | 154 | if (flag != 0) { |
@@ -185,7 +193,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
185 | 193 | pDetail.genrelist = new ArrayList<TVProgram.ProgGenre>(); |
186 | 194 | pDetail.subgenrelist = new ArrayList<TVProgram.ProgSubgenre>(); |
187 | 195 | boolean anime_etc = true; |
188 | - | |
196 | + | |
189 | 197 | if (t[2] != null && t[2].length() > 0) { |
190 | 198 | // ジャンル |
191 | 199 | if (t[2].equals("1") || t[2].equals("10") || t[2].equals("5")) { |
@@ -226,7 +234,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
226 | 234 | else { |
227 | 235 | System.out.println(DBGID+"未対応のジャンル: "+t[2]); |
228 | 236 | } |
229 | - | |
237 | + | |
230 | 238 | // 最後に |
231 | 239 | if (pDetail.genre == null) { |
232 | 240 | pDetail.genre = ProgGenre.ANIME; |
@@ -237,13 +245,13 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
237 | 245 | pDetail.subgenrelist.add(ProgSubgenre.ANIME_ETC); |
238 | 246 | } |
239 | 247 | } |
240 | - | |
248 | + | |
241 | 249 | // <dc:publisher>日本テレビ</dc:publisher> |
242 | 250 | if ( t[3] == null || t[3].length() == 0) { |
243 | 251 | System.err.println(ERRID+"放送局名がない: "+mb.group(1)); |
244 | 252 | continue; |
245 | 253 | } |
246 | - | |
254 | + | |
247 | 255 | // ベアな放送局名と、ChannelConvert.datを適用した結果の放送局名 |
248 | 256 | String location = CommonUtils.unEscape(t[3]); |
249 | 257 | String modifiedloc = getChName(location); |
@@ -264,32 +272,32 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
264 | 272 | System.err.println(ERRID+"開始日時が不正: "+mb.group(1)); |
265 | 273 | continue; |
266 | 274 | } |
267 | - | |
275 | + | |
268 | 276 | pDetail.startDateTime = CommonUtils.getDateTime(ca); |
269 | 277 | pDetail.start = pDetail.startDateTime.substring(11, 16); |
270 | 278 | pDetail.accurateDate = CommonUtils.getDate(ca); |
271 | - | |
279 | + | |
272 | 280 | if ( t[4] == null || t[4].length() == 0) { |
273 | 281 | System.err.println(ERRID+"終了時刻がない: "+mb.group(1)); |
274 | 282 | continue; |
275 | 283 | } |
276 | - | |
284 | + | |
277 | 285 | GregorianCalendar cz = CommonUtils.getCalendar(CommonUtils.getDate(ca)+" "+t[4]); |
278 | 286 | if (ca.compareTo(cz) > 0) { |
279 | 287 | cz.add(Calendar.DAY_OF_MONTH, 1); |
280 | 288 | } |
281 | - | |
289 | + | |
282 | 290 | pDetail.endDateTime = CommonUtils.getDateTime(cz); |
283 | 291 | pDetail.end = pDetail.endDateTime.substring(11, 16); |
284 | - | |
292 | + | |
285 | 293 | // 24:00~28:59までは前日なんだニャー |
286 | 294 | if (CommonUtils.isLateNight(ca.get(Calendar.HOUR_OF_DAY))) { |
287 | 295 | ca.add(Calendar.DAY_OF_MONTH, -1); |
288 | 296 | } |
289 | - | |
297 | + | |
290 | 298 | // 番組情報を入れるべき日付 |
291 | 299 | String progdate = CommonUtils.getDate(ca); |
292 | - | |
300 | + | |
293 | 301 | // <description>HD放送</description> |
294 | 302 | mb = Pattern.compile("<description>(.+?)</description>").matcher(ma.group(1)); |
295 | 303 | if (mb.find()) { |
@@ -310,8 +318,8 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
310 | 318 | pDetail.addOption(ProgOption.MULTIVOICE); |
311 | 319 | } |
312 | 320 | } |
313 | - | |
314 | - // <link>http://cal.syoboi.jp/tid/44#198593</link> | |
321 | + | |
322 | + // <link>http://cal.syoboi.jp/tid/44#198593</link> | |
315 | 323 | mb = Pattern.compile("<link>(.+?)</link>",Pattern.DOTALL).matcher(ma.group(1)); |
316 | 324 | if (mb.find()) { |
317 | 325 | pDetail.link = mb.group(1); |
@@ -319,10 +327,10 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
319 | 327 | System.out.println(DBGID+"TIDとPIDが取得できない: "+pDetail.link); |
320 | 328 | } |
321 | 329 | } |
322 | - | |
330 | + | |
323 | 331 | // 追加詳細 |
324 | 332 | pDetail.setGenreStr(); |
325 | - | |
333 | + | |
326 | 334 | // 統合 |
327 | 335 | { |
328 | 336 | // 放送局が存在するか |
@@ -339,10 +347,10 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
339 | 347 | prog.Center = modifiedloc; |
340 | 348 | prog.enabled = true; |
341 | 349 | prog.pdate = new ArrayList<ProgDateList>(); |
342 | - | |
350 | + | |
343 | 351 | newplist.add(prog); |
344 | 352 | } |
345 | - | |
353 | + | |
346 | 354 | // 日付が存在するか |
347 | 355 | ProgDateList pCenter = null; |
348 | 356 | for (ProgDateList pcl : prog.pdate) { |
@@ -357,17 +365,17 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
357 | 365 | pCenter.pdetail = new ArrayList<ProgDetailList>(); |
358 | 366 | prog.pdate.add(pCenter); |
359 | 367 | } |
360 | - | |
368 | + | |
361 | 369 | // 連結 |
362 | 370 | pCenter.pdetail.add(pDetail); |
363 | - | |
371 | + | |
364 | 372 | cnt++; |
365 | 373 | } |
366 | - | |
374 | + | |
367 | 375 | // |
368 | 376 | pDetail.splitted_title = pDetail.title; |
369 | 377 | pDetail.splitted_detail = pDetail.detail; |
370 | - | |
378 | + | |
371 | 379 | // 詳細を登録する |
372 | 380 | pDetail.titlePop = TraceProgram.replacePop(pDetail.title); |
373 | 381 | pDetail.splitted_titlePop = pDetail.titlePop; |
@@ -377,11 +385,12 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
377 | 385 | } |
378 | 386 | catch (Exception e) { |
379 | 387 | e.printStackTrace(); |
380 | - return; | |
388 | + return false; | |
381 | 389 | } |
382 | - | |
390 | + | |
383 | 391 | pcenter = newplist; |
384 | 392 | System.out.println(DBGID+"番組の数: "+cnt); |
393 | + return true; | |
385 | 394 | } |
386 | 395 | |
387 | 396 | /* ここまで */ |
@@ -399,7 +408,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
399 | 408 | @Override |
400 | 409 | public void saveAreaCode() { |
401 | 410 | } |
402 | - | |
411 | + | |
403 | 412 | @Override |
404 | 413 | public String getCode(String area) { |
405 | 414 | return "1"; |
@@ -419,7 +428,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
419 | 428 | public String getSelectedCode() { |
420 | 429 | return "1"; |
421 | 430 | } |
422 | - | |
431 | + | |
423 | 432 | /* |
424 | 433 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
425 | 434 | * ★★★★★ 放送地域を取得する(TVAreaから降格)-ここまで ★★★★★ |
@@ -434,12 +443,12 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
434 | 443 | |
435 | 444 | @Override |
436 | 445 | public void loadCenter(String code, boolean force) { |
437 | - | |
446 | + | |
438 | 447 | if ( code == null ) { |
439 | 448 | System.out.println(ERRID+"地域コードがnullです."); |
440 | 449 | return; |
441 | 450 | } |
442 | - | |
451 | + | |
443 | 452 | if ( ! force && new File(centerFile).exists() ) { |
444 | 453 | // NOT FORFCEならキャッシュからどうぞ |
445 | 454 | @SuppressWarnings("unchecked") |
@@ -449,7 +458,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
449 | 458 | return; |
450 | 459 | } |
451 | 460 | } |
452 | - | |
461 | + | |
453 | 462 | String uri = "http://cal.syoboi.jp/mng?Action=ShowChList"; |
454 | 463 | String response = webToBuffer(uri,thisEncoding,true); |
455 | 464 | if ( response == null ) { |
@@ -457,16 +466,16 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
457 | 466 | return; |
458 | 467 | } |
459 | 468 | System.out.println(MSGID+"放送局リストを取得: "+uri); |
460 | - | |
469 | + | |
461 | 470 | Matcher ma = Pattern.compile("<table class=\"tframe output\".*?>(.+?)</table>",Pattern.DOTALL).matcher(response); |
462 | 471 | if ( ! ma.find() ) { |
463 | 472 | System.err.println(ERRID+"放送局情報がない: "+uri); |
464 | 473 | return; |
465 | 474 | } |
466 | - | |
475 | + | |
467 | 476 | // 新しい放送局リストの入れ物を作る |
468 | 477 | ArrayList<Center> newcrlist = new ArrayList<Center>(); |
469 | - | |
478 | + | |
470 | 479 | int cnt = 1; |
471 | 480 | Matcher mb = Pattern.compile("<tr>(.+?)</tr>",Pattern.DOTALL).matcher(ma.group(1)); |
472 | 481 | while ( mb.find() ) { |
@@ -478,7 +487,7 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
478 | 487 | if ( ! d[1].matches("^\\d+$") ) { |
479 | 488 | continue; |
480 | 489 | } |
481 | - | |
490 | + | |
482 | 491 | // 放送局リスト |
483 | 492 | Center cr = new Center(); |
484 | 493 | cr.setLink(d[5]); |
@@ -488,30 +497,30 @@ public class Syobocal extends TVProgramUtils implements TVProgram,Cloneable { | ||
488 | 497 | cr.setType(""); |
489 | 498 | cr.setEnabled(true); |
490 | 499 | cr.setOrder(cnt++); |
491 | - | |
500 | + | |
492 | 501 | newcrlist.add(cr); |
493 | - | |
502 | + | |
494 | 503 | if (debug) System.out.println(MSGID+"放送局を追加: "+cr.getCenterOrig()+" -> "+cr.getCenter()); |
495 | 504 | } |
496 | - | |
505 | + | |
497 | 506 | if ( newcrlist.size() == 0 ) { |
498 | 507 | System.err.println(ERRID+"放送局情報の取得結果が0件だったため情報を更新しません"); |
499 | 508 | return; |
500 | 509 | } |
501 | 510 | |
502 | 511 | System.out.println(DBGID+"放送局の数: "+newcrlist.size()); |
503 | - | |
512 | + | |
504 | 513 | crlist = newcrlist; |
505 | 514 | attachChFilters(); |
506 | 515 | setSortedCRlist(); |
507 | 516 | CommonUtils.writeXML(centerFile, crlist); |
508 | 517 | } |
509 | - | |
518 | + | |
510 | 519 | @Override |
511 | 520 | public boolean saveCenter() { |
512 | 521 | return false; |
513 | 522 | } |
514 | - | |
523 | + | |
515 | 524 | /* |
516 | 525 | * ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ |
517 | 526 | * ★★★★★ 放送局を選択する(TVCenterから降格)-ここまで ★★★★★ |