| | |
| | | #!/usr/bin/python |
| | | #!/usr/bin/env python |
| | | import argparse |
| | | import os |
| | | import glob |
| | |
| | | import shlex |
| | | import json |
| | | import requests |
| | | import unicodedata |
| | | from querysubsonic import findalbumbyname |
| | | from time import sleep |
| | | |
| | |
| | | bit_rate = metadata['format']['bit_rate'] |
| | | return bit_rate[:2] |
| | | |
| | | def getmetacopyright(): |
| | | copyright = unicodedata.normalize('NFKD', metadata['format']['tag']['copyright']).encode('ascii','ignore') |
| | | return copyright |
| | | |
| | | |
| | | def getmetadatatags(key): |
| | | # get specific data |
| | |
| | | getmetadatatags('title'), getmetadatatags('artist'), |
| | | getmetadatatags('album_artist'), getmetadatatags('album'), |
| | | getmetadatatags('date'), getmetadatatags('genre'), |
| | | getmetadatatags('copyright'),outpath) |
| | | getmetacopyright(),outpath) |
| | | if args.verbose: |
| | | print(command) |
| | | process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE) |
| | |
| | | if r.status_code == 200: |
| | | key = r.text |
| | | recovery = 0 |
| | | return key |
| | | else: |
| | | print('Checkkey function is down please wait') |
| | | recovery = recovery - 1 |
| | | sleep(5) |
| | | return key |
| | | |
| | | for rfile in glob.glob(args.filename): |
| | | if rfile.find("aax") != -1 and os.path.isfile(rfile): |