• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

タイニー番組ナビゲータ本体


コミットメタ情報

リビジョン0338c736a3cd733a15dcaa6e305f7efbec5be1a9 (tree)
日時2020-09-19 20:56:43
作者Masahiko Kimura <mkimura@u01....>
コミッターMasahiko Kimura

ログメッセージ

Ver.1.12.16 (2020/09/19)

  1. [DiMORA]起動時に一部のキャッシュが古いと番組表全体が空になる問題の対応

変更サマリ

差分

--- a/TinyBannavi/src/tainavi/VersionInfo.java
+++ b/TinyBannavi/src/tainavi/VersionInfo.java
@@ -5,7 +5,7 @@ import java.util.regex.Pattern;
55
66
77 public class VersionInfo {
8- private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.12.15";
8+ private static final String Version = "タイニー番組ナビゲータ for DBR-T2007 3.22.18β+1.12.16";
99
1010 private static final String OSname = System.getProperty("os.name");
1111 private static final String OSvers = System.getProperty("os.version");
--- a/TinyBannavi/src/tainavi/plugintv/PlugIn_TVPDimora.java
+++ b/TinyBannavi/src/tainavi/plugintv/PlugIn_TVPDimora.java
@@ -272,8 +272,10 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
272272 try {
273273 //
274274 String response = null;
275+ String prefix = null;
275276 File f = new File(progCacheFile);
276- if (force == true || f.exists() == false || isCacheOld(progCacheFile)){
277+ boolean bFileAvailable = CommonUtils.isFileAvailable(f,10);
278+ if (force || !f.exists() || !bFileAvailable || isCacheOld(progCacheFile)){
277279 GregorianCalendar c = new GregorianCalendar();
278280 c.setTime(new Date());
279281
@@ -308,27 +310,20 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
308310
309311 String targetOnline = "["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+url+"?"+pstr+"("+areacode+")";
310312 if ( response != null ){
311- if ( CommonUtils.write2file(progCacheFile, "<!-- "+url+"?"+pstr+" -->\n"+response) ) {
312- reportProgress(MSGID+"番組表(オンライン)を取得しました" + targetOnline);
313- }
314- else{
315- reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: "+targetCache);
316- }
317-
313+ reportProgress(MSGID+"番組表(オンライン)を取得しました" + targetOnline);
314+ prefix = "<!-- "+url+"?"+pstr+" -->\n";
318315 setCacheFileOnly(false);
319316 }
320317 else{
321318 reportProgress(ERRID+"番組表(オンライン)の取得に失敗しました" + targetOnline);
322319 if (f.exists() == false)
323320 return false;
324- else
325- reportProgress(MSGID+"番組表(キャッシュ)を代わりに使用します: "+targetCache);
321+ reportProgress(MSGID+"番組表(キャッシュ)を代わりに使用します: "+targetCache);
326322 }
327-
328323 }
329324
330325 if (response == null){
331- if (CommonUtils.isFileAvailable(f,10)) {
326+ if (bFileAvailable) {
332327 // キャッシュファイルの読み込み
333328 response = CommonUtils.read4file(progCacheFile, false);
334329 if ( response == null ) {
@@ -348,6 +343,17 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
348343 reportProgress(ERRID+"番組表に有効なエントリがありません"+targetCache);
349344 return false;
350345 }
346+
347+ if ( prefix != null ){
348+ if ( CommonUtils.write2file(progCacheFile, prefix+response) ) {
349+ reportProgress(MSGID+"番組表(キャッシュ)に保存しました" + targetCache);
350+ }
351+ else{
352+ reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: "+targetCache);
353+ }
354+
355+ setCacheFileOnly(false);
356+ }
351357 }
352358 catch (Exception e) {
353359 reportProgress(ERRID+"番組表の取得で例外が発生しました: "+e.toString());
@@ -372,8 +378,10 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
372378 try {
373379 //
374380 String response = null;
381+ String prefix = null;
375382 File f = new File(progCacheFile);
376- if (force == true || f.exists() == false || isCacheOld(progCacheFile)){
383+ boolean bFileAvailable = CommonUtils.isFileAvailable(f,10);
384+ if (force || !f.exists() || !bFileAvailable || isCacheOld(progCacheFile)){
377385 GregorianCalendar c = new GregorianCalendar();
378386 c.setTime(new Date());
379387
@@ -403,27 +411,22 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
403411
404412 String targetOnline = "["+dt+"日/"+aname+"]: ("+counter+"/"+counterMax+") "+url+"?"+pstr+"("+areacode+")";
405413 if ( response != null ){
406- if ( CommonUtils.write2file(progCacheFile, "<!-- "+url+"?"+pstr+" -->\n"+response) ) {
407- reportProgress(MSGID+"番組表(オンライン)を取得しました" + targetOnline);
408- }
409- else{
410- reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: "+targetCache);
411- }
412-
414+ prefix = "<!-- "+url+"?"+pstr+" -->\n";
415+ reportProgress(MSGID+"番組表(オンライン)を取得しました" + targetOnline);
413416 setCacheFileOnly(false);
414417 }
415418 else{
416419 reportProgress(ERRID+"番組表(オンライン)の取得に失敗しました" + targetOnline);
417420 if (f.exists() == false)
418421 return false;
419- else
420- reportProgress(MSGID+"番組表(キャッシュ)を代わりに使用します: "+targetCache);
422+
423+ reportProgress(MSGID+"番組表(キャッシュ)を代わりに使用します: "+targetCache);
421424 }
422425
423426 }
424427
425428 if (response == null){
426- if (CommonUtils.isFileAvailable(f,10)) {
429+ if (bFileAvailable) {
427430 // キャッシュファイルの読み込み
428431 response = CommonUtils.read4file(progCacheFile, false);
429432 if ( response == null ) {
@@ -443,6 +446,15 @@ public class PlugIn_TVPDimora extends TVProgramUtils implements TVProgram,Clonea
443446 reportProgress(ERRID+"番組表に有効なエントリがありません"+targetCache);
444447 return false;
445448 }
449+
450+ if (prefix != null){
451+ if ( CommonUtils.write2file(progCacheFile, prefix+response) ) {
452+ reportProgress(MSGID+"番組表(キャッシュ)に保存しました" + targetCache);
453+ }
454+ else{
455+ reportProgress(ERRID+"番組表(キャッシュ)の保存に失敗しました: "+targetCache);
456+ }
457+ }
446458 }
447459 catch (Exception e) {
448460 reportProgress(ERRID+"番組表の取得で例外が発生しました: "+e.toString());