changeset 143:bfa78302cf09

ignore some combat reports, which is not finished.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 12:47:34 +0800
parents 9b8aa30a532c
children 9fb18f3d6e26
files Ikariam.pm
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Ikariam.pm	Fri Oct 31 10:53:14 2008 +0800
+++ b/Ikariam.pm	Fri Oct 31 12:47:34 2008 +0800
@@ -586,7 +586,9 @@
        $report{island} = $1;
        $report{city} = $2;
     } else {
-        die ($href);
+        warn ("can not read combat reprot $combatId");
+        warn ($href);
+        return undef;
     }
     $report{gold} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="gold"]');
     $report{wood} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="wood"]');
@@ -631,6 +633,9 @@
                     $report->set('time', time);
 
                     $report->update();
+                } else {
+                    # for some reason, we can not read the report.
+                    next;
                 }
             } else {
                 # we have found the report we like to know, exit the function.