Chris Pomeroy
2021-04-18 51d7f1f442565b00acf916bab28979ec0b565907
Added error handling in the getcorrectkey
1 files modified
17 ■■■■■ changed files
aaxConvert.py 17 ●●●●● patch | view | raw | blame | history
aaxConvert.py
@@ -146,17 +146,11 @@
#request the key for the checksum
    hex = filechecksum(aaxfile)
    payload = hex
    recovery = 3
    while recovery != 0:
    try:
      r = requests.post('http://prod-faas-gw.darkurthe.net:8080/function/checkkey', payload, verify=False, timeout=None)
      if r.status_code == 200:
          key = r.text
          recovery = 0
          return key
      else:
          print('Checkkey function is down please wait')
          recovery = recovery - 1
          sleep(15)
        return r.text
    except requests.exceptions.HTTPError as err:
        raise error
for rfile in glob.glob(args.filename):
    if rfile.find("aax") != -1 and os.path.isfile(rfile):
@@ -167,6 +161,9 @@
            artist = getmetadatatags('artist')
            title = getmetadatatags('title')
            act_byte = getcorrectkey(rfile)
            if act_byte == None:
                sys.exit("Can't continue with this file {rfile}")
            else:
            ddir = "%s/%s/%s" % (path, artist, title)
            single_file_path = "/processing/%s.mp3" % (title)
            if not os.path.exists(ddir):