diff options
-rwxr-xr-x | refresh | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -74,7 +74,7 @@ def hparse(lines, locode, year): This function parses the JSON string we expect from holidata.net and writes its fragments to the specific region files, if a region is given. So, e.g.: a holiday for all of the US will not have a region definition and thus be written to file.en-US, whereas a holiday that is not - valid for all of the US but is valid for Oregon will be written to file.en-OR. + valid for all of the US but is valid for Oregon will be written to file.us-OR. """ islocdef = {} for line in lines.split('\n'): @@ -82,14 +82,15 @@ def hparse(lines, locode, year): sys.stdout.write(".") jdata = json.loads(line) mylocale = unicode(jdata['locale']) - mycountry = mylocale.split('-')[0] + mycountry = mylocale.split('-')[1] + myscountry = mycountry.lower() myregion = unicode(jdata['region']) if myregion == "": myregion = mylocale.split('-')[1] # holidata.net violates ISO-3166-2:DE here: if myregion == "NRW": myregion = "NW" # or Neustadt/Weinstr., Palz > Pott - myhlocale = unicode(mycountry + "-" + myregion) + myhlocale = unicode(myscountry + "-" + myregion) if jdata['date'] == "": print("%s has no date given for %s!", jdata['description'], jdata['locale']) mydate = unicode('1970_01_01') |