[mirrorbrain-commits] [mod_asn] r95 - /trunk/asn_get_routeviews.py

From: <poeml_at_mirrorbrain.org>
Date: Thu, 02 Jan 2014 23:21:31 -0000
Author: poeml
Date: Fri Jan  3 00:21:30 2014
New Revision: 95

URL: http://svn.mirrorbrain.org/viewvc/mod_asn?rev=95&view=rev
Log:
asn_get_routeviews:
- in addition, add a flag --no-download, good when the data is distributed in a
  different way, for example with distro updates.
THAT's what Dagobert meant in issue #127. I mixed it up.

Modified:
    trunk/asn_get_routeviews.py

Modified: trunk/asn_get_routeviews.py
URL: http://svn.mirrorbrain.org/viewvc/mod_asn/trunk/asn_get_routeviews.py?rev=95&r1=94&r2=95&view=diff
==============================================================================
--- trunk/asn_get_routeviews.py	(original)
+++ trunk/asn_get_routeviews.py	Fri Jan  3 00:21:30 2014
_at_@ -15,13 +15,16 @@
 # mirrored daily from archive.routeviews.org, to save routeviews.org the traffic
 url = 'http://mirrorbrain.org/routeviews/%s' % filename
 
-if os.path.exists(filename) \
-   and (time.time() - os.path.getmtime(filename)) < (60 * 60 * 8):
-    print >>sys.stderr, 'Using existing file, because it is less than 8h old.'
-    print >>sys.stderr, 'Remove it to have it downloaded again.'
+if len(sys.argv) > 1 and sys.argv[1] == '--no-download':
+    sys.argv.pop(1)
 else:
-    print >>sys.stderr, 'Downloading', url
-    urllib.urlretrieve(url, filename=filename)
+    if os.path.exists(filename) \
+       and (time.time() - os.path.getmtime(filename)) < (60 * 60 * 8):
+        print >>sys.stderr, 'Using existing file, because it is less than 8h old.'
+        print >>sys.stderr, 'Remove it to have it downloaded again.'
+    else:
+        print >>sys.stderr, 'Downloading', url
+        urllib.urlretrieve(url, filename=filename)
 
 if len(sys.argv) > 1 and sys.argv[1] == '--download-only':
     sys.exit(0)




_______________________________________________
mirrorbrain-commits mailing list
Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Thu Jan 02 2014 - 23:21:33 GMT

This archive was generated by hypermail 2.3.0 : Thu Jan 02 2014 - 23:32:06 GMT