From fb382cbe3164dc809246756113057f3c4cd8008c Mon Sep 17 00:00:00 2001
From: Chris Pomeroy <chris.pomeroy@hotmail.com>
Date: Tue, 24 Oct 2017 02:19:28 +0000
Subject: [PATCH] Added the querysubsonic into this repo. Added a check to make sure we didn't already have the aax ablum in the library. This needs refinement as if the name isn't an exact match it won't work.
---
aaxConvert.py | 48 +++++++++++++++++++++++++++---------------------
1 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/aaxConvert.py b/aaxConvert.py
index 3206fdb..9afe859 100755
--- a/aaxConvert.py
+++ b/aaxConvert.py
@@ -6,6 +6,7 @@
import shlex
import json
from getaaxkey.getaaxkey import getcorrectkey
+import querysubsonic
# arguments
# activation_key, file name, codec(default to mp3)
@@ -128,26 +129,31 @@
for rfile in glob.glob(args.filename):
if rfile.find("aax") != -1 and os.path.isfile(rfile):
- act_byte = getcorrectkey(rfile)
metadata = getmetadata(rfile)
album = getmetadatatags('album')
- artist = getmetadatatags('artist')
- title = getmetadatatags('title')
- ddir = "%s/%s/%s" % (path, artist, title)
- single_file_path = "%s/%s.mp3" % (ddir, title)
- if not os.path.exists(ddir):
- os.makedirs(ddir)
- print ddir
- reencode(rfile, single_file_path)
- if mode == 'chapter':
- chapter = 0
- numchapters = getchaptercount()
- while (numchapters > 0 ):
- cstart = getchaptermetadata(chapter, 'start_time')
- cend = getchaptermetadata(chapter, 'end_time')
- chapter += 1
- numchapters -= 1
- schap = str(chapter).zfill(2)
- movetochapters(single_file_path, ddir, schap, title, cstart,cend)
- os.remove(single_file_path)
- getcoverart(rfile, ddir)
\ No newline at end of file
+ #See if we got it already
+ if findalbumbyname(album):
+ return 0
+ else:
+ artist = getmetadatatags('artist')
+ title = getmetadatatags('title')
+ act_byte = getcorrectkey(rfile)
+ ddir = "%s/%s/%s" % (path, artist, title)
+ single_file_path = "%s/%s.mp3" % (ddir, title)
+ if not os.path.exists(ddir):
+ os.makedirs(ddir)
+ print ddir
+ reencode(rfile, single_file_path)
+ if mode == 'chapter':
+ chapter = 0
+ numchapters = getchaptercount()
+ while (numchapters > 0 ):
+ cstart = getchaptermetadata(chapter, 'start_time')
+ cend = getchaptermetadata(chapter, 'end_time')
+ chapter += 1
+ numchapters -= 1
+ schap = str(chapter).zfill(2)
+ movetochapters(single_file_path, ddir, schap, title, cstart,cend)
+ os.remove(single_file_path)
+ getcoverart(rfile, ddir)
+ updatelibrary('testuser','testpass')
\ No newline at end of file
--
Gitblit v1.10.0