Chris Pomeroy
2021-04-18 c25d74d33297ff07c6bfd6e93c6312581f7b9319
aaxConvert.py
@@ -44,8 +44,10 @@
def getmetadata(aaxfile):
    ret = subprocess.check_output(["ffprobe", "-v", "info", "-hide_banner", "-show_format", "-show_chapters", "-print_format", "json", os.path.abspath(aaxfile)])
    mdata = json.loads(ret)
    ret = subprocess.run(["ffprobe", "-v", "info", "-hide_banner", "-show_format", "-show_chapters", "-print_format", "json", os.path.abspath(aaxfile)], capture_output=True)
    mdata = json.loads(ret.stdout)
    aret = ret.stderr.decode().split('\n')[0]
    mdata["checksum"] = aret.split()[-1]
    return mdata
@@ -133,24 +135,23 @@
    process = subprocess.call(shlex.split(command))
    return
def filechecksum(aaxfile):
#The the hex checksum from the file
    ret = subprocess.Popen(["ffprobe", "-v", "info", "-hide_banner", os.path.abspath(aaxfile)], stderr=subprocess.PIPE)
    grep = subprocess.Popen(["grep", "checksum"], stdin=ret.stderr, stdout=subprocess.PIPE)
    awk = subprocess.Popen(["awk", " { print $8 } "], stdin=grep.stdout, stdout=subprocess.PIPE)
    hashsum,out = awk.communicate()
    hashsum = str(hashsum).strip('\n')
    return hashsum
# def filechecksum(aaxfile):
# #The the hex checksum from the file
#     ret = subprocess.Popen(["ffprobe", "-v", "info", "-hide_banner", os.path.abspath(aaxfile)], stderr=subprocess.PIPE)
#     grep = subprocess.Popen(["grep", "checksum"], stdin=ret.stderr, stdout=subprocess.PIPE)
#     awk = subprocess.Popen(["awk", " { print $8 } "], stdin=grep.stdout, stdout=subprocess.PIPE)
#     hashsum,out = awk.communicate()
#     hashsum = hashsum.decode().strip('\n')
#     return hashsum
def getcorrectkey(aaxfile):
def getcorrectkey():
#request the key for the checksum
    hex = filechecksum(aaxfile)
    payload = hex
    try:
        r = requests.post('http://prod-faas-gw.darkurthe.net:8080/function/checkkey', payload, verify=False, timeout=None)
        r = requests.post('http://prod-faas-gw.darkurthe.net:8080/function/checkkey', metadata['checksum'], verify=False, timeout=None)
        return r.text
    except requests.exceptions.HTTPError as err:
        raise error
        return None
for rfile in glob.glob(args.filename):
    if rfile.find("aax") != -1 and os.path.isfile(rfile):