diff options
| author | H. P. <harald.p.@xmart.de> | 2018-09-28 14:58:01 +0200 | 
|---|---|---|
| committer | H. P. <harald.p.@xmart.de> | 2018-09-28 14:58:01 +0200 | 
| commit | 7bb03c0b6d2767733c0c448da1ba08ded1c16aa1 (patch) | |
| tree | 79cc980295a2c074a156f35c2d0b898a63097060 | |
| parent | 9848fa8568fd25a6da5b60f56d602274d91de730 (diff) | |
| download | timewarrior-holidays-7bb03c0b6d2767733c0c448da1ba08ded1c16aa1.tar.bz2 | |
Now correctly parsing args, we're now able to get argument lists
| -rwxr-xr-x | refresh | 30 | 
1 files changed, 16 insertions, 14 deletions
| @@ -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.""" | 
