タイニー番組ナビゲータ本体
Revision | 5514c5c3a0df8a22ec8f0eba27e9df9f77050d87 (tree) |
---|---|
Zeit | 2019-06-15 00:35:27 |
Autor | Masahiko Kimura <mkimura@u01....> |
Commiter | Masahiko Kimura |
Ver.1.12 (2019/06/15):
@@ -762,8 +762,8 @@ public abstract class AbsChannelSortView extends JScrollPane { | ||
762 | 762 | } |
763 | 763 | |
764 | 764 | // 1行ごとに背景色を互い違いにする。またソートが無効な場合はグレーアウト |
765 | - int page = 1 + getPageIndex(1+this.convertRowIndexToView(row)); | |
766 | - int pagemax = 1 + getPageIndex(rowData.size()); | |
765 | + int page = 1 + getPageIndex(this.convertRowIndexToView(row)); | |
766 | + int pagemax = 1 + getPageIndex(rowData.size()-1); | |
767 | 767 | String color = ( ! jtgl_chsort.isSelected())?(PAGEDIS_COLOR):((page % 2 == 0)?(PAGEEN_ODD_COLOR):(PAGEEN_EVEN_COLOR)); |
768 | 768 | String text = String.format("%d / %d", page, pagemax); |
769 | 769 | return CommonSwingUtils.getColoredString(color, text); |
@@ -786,7 +786,7 @@ public abstract class AbsChannelSortView extends JScrollPane { | ||
786 | 786 | public int getPageIndex(int n) { |
787 | 787 | if (pageBreaks.size() > 0){ |
788 | 788 | for (int pno=0; pno<pageBreaks.size(); pno++){ |
789 | - if (n <= pageBreaks.get(pno)){ | |
789 | + if (n < pageBreaks.get(pno)){ | |
790 | 790 | return pno; |
791 | 791 | } |
792 | 792 | } |
@@ -795,6 +795,6 @@ public abstract class AbsChannelSortView extends JScrollPane { | ||
795 | 795 | } |
796 | 796 | |
797 | 797 | int rem = n % centerPerPage; |
798 | - return (n-rem)/centerPerPage + ((rem==0)?(0):(1)) - 1; | |
798 | + return (n-rem)/centerPerPage; | |
799 | 799 | } |
800 | 800 | } |
@@ -113,6 +113,7 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener | ||
113 | 113 | |
114 | 114 | protected abstract void ringBeep(); |
115 | 115 | |
116 | + protected abstract void updateBatchReservationEnabled(); | |
116 | 117 | // クラス内のイベントから呼び出されるもの |
117 | 118 | |
118 | 119 | /** |
@@ -1700,6 +1701,8 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener | ||
1700 | 1701 | jTextPane_detail.setLabel("","",""); |
1701 | 1702 | jTextPane_detail.setText(""); |
1702 | 1703 | } |
1704 | + | |
1705 | + updateBatchReservationEnabled(); | |
1703 | 1706 | } |
1704 | 1707 | }; |
1705 | 1708 |
@@ -2440,6 +2443,13 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener | ||
2440 | 2443 | } |
2441 | 2444 | } |
2442 | 2445 | |
2446 | + /* | |
2447 | + * リストの選択行を取得する | |
2448 | + */ | |
2449 | + public int getSelectedRowCount(){ | |
2450 | + return jTable_listed.getSelectedRowCount(); | |
2451 | + } | |
2452 | + | |
2443 | 2453 | /** |
2444 | 2454 | * 他のクラスで発生したイベント中に呼び出されてリスト形式の予約マーク表示を更新するためのメソッド。 |
2445 | 2455 | * ★synchronized(rowData)★ |
@@ -3990,7 +4000,7 @@ public abstract class AbsListedView extends JPanel implements TickTimerListener | ||
3990 | 4000 | ter.load(); |
3991 | 4001 | } |
3992 | 4002 | catch (Exception e) { |
3993 | - MWin.appendMessage(ERRID+"ツリー展開情報の解析で問題が発生しました"); | |
4003 | + MWin.appendError(ERRID+"ツリー展開情報の解析で問題が発生しました"); | |
3994 | 4004 | e.printStackTrace(); |
3995 | 4005 | } |
3996 | 4006 |
@@ -595,18 +595,33 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
595 | 595 | return true; |
596 | 596 | } |
597 | 597 | |
598 | + /** | |
599 | + * ページャーの選択変更により描画する | |
600 | + */ | |
601 | + public void redrawByPager() { | |
602 | + Point vp = vport.getViewPosition(); | |
603 | + Dimension vs = vport.getSize(); | |
604 | + | |
605 | + redrawByCurrentSelection(); | |
606 | + | |
607 | + jLayeredPane_space_main_view.scrollRectToVisible(new Rectangle(vp, vs)); | |
608 | + } | |
609 | + | |
598 | 610 | /* |
599 | 611 | * 現在の選択状態で再描画する |
600 | 612 | */ |
601 | 613 | public void redrawByCurrentSelection() { |
602 | 614 | TreePath path = jTree_tree.getSelectionPath(); |
615 | + // 何も選択されていない場合 | |
616 | + if (path == null) | |
617 | + return; | |
603 | 618 | |
604 | - if ( path != null && path.getPathCount() == 2 ) { | |
619 | + if ( path.getPathCount() == 2 ) { | |
605 | 620 | // 親ノードとか触られても… |
606 | 621 | return; |
607 | 622 | } |
608 | 623 | |
609 | - if ( path != null && path.getPathCount() == 3 ) { | |
624 | + if ( path.getPathCount() == 3 ) { | |
610 | 625 | |
611 | 626 | if (env.getDebug()) System.out.println(DBGID+"SELECTED treeSelListner "+path); |
612 | 627 |
@@ -1549,7 +1564,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
1549 | 1564 | selectedpage = 0; |
1550 | 1565 | } |
1551 | 1566 | else { |
1552 | - int maxindex = env.getPageIndex(pli.size()); | |
1567 | + int maxindex = env.getPageIndex(pli.size()-1); | |
1553 | 1568 | if ( selectedpage > maxindex ) { |
1554 | 1569 | // ページ数かわったら、インデックスがはみだしちゃった |
1555 | 1570 | selectedpage = 0; |
@@ -1565,7 +1580,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
1565 | 1580 | ringBeep(); |
1566 | 1581 | crindex = 0; |
1567 | 1582 | } |
1568 | - selectedpage = env.getPageIndex(1+crindex); | |
1583 | + selectedpage = env.getPageIndex(crindex); | |
1569 | 1584 | } |
1570 | 1585 | |
1571 | 1586 | // 開始位置・終了位置・局数 |
@@ -1573,7 +1588,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
1573 | 1588 | colmax = colmin + env.getCentersInPage(selectedpage)-1; |
1574 | 1589 | |
1575 | 1590 | // ページャーコンボボックスの書き換え |
1576 | - setPagerItems(pli,env.getPageIndex(1+colmin)); | |
1591 | + setPagerItems(pli,env.getPageIndex(colmin)); | |
1577 | 1592 | pli.rewind(); |
1578 | 1593 | |
1579 | 1594 | // ページャーは有効だよ |
@@ -2989,7 +3004,7 @@ public abstract class AbsPaperView extends JPanel implements TickTimerListener,H | ||
2989 | 3004 | ter.load(); |
2990 | 3005 | } |
2991 | 3006 | catch (Exception e) { |
2992 | - MWin.appendMessage(ERRID+"ツリー展開情報の解析で問題が発生しました"); | |
3007 | + MWin.appendError(ERRID+"ツリー展開情報の解析で問題が発生しました"); | |
2993 | 3008 | e.printStackTrace(); |
2994 | 3009 | } |
2995 | 3010 |
@@ -359,12 +359,12 @@ abstract class AbsReserveDialog extends JEscCancelDialog implements HDDRecorderL | ||
359 | 359 | |
360 | 360 | ReserveList myrsv = myrec.getReserveList(rsvId); |
361 | 361 | if ( myrsv == null ) { |
362 | - MWin.appendMessage(ERRID+"更新すべき予約情報が見つかりません: "+myself+", "+rsvId); | |
362 | + MWin.appendError(ERRID+"更新すべき予約情報が見つかりません: "+myself+", "+rsvId); | |
363 | 363 | ringBeep(); |
364 | 364 | return false; // ここに来たらバグ |
365 | 365 | } |
366 | 366 | if ( myrsv.getCh_name() == null ) { |
367 | - MWin.appendMessage(ERRID+"予約情報の放送局名が不正です: "+myrsv.getStartDateTime()+", "+myrsv.getTitle()); | |
367 | + MWin.appendError(ERRID+"予約情報の放送局名が不正です: "+myrsv.getStartDateTime()+", "+myrsv.getTitle()); | |
368 | 368 | ringBeep(); |
369 | 369 | return false; |
370 | 370 | } |
@@ -751,6 +751,72 @@ public abstract class AbsReserveListView extends JScrollPane implements TickTime | ||
751 | 751 | this.getRowHeader().setVisible(b); |
752 | 752 | } |
753 | 753 | |
754 | + /** | |
755 | + * 通知すべき予約情報を取得する | |
756 | + */ | |
757 | + public boolean getReservesToNotify(ArrayList<String>list) { | |
758 | + list.clear(); | |
759 | + | |
760 | + String os = System.getProperty("os.name"); | |
761 | + boolean isWin10 = os != null && os.contains("Windows 10"); | |
762 | + | |
763 | + // 現在日時 | |
764 | + int min = env.getMinsBeforeProgStart(); | |
765 | + String dtmin = CommonUtils.getDateTime(min*60); | |
766 | + String dtmax = CommonUtils.getDateTime((min+1)*60); | |
767 | + | |
768 | + // 選択されたレコーダ | |
769 | + HDDRecorderList recs = recorders.findInstance(getSelectedRecorderOnToolbar()); | |
770 | + | |
771 | + String bodyAll = ""; | |
772 | + String head = "予約済の番組が" + min + "分後に始まります\n"; | |
773 | + | |
774 | + for ( HDDRecorder recorder : recs ) { | |
775 | + if ( recorder.isBackgroundOnly() ) { | |
776 | + continue; | |
777 | + } | |
778 | + | |
779 | + // 並べ替えるために新しいリストを作成する | |
780 | + for ( ReserveList ro : recorder.getReserves() ) { | |
781 | + if (!ro.getExec()) | |
782 | + continue; | |
783 | + | |
784 | + ArrayList<String> starts = new ArrayList<String>(); | |
785 | + ArrayList<String> ends = new ArrayList<String>(); | |
786 | + CommonUtils.getStartEndList(starts, ends, ro); | |
787 | + if (starts.size() == 0) | |
788 | + continue; | |
789 | + | |
790 | + // 開始時刻、終了時刻 | |
791 | + String nextstart = CommonUtils.getDate(CommonUtils.getCalendar(starts.get(0)), false)+" "+ro.getAhh()+":"+ro.getAmm(); | |
792 | + | |
793 | + // 予約開始まで規定時間以内の場合 | |
794 | + if ( nextstart.compareTo(dtmin) >= 0 && nextstart.compareTo(dtmax) < 0 ) { | |
795 | +// String chname = (ro.getCh_name()!=null && ro.getCh_name().length()>0)?(ro.getCh_name()):("★放送局名不正("+ro.getChannel()+")"); | |
796 | +// String length = ro.getRec_min(); | |
797 | + String title = ro.getTitle(); | |
798 | + String stime = ro.getAhh()+":"+ro.getAmm(); | |
799 | + String etime = ro.getZhh()+":"+ro.getZmm(); | |
800 | + String body = | |
801 | + "「" + title + "」\n" + | |
802 | + "(" + stime + "~" + etime + ")\n"; | |
803 | + | |
804 | + if (isWin10){ | |
805 | + list.add(head + body); | |
806 | + } | |
807 | + else{ | |
808 | + bodyAll += body; | |
809 | + } | |
810 | + } | |
811 | + } | |
812 | + } | |
813 | + | |
814 | + if (!isWin10 && !bodyAll.isEmpty()) | |
815 | + list.add(head + bodyAll); | |
816 | + | |
817 | + return list.size() > 0; | |
818 | + } | |
819 | + | |
754 | 820 | // 内部的な |
755 | 821 | |
756 | 822 | /** |
@@ -279,6 +279,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
279 | 279 | private JCheckBoxPanel jCBP_downloadProgramOnFixedTime = null; |
280 | 280 | private JCheckBoxPanel jCBP_downloadProgramInBackground = null; |
281 | 281 | private JTextFieldWithPopup jTextField_downloadProgramTimeList = null; |
282 | + private JCheckBoxPanel jCBP_useProgCache = null; | |
282 | 283 | |
283 | 284 | // レコーダ対応 |
284 | 285 | private JRadioButtonPanel jRBP_getRdReserveDetails = null; |
@@ -306,6 +307,8 @@ public abstract class AbsSettingView extends JScrollPane { | ||
306 | 307 | private JLabel jLabel_rsv_recedcolor = null; |
307 | 308 | private JCCLabel jCCL_rsv_recedcolor = null; |
308 | 309 | private JCheckBoxPanel jCBP_useAutocomplete = null; |
310 | + private JCheckBoxPanel jCBP_notifyBeforeProgStart = null; | |
311 | + private JSliderPanel jSP_minsBeforeProgStart = null; | |
309 | 312 | |
310 | 313 | // タイトル一覧 |
311 | 314 | private JLabel jLabel_title = null; |
@@ -314,6 +317,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
314 | 317 | private JButton jButton_title_up = null; |
315 | 318 | private JButton jButton_title_down = null; |
316 | 319 | private JButton jButton_title_default = null; |
320 | + private JCheckBoxPanel jCBP_showTitleDetail = null; | |
317 | 321 | |
318 | 322 | // その他 |
319 | 323 | private JComboBoxPanel jCBX_updateMethod = null; |
@@ -913,8 +917,14 @@ public abstract class AbsSettingView extends JScrollPane { | ||
913 | 917 | // 連動設定 |
914 | 918 | jCBP_downloadProgramOnFixedTime.addItemListener(al_downloadProgramOnFixedTime); |
915 | 919 | jCBP_downloadProgramOnFixedTime.setSelected( ! jCBP_downloadProgramOnFixedTime.isSelected()); |
920 | + // RELOADリスナー不要 | |
916 | 921 | } |
917 | 922 | |
923 | + CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_useProgCache = new JCheckBoxPanel("高速キャッシュファイルを使用する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
924 | + jCBP_useProgCache.setSelected(env.getUseProgCache()); | |
925 | + // RELOADリスナー不要 | |
926 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
927 | + | |
918 | 928 | return y; |
919 | 929 | } |
920 | 930 |
@@ -1066,6 +1076,18 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1066 | 1076 | // RELOADリスナー不要 |
1067 | 1077 | y+=(PARTS_HEIGHT+SEP_HEIGHT); |
1068 | 1078 | |
1079 | + CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_notifyBeforeProgStart = new JCheckBoxPanel("予約番組が開始する前に通知する(Windows 10のみ)",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
1080 | + jCBP_notifyBeforeProgStart.setSelected(env.getNotifyBeforeProgStart()); | |
1081 | + jCBP_notifyBeforeProgStart.addItemListener(il_notifyBeforeProgStart); | |
1082 | + // RELOADリスナー不要 | |
1083 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
1084 | + | |
1085 | + CommonSwingUtils.putComponentOn(jPanel_setting, jSP_minsBeforeProgStart = new JSliderPanel("┗ 開始何分前に通知するか",LABEL_WIDTH,0,72,200), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
1086 | + jSP_minsBeforeProgStart.setValue(env.getMinsBeforeProgStart()); | |
1087 | + jSP_minsBeforeProgStart.setEnabled(jCBP_notifyBeforeProgStart.isSelected()); | |
1088 | + // RELOADリスナー不要 | |
1089 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
1090 | + | |
1069 | 1091 | return y; |
1070 | 1092 | } |
1071 | 1093 |
@@ -1085,6 +1107,11 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1085 | 1107 | CommonSwingUtils.putComponentOn(jPanel_setting, getJButton_title_default("初期値"), 75, PARTS_HEIGHT, LABEL_WIDTH+SEP_WIDTH+10+tlitems_w, y+tlitems_h-PARTS_HEIGHT); |
1086 | 1108 | y+=(tlitems_h+SEP_HEIGHT); |
1087 | 1109 | |
1110 | + CommonSwingUtils.putComponentOn(jPanel_setting, jCBP_showTitleDetail = new JCheckBoxPanel("タイトル詳細を表示する",LABEL_WIDTH), PARTS_WIDTH, PARTS_HEIGHT, SEP_WIDTH, y); | |
1111 | + jCBP_showTitleDetail.setSelected(env.getShowTitleDetail()); | |
1112 | + // RELOADリスナー不要 | |
1113 | + y+=(PARTS_HEIGHT+SEP_HEIGHT); | |
1114 | + | |
1088 | 1115 | return y; |
1089 | 1116 | } |
1090 | 1117 |
@@ -1363,6 +1390,7 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1363 | 1390 | env.setDownloadProgramOnFixedTime(jCBP_downloadProgramOnFixedTime.isSelected()); |
1364 | 1391 | env.setDownloadProgramInBackground(jCBP_downloadProgramInBackground.isSelected()); |
1365 | 1392 | env.setDownloadProgramTimeList(jTextField_downloadProgramTimeList.getText()); |
1393 | + env.setUseProgCache(jCBP_useProgCache.isSelected()); | |
1366 | 1394 | |
1367 | 1395 | // レコーダ対応 |
1368 | 1396 | env.setForceLoadReserveDetails(jRBP_getRdReserveDetails.getSelectedIndex()); |
@@ -1407,6 +1435,11 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1407 | 1435 | env.setTunerShortColor(jCCL_rsv_tunshortcolor.getChoosed()); |
1408 | 1436 | env.setRecordedColor(jCCL_rsv_recedcolor.getChoosed()); |
1409 | 1437 | env.setUseAutocomplete(jCBP_useAutocomplete.isSelected()); |
1438 | + env.setNotifyBeforeProgStart(jCBP_notifyBeforeProgStart.isSelected()); | |
1439 | + env.setMinsBeforeProgStart(jSP_minsBeforeProgStart.getValue()); | |
1440 | + | |
1441 | + // タイトル一覧関係 | |
1442 | + env.setShowTitleDetail(jCBP_showTitleDetail.isSelected()); | |
1410 | 1443 | |
1411 | 1444 | // その他の設定 |
1412 | 1445 | env.setUpdateMethod((UpdateOn) jCBX_updateMethod.getSelectedItem()); |
@@ -1781,6 +1814,12 @@ public abstract class AbsSettingView extends JScrollPane { | ||
1781 | 1814 | } |
1782 | 1815 | }; |
1783 | 1816 | |
1817 | + private final ItemListener il_notifyBeforeProgStart = new ItemListener() { | |
1818 | + @Override | |
1819 | + public void itemStateChanged(ItemEvent e) { | |
1820 | + jSP_minsBeforeProgStart.setEnabled(jCBP_notifyBeforeProgStart.isSelected()); | |
1821 | + } | |
1822 | + }; | |
1784 | 1823 | |
1785 | 1824 | /******************************************************************************* |
1786 | 1825 | * コンポーネント |
@@ -163,6 +163,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
163 | 163 | |
164 | 164 | private static final String ICONFILE_PULLDOWNMENU = "icon/down-arrow.png"; |
165 | 165 | |
166 | + public static final String MOVEONLY = "移動のみ"; | |
167 | + | |
166 | 168 | /******************************************************************************* |
167 | 169 | * 部品 |
168 | 170 | ******************************************************************************/ |
@@ -205,6 +207,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
205 | 207 | FOLDER ("フォルダ", 300), |
206 | 208 | GENRE ("ジャンル", 100), |
207 | 209 | RECORDER ("レコーダ", 250), |
210 | + COPYCOUNT ("コピー", 60), | |
211 | + DLNAOID ("DLNA OID", 100), | |
208 | 212 | ; |
209 | 213 | |
210 | 214 | private String name; |
@@ -244,6 +248,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
244 | 248 | String genre; |
245 | 249 | String recname; |
246 | 250 | String recorder; |
251 | + String copycount; | |
252 | + String dlna_oid; | |
247 | 253 | |
248 | 254 | String hide_ttlid; |
249 | 255 | String hide_detail; |
@@ -263,6 +269,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
263 | 269 | c.addData(folder); |
264 | 270 | c.addData(genre); |
265 | 271 | c.addData(recname); |
272 | + c.addData(copycount.equals("1") ? MOVEONLY : copycount + "回"); | |
273 | + c.addData(dlna_oid); | |
266 | 274 | c.addData(recorder); |
267 | 275 | |
268 | 276 | c.addData(hide_ttlid); |
@@ -402,6 +410,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
402 | 410 | |
403 | 411 | updateGenreList(); |
404 | 412 | |
413 | + setDetailVisible(true); | |
414 | + | |
405 | 415 | this.addComponentListener(cl_tabShown); |
406 | 416 | |
407 | 417 | addListeners(); |
@@ -880,6 +890,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
880 | 890 | sa.genre = ro.getGenreNameList(); |
881 | 891 | sa.recname = rec.getDispName(); |
882 | 892 | sa.recorder = rec.Myself(); |
893 | + sa.copycount = ro.getHidden_params().get("copycount"); | |
894 | + sa.dlna_oid = ro.getHidden_params().get("dlnaObjectID"); | |
883 | 895 | |
884 | 896 | sa.hide_ttlid = ro.getId(); |
885 | 897 | sa.hide_detail = ro.getDetail(); |
@@ -965,6 +977,19 @@ public abstract class AbsTitleListView extends JPanel { | ||
965 | 977 | menuItem.doClick(); |
966 | 978 | } |
967 | 979 | |
980 | + /** | |
981 | + * 画面下部のタイトル詳細領域の表示のON/OFF | |
982 | + */ | |
983 | + public void setDetailVisible(boolean b) { | |
984 | + if (!env.getShowTitleDetail()) | |
985 | + b = false; | |
986 | + | |
987 | + jsc_detail.setVisible(b); | |
988 | + | |
989 | + SpringLayout layout = (SpringLayout)this.getLayout(); | |
990 | + layout.putConstraint(SpringLayout.NORTH, jsc_detail, b ? -DETAIL_HEIGHT : 0, SpringLayout.SOUTH, this); | |
991 | + } | |
992 | + | |
968 | 993 | // 内部的な |
969 | 994 | /** |
970 | 995 | * テーブル(の中の人)に追加 |
@@ -1568,6 +1593,12 @@ public abstract class AbsTitleListView extends JPanel { | ||
1568 | 1593 | case RECORDER: |
1569 | 1594 | value = ra.recname; |
1570 | 1595 | break; |
1596 | + case COPYCOUNT: | |
1597 | + value = ra.copycount; | |
1598 | + break; | |
1599 | + case DLNAOID: | |
1600 | + value = ra.dlna_oid; | |
1601 | + break; | |
1571 | 1602 | } |
1572 | 1603 | |
1573 | 1604 | if (value == null) |
@@ -1619,8 +1650,8 @@ public abstract class AbsTitleListView extends JPanel { | ||
1619 | 1650 | */ |
1620 | 1651 | private JScrollPane getJTextPane_detail() { |
1621 | 1652 | if ( jsc_detail == null ) { |
1622 | - jsc_detail = new JScrollPane(jta_detail = new JTextAreaWithPopup(),JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); | |
1623 | - jta_detail.setRows(8); | |
1653 | + jsc_detail = new JScrollPane(jta_detail = new JTextAreaWithPopup(),JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); | |
1654 | + jta_detail.setRows(6); | |
1624 | 1655 | jta_detail.setEditable(false); |
1625 | 1656 | jta_detail.setBackground(Color.LIGHT_GRAY); |
1626 | 1657 | } |
@@ -1659,6 +1690,21 @@ public abstract class AbsTitleListView extends JPanel { | ||
1659 | 1690 | TableColumn col = getColumn(TitleColumn.LENGTH); |
1660 | 1691 | if (col != null) |
1661 | 1692 | sorter.setComparator(col.getModelIndex(),lengthcomp); |
1693 | + | |
1694 | + // コピー回数でソートする項目用の計算式(番組長とか) | |
1695 | + final Comparator<String> copycomp = new Comparator<String>() { | |
1696 | + | |
1697 | + @Override | |
1698 | + public int compare(String str1, String str2) { | |
1699 | + int num1 = str1.equals(MOVEONLY) ? 1 : Integer.parseInt(str1.substring(0, str1.length()-1)); | |
1700 | + int num2 = str2.equals(MOVEONLY) ? 1 : Integer.parseInt(str2.substring(0, str2.length()-1)); | |
1701 | + return num1 - num2; | |
1702 | + } | |
1703 | + }; | |
1704 | + | |
1705 | + col = getColumn(TitleColumn.COPYCOUNT); | |
1706 | + if (col != null) | |
1707 | + sorter.setComparator(col.getModelIndex(), copycomp); | |
1662 | 1708 | } |
1663 | 1709 | |
1664 | 1710 | /* |
@@ -565,7 +565,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
565 | 565 | return; |
566 | 566 | } |
567 | 567 | |
568 | - int total_page = 1+env.getPageIndex(pli.size()); | |
568 | + int total_page = 1+env.getPageIndex(pli.size()-1); | |
569 | 569 | |
570 | 570 | // イベント停止 |
571 | 571 | jComboBox_pager.removeItemListener(il_pagerSelected); |
@@ -582,7 +582,7 @@ public abstract class AbsToolBar extends JToolBar implements HDDRecorderSelectab | ||
582 | 582 | } |
583 | 583 | |
584 | 584 | pli.rewind(); // 巻き戻してください |
585 | - int idx = 1; | |
585 | + int idx = 0; | |
586 | 586 | |
587 | 587 | for (int np=0; np<total_page; np++) { |
588 | 588 | String centers = ""; |
@@ -371,7 +371,7 @@ public class Env { | ||
371 | 371 | public int getPageIndex(int n) { |
372 | 372 | if (pageBreakEnabled && pageBreaks.size() > 0){ |
373 | 373 | for (int pno=0; pno<pageBreaks.size(); pno++){ |
374 | - if (n <= pageBreaks.get(pno)){ | |
374 | + if (n < pageBreaks.get(pno)){ | |
375 | 375 | return pno; |
376 | 376 | } |
377 | 377 | } |
@@ -380,7 +380,7 @@ public class Env { | ||
380 | 380 | } |
381 | 381 | |
382 | 382 | int rem = n % centerPerPage; |
383 | - return (n-rem)/centerPerPage + ((rem==0)?(0):(1)) - 1; | |
383 | + return (n-rem)/centerPerPage; | |
384 | 384 | } |
385 | 385 | /* |
386 | 386 | * ページ内でのオフセットを取得する |
@@ -389,7 +389,7 @@ public class Env { | ||
389 | 389 | if (pageBreakEnabled && pageBreaks.size() > 0){ |
390 | 390 | int cnum = 0; |
391 | 391 | for (int pno=0; pno<pageBreaks.size(); pno++){ |
392 | - if (n <= pageBreaks.get(pno)){ | |
392 | + if (n < pageBreaks.get(pno)){ | |
393 | 393 | return n - cnum; |
394 | 394 | } |
395 | 395 |
@@ -659,6 +659,12 @@ public class Env { | ||
659 | 659 | // Web番組表のキャッシュ保持時間 |
660 | 660 | public int getCacheTimeLimit() { return cacheTimeLimit; } |
661 | 661 | public void setCacheTimeLimit(int w) { cacheTimeLimit = w; } |
662 | + | |
663 | + // 高速キャッシュファイルを使用するか | |
664 | + public boolean getUseProgCache(){ return useProgCache; } | |
665 | + public void setUseProgCache(boolean b){ useProgCache = b;} | |
666 | + private boolean useProgCache = true; | |
667 | + | |
662 | 668 | public boolean isShutdownEnabled() { return (cacheTimeLimit == 0)&&(shutdownCmd!=null&&shutdownCmd.length()>0); } |
663 | 669 | private int cacheTimeLimit = 12; |
664 | 670 | // シャットダウンコマンド |
@@ -881,6 +887,24 @@ public class Env { | ||
881 | 887 | public void setUseAutocomplete(boolean b) { useAutocomplete = b; } |
882 | 888 | private boolean useAutocomplete = false; |
883 | 889 | |
890 | + // 予約番組の開始を通知するか(Windows10のみ) | |
891 | + public boolean getNotifyBeforeProgStart(){ return notifyBeforeProgStart; } | |
892 | + public void setNotifyBeforeProgStart(boolean b){ notifyBeforeProgStart = b; } | |
893 | + private boolean notifyBeforeProgStart = false; | |
894 | + | |
895 | + // 開始何分前に通知するか | |
896 | + public int getMinsBeforeProgStart(){ return minsBeforeProgStart; } | |
897 | + public void setMinsBeforeProgStart(int n){ minsBeforeProgStart = n; } | |
898 | + private int minsBeforeProgStart = 5; | |
899 | + | |
900 | + /* | |
901 | + * タイトル一覧関係 | |
902 | + */ | |
903 | + // タイトル詳細を表示するか | |
904 | + public boolean getShowTitleDetail(){ return showTitleDetail; } | |
905 | + public void setShowTitleDetail(boolean b){ showTitleDetail = b; } | |
906 | + private boolean showTitleDetail = true; | |
907 | + | |
884 | 908 | /* |
885 | 909 | * その他の設定 |
886 | 910 | */ |
@@ -2,14 +2,83 @@ package tainavi; | ||
2 | 2 | |
3 | 3 | import java.util.ArrayList; |
4 | 4 | |
5 | +import tainavi.ProgDetailList.WrHeader; | |
6 | + | |
5 | 7 | public class ProgDateList { |
6 | 8 | public String Date; |
7 | 9 | public int row; |
8 | 10 | public ArrayList<ProgDetailList> pdetail; |
9 | - | |
11 | + | |
10 | 12 | public ProgDateList() { |
11 | 13 | Date = ""; |
12 | 14 | row = 0; |
13 | 15 | pdetail = new ArrayList<ProgDetailList>(); |
14 | 16 | } |
17 | + | |
18 | + /* | |
19 | + * 文字列に変換する | |
20 | + */ | |
21 | + public String toString(){ | |
22 | + StringBuilder sb = new StringBuilder(); | |
23 | + // 属性をヘッダー行にエンコードする | |
24 | + sb.append(Date + ":"); | |
25 | + sb.append(String.valueOf(row) + ":"); | |
26 | + sb.append(pdetail.size()); | |
27 | + sb.append("\n"); | |
28 | + | |
29 | + // pdetail を文字列にエンコードする | |
30 | + for (ProgDetailList d : pdetail) { | |
31 | + sb.append(d.toString()); | |
32 | + } | |
33 | + | |
34 | + return sb.toString(); | |
35 | + } | |
36 | + | |
37 | + /* | |
38 | + * 文字列からインスタンスを生成する | |
39 | + */ | |
40 | + public ProgDateList(String txt){ | |
41 | + Date = ""; | |
42 | + row = 0; | |
43 | + pdetail = new ArrayList<ProgDetailList>(); | |
44 | + | |
45 | + // ヘッダー行を切り出す | |
46 | + int he = txt.indexOf("\n"); | |
47 | + String th = txt.substring(0, he); | |
48 | + if (th == null) | |
49 | + return; | |
50 | + | |
51 | + // ヘッダー行をトークンに分割する | |
52 | + String []tokens = th.split(":"); | |
53 | + if (tokens.length < 3) | |
54 | + return; | |
55 | + | |
56 | + // トークンを属性にコピーする | |
57 | + Date = tokens[0]; | |
58 | + row = Integer.parseInt(tokens[1]); | |
59 | + int size = Integer.parseInt(tokens[2]); | |
60 | + | |
61 | + // 残りの文字列からpdetail を生成する | |
62 | + int index = 0; | |
63 | + txt = txt.substring(he+1); | |
64 | + for (int n=0; n<size; n++){ | |
65 | + // 番組ヘッダを探す | |
66 | + int newtop = txt.indexOf(WrHeader.STARTMARK.toString(),index); | |
67 | + if ( newtop == -1 ) { | |
68 | + break; | |
69 | + } | |
70 | + newtop += WrHeader.STARTMARK.toString().length()+1; | |
71 | + | |
72 | + // 番組フッタを探す | |
73 | + int newtail = txt.indexOf(WrHeader.ENDMARK.toString(),newtop); | |
74 | + if ( newtail == -1 ) { | |
75 | + break; | |
76 | + } | |
77 | + index = newtail+WrHeader.ENDMARK.toString().length()+1; | |
78 | + | |
79 | + // 解析する | |
80 | + ProgDetailList pdl = new ProgDetailList(txt.substring(newtop,newtail)); | |
81 | + pdetail.add(pdl); | |
82 | + } | |
83 | + } | |
15 | 84 | } |
@@ -2,7 +2,6 @@ package tainavi; | ||
2 | 2 | |
3 | 3 | import java.awt.Color; |
4 | 4 | import java.util.ArrayList; |
5 | -import tainavi.ProgDateList; | |
6 | 5 | |
7 | 6 | public class ProgList { |
8 | 7 | public String Area; |
@@ -14,7 +13,9 @@ public class ProgList { | ||
14 | 13 | public Color BgColor; |
15 | 14 | public boolean enabled; |
16 | 15 | public ArrayList<ProgDateList> pdate; |
17 | - | |
16 | + | |
17 | + private static final String PDEND = "#PDEND\n"; // 文字列エンコード時のProgDateListのターミネータ | |
18 | + | |
18 | 19 | public ProgList() { |
19 | 20 | Area = ""; |
20 | 21 | SubArea = ""; |
@@ -26,4 +27,85 @@ public class ProgList { | ||
26 | 27 | enabled = true; |
27 | 28 | pdate = new ArrayList<ProgDateList>(); |
28 | 29 | } |
30 | + | |
31 | + /* | |
32 | + * インスタンスを文字列に変換する | |
33 | + */ | |
34 | + public String toString(){ | |
35 | + StringBuilder sb = new StringBuilder(); | |
36 | + | |
37 | + // 属性をヘッダー行にエンコードする | |
38 | + sb.append(Area + ":"); | |
39 | + sb.append(SubArea + ":"); | |
40 | + sb.append(Type + ":"); | |
41 | + sb.append(Center + ":"); | |
42 | + sb.append(CenterId + ":"); | |
43 | + sb.append(ChId + ":"); | |
44 | + sb.append(CommonUtils.color2str(BgColor) + ":"); | |
45 | + sb.append((enabled ? "1" : "0") + ":"); | |
46 | + sb.append(pdate.size()); | |
47 | + sb.append("\n"); | |
48 | + | |
49 | + // 日付の配列を文字列に変換して追加する。PDENDでターミネートする | |
50 | + for ( ProgDateList c : pdate ) { | |
51 | + sb.append(c.toString()); | |
52 | + sb.append(PDEND); | |
53 | + } | |
54 | + | |
55 | + return sb.toString(); | |
56 | + } | |
57 | + | |
58 | + /* | |
59 | + * 文字列からインスタンスを生成する | |
60 | + */ | |
61 | + public ProgList(String txt){ | |
62 | + Area = ""; | |
63 | + SubArea = ""; | |
64 | + Type = ""; | |
65 | + Center = ""; | |
66 | + CenterId = ""; | |
67 | + ChId = ""; | |
68 | + BgColor = new Color(180,180,180); | |
69 | + enabled = true; | |
70 | + pdate = new ArrayList<ProgDateList>(); | |
71 | + | |
72 | + // ヘッダー行を取り出す | |
73 | + int he = txt.indexOf("\n"); | |
74 | + String th = txt.substring(0, he); | |
75 | + if (th == null) | |
76 | + return; | |
77 | + | |
78 | + // ヘッダー行をトークンに分割する | |
79 | + String []tokens = th.split(":"); | |
80 | + if (tokens.length < 9) | |
81 | + return; | |
82 | + | |
83 | + // トークンを属性にコピーする | |
84 | + Area = tokens[0]; | |
85 | + SubArea = tokens[1]; | |
86 | + Type = tokens[2]; | |
87 | + Center = tokens[3]; | |
88 | + CenterId = tokens[4]; | |
89 | + ChId = tokens[5]; | |
90 | + BgColor = CommonUtils.str2color(tokens[6]); | |
91 | + enabled = tokens[7].equals("1"); | |
92 | + int size = Integer.parseInt(tokens[8]); | |
93 | + | |
94 | + // 残りの文字列から pdate を生成する | |
95 | + String tdl = txt.substring(he+1); | |
96 | + for (int n=0; n<size; n++){ | |
97 | + // ターミネートまでの文字列を切りだす | |
98 | + int dd = tdl.indexOf(PDEND); | |
99 | + String td = tdl.substring(0, dd); | |
100 | + | |
101 | + // 文字列からインスタンスを生成して配列に追加する | |
102 | + ProgDateList d = new ProgDateList(td); | |
103 | + pdate.add(d); | |
104 | + | |
105 | + // 残りの文字列を切り出す | |
106 | + if (dd == -1) | |
107 | + break; | |
108 | + tdl = tdl.substring(dd+PDEND.length()); | |
109 | + } | |
110 | + } | |
29 | 111 | } |
@@ -378,5 +378,6 @@ public interface TVProgram { | ||
378 | 378 | public boolean setOptString(String s); |
379 | 379 | public String getOptString(); |
380 | 380 | |
381 | - | |
381 | + // キャッシュファイルからのみのロードか | |
382 | + public boolean getCacheFileOnly(); | |
382 | 383 | } |
@@ -145,6 +145,13 @@ public class TVProgramUtils implements Cloneable { | ||
145 | 145 | |
146 | 146 | private static boolean cancelRequested = false; |
147 | 147 | |
148 | + /* | |
149 | + * 高速キャッシュファイルを使用するか | |
150 | + */ | |
151 | + public static void setUseProgCache(boolean b){ useProgCache = b;} | |
152 | + public static boolean getUseProgCache(){ return useProgCache; } | |
153 | + private static boolean useProgCache = true; | |
154 | + | |
148 | 155 | /******************************************************************************* |
149 | 156 | * オプション確認 |
150 | 157 | ******************************************************************************/ |
@@ -173,6 +180,9 @@ public class TVProgramUtils implements Cloneable { | ||
173 | 180 | private static final String DBGID = "[DEBUG]"+MSGID; |
174 | 181 | private static final String ERRID = "[ERROR]"+MSGID; |
175 | 182 | |
183 | + // キャッシュファイルで使用する放送局のターミネータ | |
184 | + private static final String PLEND = "#PLEND\n"; | |
185 | + | |
176 | 186 | /******************************************************************************* |
177 | 187 | * メンバ変数関連 |
178 | 188 | ******************************************************************************/ |
@@ -232,6 +242,10 @@ public class TVProgramUtils implements Cloneable { | ||
232 | 242 | //public boolean getAbnormal() { return abnormal; } |
233 | 243 | //private boolean abnormal = false; |
234 | 244 | |
245 | + // 今回の取得でキャッシュのみを使用したか | |
246 | + public void setCacheFileOnly(boolean b){ cacheFileOnly = b; } | |
247 | + public boolean getCacheFileOnly(){ return cacheFileOnly; } | |
248 | + private boolean cacheFileOnly = false; | |
235 | 249 | |
236 | 250 | /******************************************************************************* |
237 | 251 | * 番組表固有の情報 |
@@ -1518,4 +1532,98 @@ public class TVProgramUtils implements Cloneable { | ||
1518 | 1532 | public boolean setOptString(String s) { return true; } // ダミー |
1519 | 1533 | public String getOptString() { return null; } // ダミー |
1520 | 1534 | |
1535 | + /* | |
1536 | + * 番組情報をキャッシュファイルに保存する | |
1537 | + */ | |
1538 | + public boolean saveToProgCache(String prefix){ | |
1539 | + if (!useProgCache){ | |
1540 | + System.out.println("高速キャッシュファイルは使用しません"); | |
1541 | + return false; | |
1542 | + } | |
1543 | + | |
1544 | + // キャッシュファイルのパス名を生成する | |
1545 | + String file = String.format(getProgDir()+File.separator+prefix +"_ALL.txt"); | |
1546 | + | |
1547 | + File f = new File(file); | |
1548 | + f.delete(); | |
1549 | + | |
1550 | + // 番組情報を文字列に変換する | |
1551 | + StringBuilder sb = new StringBuilder(); | |
1552 | + for ( ProgList p : pcenter ) { | |
1553 | + sb.append(p.toString()); | |
1554 | + sb.append(PLEND); | |
1555 | + } | |
1556 | + | |
1557 | + // キャッシュファイルに保存する | |
1558 | + System.out.println("高速キャッシュファイルに保存しています(" + file + ")..."); | |
1559 | + if ( ! CommonUtils.write2file(file, sb.toString()) ) { | |
1560 | + System.out.println("高速キャッシュファイルへの保存に失敗しました。"); | |
1561 | + return false; | |
1562 | + } | |
1563 | + | |
1564 | + System.out.println("高速キャッシュファイルへの保存に成功しました。"); | |
1565 | + return true; | |
1566 | + } | |
1567 | + | |
1568 | + /* | |
1569 | + * 番組情報をキャッシュファイルから読み込む | |
1570 | + */ | |
1571 | + public boolean loadFromProgCache(String prefix){ | |
1572 | + if (!useProgCache){ | |
1573 | + System.out.println("高速キャッシュファイルは使用しません"); | |
1574 | + return false; | |
1575 | + } | |
1576 | + // キャッシュファイルのパス名を生成する | |
1577 | + String file = String.format(getProgDir()+File.separator+prefix +"_ALL.txt"); | |
1578 | + System.out.println("高速キャッシュファイルを読み込んでいます(" + file + ")..."); | |
1579 | + | |
1580 | + File f = new File(file); | |
1581 | + if (!f.exists()){ | |
1582 | + System.out.println("高速キャッシュファイルはありません"); | |
1583 | + return false; | |
1584 | + } | |
1585 | + | |
1586 | + // 当日保存されたものかどうかをチェックする | |
1587 | + String curDate = CommonUtils.getDate529(0,true); | |
1588 | + | |
1589 | + GregorianCalendar c = new GregorianCalendar(); | |
1590 | + c.setTimeInMillis(f.lastModified()); | |
1591 | + | |
1592 | + String fdate = CommonUtils.getDate529(c, false); | |
1593 | + String today = CommonUtils.getDate529(0, false); | |
1594 | + if (!fdate.equals(today)){ | |
1595 | + System.out.println("高速キャッシュファイルは古いです"); | |
1596 | + return false; | |
1597 | + } | |
1598 | + | |
1599 | + String txt = CommonUtils.read4file(file, false); | |
1600 | + if ( txt == null ) { | |
1601 | + System.out.println("高速キャッシュファイルの読み込みに失敗しました"); | |
1602 | + return false; | |
1603 | + } | |
1604 | + | |
1605 | + ArrayList<ProgList> pcl = new ArrayList<ProgList>(); | |
1606 | + | |
1607 | + // 文字列から番組情報を読み込む | |
1608 | + int index = 0; | |
1609 | + while ( index < txt.length() ){ | |
1610 | + // 放送局のターミネータを検索する | |
1611 | + int le = txt.indexOf(PLEND, index); | |
1612 | + | |
1613 | + // 1放送局分を文字列から生成する | |
1614 | + ProgList pl = new ProgList(txt.substring(index, le)); | |
1615 | + pcl.add(pl); | |
1616 | + | |
1617 | + if (le == -1) | |
1618 | + break; | |
1619 | + | |
1620 | + // 残りの文字列のインデックスを計算する | |
1621 | + index = le + PLEND.length(); | |
1622 | + } | |
1623 | + | |
1624 | + pcenter = pcl; | |
1625 | + | |
1626 | + System.out.println("高速キャッシュファイルの読み込みに成功しました"); | |
1627 | + return true; | |
1628 | + } | |
1521 | 1629 | } |
@@ -96,11 +96,36 @@ public class TitleListColumnInfoList extends ArrayList<ListColumnInfo> implement | ||
96 | 96 | this.add(c); |
97 | 97 | } |
98 | 98 | |
99 | + addNewColumns(); | |
100 | + | |
99 | 101 | return true; |
100 | 102 | } |
101 | 103 | |
102 | 104 | /* |
103 | - * 初期化する | |
105 | + * 新しい列を追加する | |
106 | + */ | |
107 | + private void addNewColumns(){ | |
108 | + TitleListColumnInfoList cl = new TitleListColumnInfoList(); | |
109 | + cl.setDefault(); | |
110 | + | |
111 | + for (int n=0; n<cl.size(); n++){ | |
112 | + ListColumnInfo c = cl.get(n); | |
113 | + | |
114 | + int n2=0; | |
115 | + for (n2=0; n2<this.size(); n2++){ | |
116 | + ListColumnInfo c2 = this.get(n2); | |
117 | + if (c.getName().equals(c2.getName())) | |
118 | + break; | |
119 | + } | |
120 | + | |
121 | + if (n2 == this.size()){ | |
122 | + this.add((ListColumnInfo)c.clone()); | |
123 | + } | |
124 | + } | |
125 | + } | |
126 | + | |
127 | + /* | |
128 | + * デフォルトの設定にする | |
104 | 129 | */ |
105 | 130 | public void setDefault(){ |
106 | 131 | this.clear(); |
@@ -117,6 +142,8 @@ public class TitleListColumnInfoList extends ArrayList<ListColumnInfo> implement | ||
117 | 142 | {true, "フォルダ", idx++}, |
118 | 143 | {true, "ジャンル", idx++}, |
119 | 144 | {true, "レコーダ", idx++}, |
145 | + {true, "コピー", idx++}, | |
146 | + {false, "DLNA OID", idx++}, | |
120 | 147 | }; |
121 | 148 | for (int i=0; i<o.length; i++) { |
122 | 149 | ListColumnInfo cb = new ListColumnInfo(); |
@@ -1,10 +1,16 @@ | ||
1 | 1 | package tainavi; |
2 | 2 | |
3 | 3 | import java.awt.BorderLayout; |
4 | +import java.awt.Color; | |
5 | +import java.awt.Dimension; | |
4 | 6 | |
5 | 7 | import javax.swing.JPanel; |
6 | 8 | import javax.swing.JScrollPane; |
7 | -import javax.swing.JTextArea; | |
9 | +import javax.swing.JTextPane; | |
10 | +import javax.swing.text.BadLocationException; | |
11 | +import javax.swing.text.Document; | |
12 | +import javax.swing.text.SimpleAttributeSet; | |
13 | +import javax.swing.text.StyleConstants; | |
8 | 14 | |
9 | 15 | public class VWStatusTextArea extends JPanel implements StatusTextArea { |
10 | 16 |
@@ -15,7 +21,7 @@ public class VWStatusTextArea extends JPanel implements StatusTextArea { | ||
15 | 21 | */ |
16 | 22 | |
17 | 23 | private JScrollPane jsp = null; |
18 | - private JTextArea jta = null; | |
24 | + private JTextPane jtp = null; | |
19 | 25 | |
20 | 26 | /* |
21 | 27 | * コンストラクタ |
@@ -33,19 +39,18 @@ public class VWStatusTextArea extends JPanel implements StatusTextArea { | ||
33 | 39 | |
34 | 40 | private JScrollPane getJScrollPane_statusarea() { |
35 | 41 | if (jsp == null) { |
36 | - jsp = new JScrollPane(getJTextArea_statusarea(),JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); | |
42 | + jsp = new JScrollPane(getJTextPane_statusarea(),JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); | |
43 | + setRows(5); | |
37 | 44 | } |
38 | 45 | return(jsp); |
39 | 46 | } |
40 | 47 | |
41 | - private JTextArea getJTextArea_statusarea() { | |
42 | - if (jta == null) { | |
43 | - jta = new JTextAreaWithPopup(4,0); | |
44 | - jta.setLineWrap(true); // 改行、する! | |
45 | - jta.setWrapStyleWord(false); // 画面端で折り返し、する! | |
46 | - jta.setEditable(false); // 編集、させない! | |
48 | + private JTextPane getJTextPane_statusarea() { | |
49 | + if (jtp == null) { | |
50 | + jtp = new JTextPane(); | |
51 | + jtp.setEditable(false); // 編集、させない! | |
47 | 52 | } |
48 | - return jta; | |
53 | + return jtp; | |
49 | 54 | } |
50 | 55 | |
51 | 56 | /* |
@@ -54,35 +59,50 @@ public class VWStatusTextArea extends JPanel implements StatusTextArea { | ||
54 | 59 | |
55 | 60 | @Override |
56 | 61 | public void clear() { |
57 | - jta.setText(""); | |
62 | + jtp.setText(""); | |
58 | 63 | } |
59 | 64 | |
60 | - private void append(String message) { | |
61 | - jta.append("\n"+ message); | |
62 | - jta.setCaretPosition(jta.getText().length()); | |
63 | - } | |
65 | + private void appendToPane(String msg, Color c){ | |
66 | + SimpleAttributeSet attr = new SimpleAttributeSet(); | |
67 | + StyleConstants.setForeground(attr, c); | |
68 | + | |
69 | + Document doc = jtp.getDocument(); | |
70 | + if (doc == null) | |
71 | + return; | |
72 | + | |
73 | + try { | |
74 | + doc.insertString(doc.getLength(), msg, attr); | |
75 | + jtp.setCaretPosition(doc.getLength()); | |
76 | + } catch (BadLocationException e) { | |
77 | + e.printStackTrace(); | |
78 | + } | |
79 | + } | |
64 | 80 | |
65 | 81 | @Override |
66 | 82 | public void appendMessage(String message) { |
67 | 83 | String msg = CommonUtils.getNow() + message; |
68 | - this.append(msg); | |
84 | + appendToPane("\n" + msg, Color.BLACK); | |
69 | 85 | System.out.println(msg); |
70 | 86 | } |
71 | 87 | |
72 | 88 | @Override |
73 | 89 | public void appendError(String message) { |
74 | 90 | String msg = CommonUtils.getNow() + message; |
75 | - this.append(msg); | |
91 | + appendToPane("\n" + msg, Color.RED); | |
76 | 92 | System.err.println(msg); |
77 | 93 | } |
78 | 94 | |
79 | 95 | @Override |
80 | 96 | public int getRows() { |
81 | - return jta.getRows(); | |
97 | + return (int)(jtp.getHeight() / jtp.getFont().getSize()/1.8); | |
82 | 98 | } |
83 | 99 | |
84 | 100 | @Override |
85 | 101 | public void setRows(int rows) { |
86 | - jta.setRows(rows); | |
102 | + if (jsp == null) | |
103 | + return; | |
104 | + Dimension dim = jsp.getPreferredSize(); | |
105 | + dim.height = (int)(jtp.getFont().getSize()*1.8*rows); | |
106 | + jsp.setPreferredSize(dim); | |
87 | 107 | } |
88 | 108 | } |
@@ -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.11"; | |
8 | + private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.12"; | |
9 | 9 | |
10 | 10 | private static final String OSname = System.getProperty("os.name"); |
11 | 11 | private static final String OSvers = System.getProperty("os.version"); |
@@ -18,6 +18,7 @@ import java.awt.Rectangle; | ||
18 | 18 | import java.awt.SystemTray; |
19 | 19 | import java.awt.Toolkit; |
20 | 20 | import java.awt.TrayIcon; |
21 | +import java.awt.TrayIcon.MessageType; | |
21 | 22 | import java.awt.datatransfer.Clipboard; |
22 | 23 | import java.awt.datatransfer.StringSelection; |
23 | 24 | import java.awt.event.ActionEvent; |
@@ -154,6 +155,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
154 | 155 | private String pxport = null; // ProxtPort指定 |
155 | 156 | |
156 | 157 | private boolean downloadInProgress = false; // TVプログラムを取得中か |
158 | + private boolean cacheFileOnly = false; // キャッシュファイルからのみの読み込みか | |
157 | 159 | |
158 | 160 | /******************************************************************************* |
159 | 161 | * 定数 |
@@ -435,24 +437,28 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
435 | 437 | protected void onShown() { |
436 | 438 | // キーワード登録ボタンはリスト形式のみ |
437 | 439 | toolBar.setAddkeywordEnabled(true); |
438 | - // 一括予約はリスト形式のみ | |
439 | - toolBar.setBatchReservationEnabled(true); | |
440 | 440 | // スナップショットを有効にする |
441 | 441 | toolBar.setSnapShotEnabled(true); |
442 | 442 | // 新聞形式以外ではマッチ枠を無効にする |
443 | 443 | toolBar.setBorderToggleEnabled(true, bounds.getShowReservedBackground()); |
444 | + updateBatchReservationEnabled(); | |
444 | 445 | } |
445 | 446 | |
446 | 447 | @Override |
447 | 448 | protected void onHidden() { |
448 | 449 | // キーワード登録ボタンはリスト形式のみ |
449 | 450 | toolBar.setAddkeywordEnabled(false); |
450 | - // 一括予約はリスト形式のみ | |
451 | - toolBar.setBatchReservationEnabled(false); | |
452 | 451 | // スナップショットを無効にする |
453 | 452 | toolBar.setSnapShotEnabled(false); |
454 | 453 | // 新聞形式以外ではマッチ枠を無効にする |
455 | 454 | toolBar.setBorderToggleEnabled(false, bounds.getShowReservedBackground()); |
455 | + updateBatchReservationEnabled(); | |
456 | + } | |
457 | + | |
458 | + @Override | |
459 | + protected void updateBatchReservationEnabled(){ | |
460 | + // 一括予約はリスト形式のみ | |
461 | + toolBar.setBatchReservationEnabled(this.isVisible() && getSelectedRowCount() > 0); | |
456 | 462 | } |
457 | 463 | |
458 | 464 | @Override |
@@ -1904,7 +1910,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
1904 | 1910 | @Override |
1905 | 1911 | protected void redrawByPager() { |
1906 | 1912 | timer_now.pause(); |
1907 | - paper.redrawByCurrentSelection(); | |
1913 | + paper.redrawByPager(); | |
1908 | 1914 | timer_now.start(); |
1909 | 1915 | } |
1910 | 1916 |
@@ -2109,9 +2115,26 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
2109 | 2115 | public void timerRised(TickTimerRiseEvent e) { |
2110 | 2116 | if (env.getDebug()) System.out.println("Timer Rised: now="+CommonUtils.getDateTimeYMDx(e.getCalendar())); |
2111 | 2117 | setTitleBar(); |
2118 | + checkReservesForNotify(); | |
2112 | 2119 | checkDownloadProgramTime(e.getCalendar()); |
2113 | 2120 | } |
2114 | 2121 | |
2122 | + /* | |
2123 | + * 開始間もなくの予約を通知する | |
2124 | + */ | |
2125 | + private void checkReservesForNotify(){ | |
2126 | + if (!env.getNotifyBeforeProgStart()) | |
2127 | + return; | |
2128 | + if (reserved == null) | |
2129 | + return; | |
2130 | + | |
2131 | + ArrayList<String> list = new ArrayList<String>(); | |
2132 | + reserved.getReservesToNotify(list); | |
2133 | + | |
2134 | + for (String s : list){ | |
2135 | + trayicon.displayMessage("TinyBannavi", s, MessageType.INFO); | |
2136 | + } | |
2137 | + } | |
2115 | 2138 | |
2116 | 2139 | /******************************************************************************* |
2117 | 2140 | * 共通メソッド群 |
@@ -3238,7 +3261,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3238 | 3261 | } |
3239 | 3262 | else { |
3240 | 3263 | ringBeep(); |
3241 | - mwin.appendMessage(String.format("【設定情報の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3264 | + mwin.appendError(String.format("【設定情報の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3242 | 3265 | } |
3243 | 3266 | |
3244 | 3267 | return null; |
@@ -3329,7 +3352,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3329 | 3352 | } |
3330 | 3353 | else { |
3331 | 3354 | ringBeep(); |
3332 | - mwin.appendMessage(String.format("【予約詳細の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3355 | + mwin.appendError(String.format("【予約詳細の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3333 | 3356 | } |
3334 | 3357 | return null; |
3335 | 3358 | } |
@@ -3392,7 +3415,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3392 | 3415 | } |
3393 | 3416 | else { |
3394 | 3417 | ringBeep(); |
3395 | - mwin.appendMessage(String.format("【録画結果一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3418 | + mwin.appendError(String.format("【録画結果一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3396 | 3419 | } |
3397 | 3420 | return null; |
3398 | 3421 | } |
@@ -3453,7 +3476,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3453 | 3476 | } |
3454 | 3477 | else { |
3455 | 3478 | ringBeep(); |
3456 | - mwin.appendMessage(String.format("【自動予約一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3479 | + mwin.appendError(String.format("【自動予約一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3457 | 3480 | } |
3458 | 3481 | |
3459 | 3482 | return null; |
@@ -3519,7 +3542,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
3519 | 3542 | } |
3520 | 3543 | else { |
3521 | 3544 | ringBeep(); |
3522 | - mwin.appendMessage(String.format("【タイトル一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3545 | + mwin.appendError(String.format("【タイトル一覧の取得処理に失敗しました】 所要時間: %.2f秒",tc.end())); | |
3523 | 3546 | } |
3524 | 3547 | |
3525 | 3548 | return null; |
@@ -4001,6 +4024,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4001 | 4024 | final String ERRID = "[ERROR]"+FUNCID; |
4002 | 4025 | |
4003 | 4026 | try { |
4027 | + cacheFileOnly = true; | |
4004 | 4028 | stwin.resetWindowCloseRequested(); |
4005 | 4029 | TVProgramUtils.setCancelRequested(false); |
4006 | 4030 |
@@ -4018,6 +4042,8 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4018 | 4042 | if (!loadTVProgramOnce(tvp, sType, tvp.getSelectedArea(), false, force)){ |
4019 | 4043 | return false; |
4020 | 4044 | } |
4045 | + if (!tvp.getCacheFileOnly()) | |
4046 | + cacheFileOnly = false; | |
4021 | 4047 | } |
4022 | 4048 | else { |
4023 | 4049 | reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); |
@@ -4037,6 +4063,8 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4037 | 4063 | loadTVProgramPostProcess(force); |
4038 | 4064 | return false; |
4039 | 4065 | } |
4066 | + if (!tvp.getCacheFileOnly()) | |
4067 | + cacheFileOnly = false; | |
4040 | 4068 | } |
4041 | 4069 | else { |
4042 | 4070 | reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); |
@@ -4057,6 +4085,8 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4057 | 4085 | loadTVProgramPostProcess(force); |
4058 | 4086 | return false; |
4059 | 4087 | } |
4088 | + if (!tvp.getCacheFileOnly()) | |
4089 | + cacheFileOnly = false; | |
4060 | 4090 | } |
4061 | 4091 | else { |
4062 | 4092 | reportTVProgramProgress(FUNCID+sType+"へのアクセスはスキップされました: "+tvp.getTVProgramId()); |
@@ -4122,7 +4152,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4122 | 4152 | mpList.build(tvprograms, trKeys.getTraceKeys(), srKeys.getSearchKeys()); |
4123 | 4153 | |
4124 | 4154 | // 過去ログ |
4125 | - if ( !env.getUsePassedProgram()) { | |
4155 | + if ( !env.getUsePassedProgram() || cacheFileOnly) { | |
4126 | 4156 | reportTVProgramProgress(FUNCID+"過去ログは記録されません."); |
4127 | 4157 | } |
4128 | 4158 | else { |
@@ -4135,6 +4165,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4135 | 4165 | } |
4136 | 4166 | } |
4137 | 4167 | |
4168 | + | |
4138 | 4169 | // 分割 |
4139 | 4170 | private boolean loadTVProgramOnce(TVProgram tvp, String sType, String aName, boolean loadonly, boolean force) { |
4140 | 4171 |
@@ -4149,7 +4180,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4149 | 4180 | // 読み込み |
4150 | 4181 | //tvp.setProgressArea(stwin); |
4151 | 4182 | if (!tvp.loadProgram(tvp.getSelectedCode(), force)){ |
4152 | - if (mwin!=null) mwin.appendMessage(FUNCID+"番組情報の取得に失敗しました。"); | |
4183 | + if (mwin!=null) mwin.appendError(FUNCID+"番組情報の取得に失敗しました。"); | |
4153 | 4184 | return false; |
4154 | 4185 | } |
4155 | 4186 |
@@ -4166,7 +4197,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4166 | 4197 | if (errmsg != null) { |
4167 | 4198 | msg = FUNCID+"取得した情報が不正です:"+errmsg; |
4168 | 4199 | reportTVProgramProgress(msg); |
4169 | - if (mainWindow!=null) mwin.appendMessage(msg); | |
4200 | + if (mainWindow!=null) mwin.appendError(msg); | |
4170 | 4201 | ringBeep(); |
4171 | 4202 | // return false; |
4172 | 4203 | return true; |
@@ -4641,6 +4672,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
4641 | 4672 | // タイトル一覧の再構築 |
4642 | 4673 | titled.copyColumnWidth(); |
4643 | 4674 | titled.reflectColumnEnv(); |
4675 | + titled.setDetailVisible(mwin.isVisible()); | |
4644 | 4676 | |
4645 | 4677 | // 新聞形式にフォントを反映する |
4646 | 4678 | paper.updateFonts(env); |
@@ -5392,6 +5424,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5392 | 5424 | |
5393 | 5425 | TVProgramUtils.setProgressArea(stwin); |
5394 | 5426 | TVProgramUtils.setChConv(chconv); |
5427 | + TVProgramUtils.setUseProgCache(nEnv.getUseProgCache()); | |
5395 | 5428 | } |
5396 | 5429 | |
5397 | 5430 | // |
@@ -5586,11 +5619,13 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
5586 | 5619 | if (b) { |
5587 | 5620 | listed.setDetailVisible(true); |
5588 | 5621 | paper.setDetailVisible(true); |
5622 | + titled.setDetailVisible(true); | |
5589 | 5623 | MWinSetVisible(true); |
5590 | 5624 | } |
5591 | 5625 | else { |
5592 | 5626 | listed.setDetailVisible(false); |
5593 | 5627 | paper.setDetailVisible(false); |
5628 | + titled.setDetailVisible(false); | |
5594 | 5629 | MWinSetVisible(false); |
5595 | 5630 | } |
5596 | 5631 | } |
@@ -6285,7 +6320,7 @@ public class Viewer extends JFrame implements ChangeListener,TickTimerListener,H | ||
6285 | 6320 | loadRdReservesAll(runRecLoad, null); |
6286 | 6321 | |
6287 | 6322 | // 録画タイトルを読み込む |
6288 | - loadRdTitlesAll(false, null); | |
6323 | +// loadRdTitlesAll(false, null); | |
6289 | 6324 | } |
6290 | 6325 | catch ( Exception e ) { |
6291 | 6326 | System.err.println("【致命的エラー】設定の初期化に失敗しました"); |
@@ -14,6 +14,7 @@ import java.util.Locale; | ||
14 | 14 | import java.util.regex.Matcher; |
15 | 15 | import java.util.regex.Pattern; |
16 | 16 | |
17 | +import tainavi.AbsTitleListView; | |
17 | 18 | import tainavi.AribCharMap; |
18 | 19 | import tainavi.ChannelCode; |
19 | 20 | import tainavi.ChapterInfo; |
@@ -310,14 +311,16 @@ public class PlugIn_RecDBR_T2007 extends HDDRecorderUtils implements HDDRecorder | ||
310 | 311 | ReservesToFile(getReserves(), rsvedFile); |
311 | 312 | |
312 | 313 | // 取得した情報の表示 |
313 | - System.out.println("---Reserved List Start---"); | |
314 | - for ( int i = 0; i<getReserves().size(); i++ ) { | |
315 | - // 詳細情報の取得 | |
316 | - ReserveList e = getReserves().get(i); | |
317 | - System.out.println(String.format("[%s] %s\t%s\t%s\t%s:%s\t%s:%s\t%sm\t%s\t%s(%s)\t%s\t%s", | |
318 | - (i+1), e.getId(), e.getRec_pattern(), e.getRec_nextdate(), e.getAhh(), e.getAmm(), e.getZhh(), e.getZmm(), e.getRec_min(), e.getRec_mode(), e.getTitle(), e.getTitlePop(), e.getChannel(), e.getCh_name())); | |
314 | + if (getDebug()){ | |
315 | + System.out.println("---Reserved List Start---"); | |
316 | + for ( int i = 0; i<getReserves().size(); i++ ) { | |
317 | + // 詳細情報の取得 | |
318 | + ReserveList e = getReserves().get(i); | |
319 | + System.out.println(String.format("[%s] %s\t%s\t%s\t%s:%s\t%s:%s\t%sm\t%s\t%s(%s)\t%s\t%s", | |
320 | + (i+1), e.getId(), e.getRec_pattern(), e.getRec_nextdate(), e.getAhh(), e.getAmm(), e.getZhh(), e.getZmm(), e.getRec_min(), e.getRec_mode(), e.getTitle(), e.getTitlePop(), e.getChannel(), e.getCh_name())); | |
321 | + } | |
322 | + System.out.println("---Reserved List End---"); | |
319 | 323 | } |
320 | - System.out.println("---Reserved List End---"); | |
321 | 324 | |
322 | 325 | return(true); |
323 | 326 | } |
@@ -643,15 +646,17 @@ public class PlugIn_RecDBR_T2007 extends HDDRecorderUtils implements HDDRecorder | ||
643 | 646 | saveTitles(device_id); |
644 | 647 | |
645 | 648 | // 取得した情報の表示 |
646 | - System.out.println("---Title List Start---"); | |
647 | - for ( int i = 0; i<getTitles().size(); i++ ) { | |
648 | - // 詳細情報の取得 | |
649 | - TitleInfo t = getTitles().get(i); | |
650 | - System.out.println(String.format("[%s] %s\t%s\t%s:%s\t%s:%s\t%sm\t%s\t%s\t%s", | |
651 | - (i+1), t.getId(), t.getRec_date(), t.getAhh(), t.getAmm(), t.getZhh(), t.getZmm(), t.getRec_min(), | |
652 | - t.getTitle(), t.getChannel(), t.getCh_name())); | |
649 | + if (getDebug()){ | |
650 | + System.out.println("---Title List Start---"); | |
651 | + for ( int i = 0; i<getTitles().size(); i++ ) { | |
652 | + // 詳細情報の取得 | |
653 | + TitleInfo t = getTitles().get(i); | |
654 | + System.out.println(String.format("[%s] %s\t%s\t%s:%s\t%s:%s\t%sm\t%s\t%s\t%s", | |
655 | + (i+1), t.getId(), t.getRec_date(), t.getAhh(), t.getAmm(), t.getZhh(), t.getZmm(), t.getRec_min(), | |
656 | + t.getTitle(), t.getChannel(), t.getCh_name())); | |
657 | + } | |
658 | + System.out.println("---Title List End---"); | |
653 | 659 | } |
654 | - System.out.println("---Title List End---"); | |
655 | 660 | |
656 | 661 | // 各種設定情報をレコーダから取得する |
657 | 662 | if (setSettingDevice()){ |
@@ -1395,7 +1400,9 @@ public class PlugIn_RecDBR_T2007 extends HDDRecorderUtils implements HDDRecorder | ||
1395 | 1400 | "reserveInfo[data_es]=" + data_es + "&" + |
1396 | 1401 | "reserveInfo[recording]=" + recording; |
1397 | 1402 | |
1398 | -// System.out.println("PostData=[" + postData + "]"); | |
1403 | + if (getDebug()) | |
1404 | + System.out.println("PostData=[" + postData + "]"); | |
1405 | + | |
1399 | 1406 | return postData; |
1400 | 1407 | } |
1401 | 1408 |
@@ -1997,7 +2004,7 @@ public class PlugIn_RecDBR_T2007 extends HDDRecorderUtils implements HDDRecorder | ||
1997 | 2004 | |
1998 | 2005 | String copycount = t.getHidden_params().get("copycount"); |
1999 | 2006 | if (copycount != null) |
2000 | - detail += "コピー回数:" + copycount + "回\n"; | |
2007 | + detail += "コピー回数:" + (copycount.equals("1") ? AbsTitleListView.MOVEONLY : copycount + "回") + "\n"; | |
2001 | 2008 | |
2002 | 2009 | // detail += "CONTENT ID:" + t.getContentId() + "\n"; |
2003 | 2010 |
@@ -60,6 +60,8 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
60 | 60 | private final String ERRID = "[ERROR]"+MSGID; |
61 | 61 | private final String DBGID = "[DEBUG]"+MSGID; |
62 | 62 | |
63 | + private final String PROGCACHE_PREFIX = "TVK_CS_"; | |
64 | + | |
63 | 65 | |
64 | 66 | /******************************************************************************* |
65 | 67 | * 部品 |
@@ -76,6 +78,10 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
76 | 78 | ******************************************************************************/ |
77 | 79 | @Override |
78 | 80 | public boolean loadProgram(String areaCode, boolean force) { |
81 | + setCacheFileOnly(true); | |
82 | + | |
83 | + if (!force && loadFromProgCache(PROGCACHE_PREFIX + areaCode)) | |
84 | + return true; | |
79 | 85 | |
80 | 86 | // 入れ物を空にする |
81 | 87 | newplist = new ArrayList<ProgList>(); |
@@ -104,6 +110,9 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
104 | 110 | pcenter.clear(); |
105 | 111 | pcenter = newplist; |
106 | 112 | newplist = null; |
113 | + | |
114 | + saveToProgCache(PROGCACHE_PREFIX + areaCode); | |
115 | + | |
107 | 116 | return true; |
108 | 117 | } |
109 | 118 |
@@ -147,6 +156,8 @@ public class PlugIn_CSPTVKingdom110 extends PlugIn_TVPTVKingdom implements TVPro | ||
147 | 156 | else if ( f.exists() == false ) { |
148 | 157 | return false; |
149 | 158 | } |
159 | + | |
160 | + setCacheFileOnly(false); | |
150 | 161 | } |
151 | 162 | |
152 | 163 | if (response == null){ |
@@ -39,7 +39,7 @@ public class PlugIn_CSPtheTelevisionD extends PlugIn_TVPtheTelevision implements | ||
39 | 39 | |
40 | 40 | // |
41 | 41 | public boolean loadProgram(String areaCode, boolean force) { |
42 | - | |
42 | + setCacheFileOnly(true); | |
43 | 43 | // 新しい入れ物(トップ)を用意する |
44 | 44 | newplist = new ArrayList<ProgList>(); |
45 | 45 |
@@ -90,6 +90,7 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
90 | 90 | |
91 | 91 | @Override |
92 | 92 | public boolean loadProgram(String areaCode, boolean force) { |
93 | + setCacheFileOnly(true); | |
93 | 94 | |
94 | 95 | // 入れ物を空にする |
95 | 96 | newplist = new ArrayList<ProgList>(); |
@@ -275,6 +276,8 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea | ||
275 | 276 | else{ |
276 | 277 | reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: "+targetCache); |
277 | 278 | } |
279 | + | |
280 | + setCacheFileOnly(false); | |
278 | 281 | } |
279 | 282 | else{ |
280 | 283 | reportProgress(ERRID+"番組表(オンライン)の取得に失敗しました" + targetOnline); |
@@ -65,6 +65,7 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
65 | 65 | private final String ERRID = "[ERROR]"+MSGID; |
66 | 66 | private final String DBGID = "[DEBUG]"+MSGID; |
67 | 67 | |
68 | + private final String PROGCACHE_PREFIX = "TVK_"; | |
68 | 69 | |
69 | 70 | /******************************************************************************* |
70 | 71 | * 部品 |
@@ -98,6 +99,11 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
98 | 99 | |
99 | 100 | @Override |
100 | 101 | public boolean loadProgram(String areaCode, boolean force) { |
102 | + setCacheFileOnly(true); | |
103 | + | |
104 | + if (!force && loadFromProgCache(PROGCACHE_PREFIX + areaCode)){ | |
105 | + return true; | |
106 | + } | |
101 | 107 | |
102 | 108 | // 入れ物を空にする |
103 | 109 | newplist = new ArrayList<ProgList>(); |
@@ -241,6 +247,9 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
241 | 247 | pcenter.clear(); |
242 | 248 | pcenter = newplist; |
243 | 249 | newplist = null; |
250 | + | |
251 | + saveToProgCache(PROGCACHE_PREFIX + areaCode); | |
252 | + | |
244 | 253 | return true; |
245 | 254 | } |
246 | 255 |
@@ -273,6 +282,7 @@ public class PlugIn_TVPTVKingdom extends TVProgramUtils implements TVProgram,Clo | ||
273 | 282 | return false; |
274 | 283 | } |
275 | 284 | |
285 | + setCacheFileOnly(false); | |
276 | 286 | reportProgress(String.format("%s (オンライン)を取得しました: %s",getTVProgramId(), target)); |
277 | 287 | // 連続アクセス規制よけ |
278 | 288 | CommonUtils.milSleep(accessWait); |
@@ -82,6 +82,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
82 | 82 | ******************************************************************************/ |
83 | 83 | |
84 | 84 | public boolean loadProgram(String areaCode, boolean force) { |
85 | + setCacheFileOnly(true); | |
85 | 86 | |
86 | 87 | // 入れ物を空にする |
87 | 88 | newplist.clear(); |
@@ -152,6 +153,7 @@ public class PlugIn_TVPtheTelevision extends TVProgramUtils implements TVProgram | ||
152 | 153 | } |
153 | 154 | |
154 | 155 | reportProgress(MSGID+"(オンライン)を取得しました: ("+counter+"/"+counterMax+") "+pl.Center+" "+url); |
156 | + setCacheFileOnly(false); | |
155 | 157 | } |
156 | 158 | else if (f.exists()) { |
157 | 159 | // キャッシュファイルの読み込み |