git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrefresh30
1 files changed, 16 insertions, 14 deletions
diff --git a/refresh b/refresh
index d568df1..f6b5cc4 100755
--- a/refresh
+++ b/refresh
@@ -109,27 +109,29 @@ def hparse(lines, locode, year):
sys.stdout.flush()
def main(args):
- if args.locale != "" and args.locale != None:
+ if args.locale != [] and args.locale != None:
locode = str(args.locale[0])
else:
- locode = "de-DE"
+ locode = ["de-DE"]
if args.year != None and args.year != []:
year = args.year
else:
now = datetime.now()
- year = datetime.now().year
+ year = [datetime.now().year]
year = unicode(year)
- sys.stdout.write("Fetching holiday data from holidata.net...")
- sys.stdout.flush()
- lines = hfetch(locode, year)
- print(" done.")
- if lines == "":
- print("No lines returned from holidata.net for %s!", locode)
- exit(3)
- sys.stdout.write("Parsing data")
- sys.stdout.flush()
- hparse(lines, locode, year)
- print(" done.")
+ for i in args.locale:
+ for j in args.year:
+ sys.stdout.write("Fetching holiday data from holidata.net... (%s, %s)" % (i, j))
+ sys.stdout.flush()
+ lines = hfetch(unicode(i), unicode(j))
+ print(" done.")
+ if lines == "":
+ print("No lines returned from holidata.net for %s!", locode)
+ exit(3)
+ sys.stdout.write("Parsing data")
+ sys.stdout.flush()
+ hparse(lines, unicode(i), unicode(j))
+ print(" done.")
if __name__ == "__main__":
usage = """See https://holidata.net for details of supported locales and regions."""