chiark / gitweb /
new option --min-cache-reuse for aggressively reusing cached data
[ypp-sc-tools.db-test.git] / yoweb-scrape
index b62ce0037528b1db9684d2484bc3dae9c0250bdb..4832d1ec34b88226af7c2f8e4eacd1aacadde377 100755 (executable)
@@ -248,7 +248,7 @@ u'\\s*\\S*/([-A-Za-z]+)\\s*$|\\s*\\S*/\\S*\\s*\\(ocean\\-wide(?:\\s|\\xa0)+([-A-
                                skl.msg('puzzle "%s" no standing found' % puzzle)
                                continue
                        standing = sl[0]
-                       for i in range(0, len(standingvals)-1):
+                       for i in range(0, len(standingvals)):
                                if standing == standingvals[i]:
                                        self.standings[puzzle] = i
                        if not puzzle in self.standings:
@@ -1080,6 +1080,10 @@ display modes (for --display) apply to ship-aid:
        ao('--all-puzzles', action='store_false', dest='ship_duty',
                help='show all puzzles, not just ship duty stations')
 
+       ao('--min-cache-reuse', type='int', dest='min_max_age',
+               metavar='SECONDS', default=60,
+               help='always reuse cache yoweb data if no older than this')
+
        (opts,args) = pa.parse_args()
        random.seed()
 
@@ -1097,8 +1101,8 @@ display modes (for --display) apply to ship-aid:
        except KeyError: pa.error('unknown mode "%s"' % mode)
 
        # fixed parameters
-       opts.min_max_age = 60
-       opts.expire_age = 3600
+       opts.expire_age = max(3600, opts.min_max_age)
+
        opts.ship_reboard_clearout = 3600
 
        if opts.cache_dir.startswith('~/'):