mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
autopep8 E221,E222,E225,E227,E228,E251 spaces around operators and in parameters
This commit is contained in:
@@ -48,14 +48,14 @@ SNATCHED_PROPER = 9 # qualified with quality
|
|||||||
class Quality:
|
class Quality:
|
||||||
|
|
||||||
NONE = 0
|
NONE = 0
|
||||||
B192 = 1<<1 # 2
|
B192 = 1 << 1 # 2
|
||||||
VBR = 1<<2 # 4
|
VBR = 1 << 2 # 4
|
||||||
B256 = 1<<3 # 8
|
B256 = 1 << 3 # 8
|
||||||
B320 = 1<<4 #16
|
B320 = 1 << 4 #16
|
||||||
FLAC = 1<<5 #32
|
FLAC = 1 << 5 #32
|
||||||
|
|
||||||
# put these bits at the other end of the spectrum, far enough out that they shouldn't interfere
|
# put these bits at the other end of the spectrum, far enough out that they shouldn't interfere
|
||||||
UNKNOWN = 1<<15
|
UNKNOWN = 1 << 15
|
||||||
|
|
||||||
qualityStrings = {NONE: "N/A",
|
qualityStrings = {NONE: "N/A",
|
||||||
UNKNOWN: "Unknown",
|
UNKNOWN: "Unknown",
|
||||||
@@ -83,7 +83,7 @@ class Quality:
|
|||||||
anyQuality = reduce(operator.or_, anyQualities)
|
anyQuality = reduce(operator.or_, anyQualities)
|
||||||
if bestQualities:
|
if bestQualities:
|
||||||
bestQuality = reduce(operator.or_, bestQualities)
|
bestQuality = reduce(operator.or_, bestQualities)
|
||||||
return anyQuality | (bestQuality<<16)
|
return anyQuality | (bestQuality << 16)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def splitQuality(quality):
|
def splitQuality(quality):
|
||||||
@@ -92,7 +92,7 @@ class Quality:
|
|||||||
for curQual in Quality.qualityStrings.keys():
|
for curQual in Quality.qualityStrings.keys():
|
||||||
if curQual & quality:
|
if curQual & quality:
|
||||||
anyQualities.append(curQual)
|
anyQualities.append(curQual)
|
||||||
if curQual<<16 & quality:
|
if curQual << 16 & quality:
|
||||||
bestQualities.append(curQual)
|
bestQualities.append(curQual)
|
||||||
|
|
||||||
return (anyQualities, bestQualities)
|
return (anyQualities, bestQualities)
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ class MetaFile(File):
|
|||||||
|
|
||||||
def folders(self):
|
def folders(self):
|
||||||
artist = self.content['artist']
|
artist = self.content['artist']
|
||||||
album = self.content['date'] + ' - ' + self.content['title'] + ' (' + self.content['label'] + ' - ' + self.content['catalog'] + ')'
|
album = self.content['date'] + ' - ' + self.content['title'] + ' (' + self.content['label'] + ' - ' + self.content['catalog'] + ')'
|
||||||
return artist, album
|
return artist, album
|
||||||
|
|
||||||
def complete(self):
|
def complete(self):
|
||||||
|
|||||||
@@ -628,22 +628,22 @@ def sab_sanitize_foldername(name):
|
|||||||
Remove any leading and trailing dot and space characters
|
Remove any leading and trailing dot and space characters
|
||||||
"""
|
"""
|
||||||
CH_ILLEGAL = r'\/<>?*|"'
|
CH_ILLEGAL = r'\/<>?*|"'
|
||||||
CH_LEGAL = r'++{}!@#`'
|
CH_LEGAL = r'++{}!@#`'
|
||||||
|
|
||||||
FL_ILLEGAL = CH_ILLEGAL + ':\x92"'
|
FL_ILLEGAL = CH_ILLEGAL + ':\x92"'
|
||||||
FL_LEGAL = CH_LEGAL + "-''"
|
FL_LEGAL = CH_LEGAL + "-''"
|
||||||
|
|
||||||
uFL_ILLEGAL = FL_ILLEGAL.decode('latin-1')
|
uFL_ILLEGAL = FL_ILLEGAL.decode('latin-1')
|
||||||
uFL_LEGAL = FL_LEGAL.decode('latin-1')
|
uFL_LEGAL = FL_LEGAL.decode('latin-1')
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
return name
|
return name
|
||||||
if isinstance(name, unicode):
|
if isinstance(name, unicode):
|
||||||
illegal = uFL_ILLEGAL
|
illegal = uFL_ILLEGAL
|
||||||
legal = uFL_LEGAL
|
legal = uFL_LEGAL
|
||||||
else:
|
else:
|
||||||
illegal = FL_ILLEGAL
|
illegal = FL_ILLEGAL
|
||||||
legal = FL_LEGAL
|
legal = FL_LEGAL
|
||||||
|
|
||||||
lst = []
|
lst = []
|
||||||
for ch in name.strip():
|
for ch in name.strip():
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
|
|||||||
|
|
||||||
if rg_exists:
|
if rg_exists:
|
||||||
newValueDict['DateAdded'] = rg_exists['DateAdded']
|
newValueDict['DateAdded'] = rg_exists['DateAdded']
|
||||||
newValueDict['Status'] = rg_exists['Status']
|
newValueDict['Status'] = rg_exists['Status']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
today = helpers.today()
|
today = helpers.today()
|
||||||
|
|||||||
+10
-10
@@ -94,9 +94,9 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
|
|||||||
|
|
||||||
subdirectory = r.replace(dir, '')
|
subdirectory = r.replace(dir, '')
|
||||||
latest_subdirectory.append(subdirectory)
|
latest_subdirectory.append(subdirectory)
|
||||||
if file_count == 0 and r.replace(dir, '') !='':
|
if file_count == 0 and r.replace(dir, '') != '':
|
||||||
logger.info("[%s] Now scanning subdirectory %s" % (dir.decode(headphones.SYS_ENCODING, 'replace'), subdirectory.decode(headphones.SYS_ENCODING, 'replace')))
|
logger.info("[%s] Now scanning subdirectory %s" % (dir.decode(headphones.SYS_ENCODING, 'replace'), subdirectory.decode(headphones.SYS_ENCODING, 'replace')))
|
||||||
elif latest_subdirectory[file_count] != latest_subdirectory[file_count-1] and file_count !=0:
|
elif latest_subdirectory[file_count] != latest_subdirectory[file_count-1] and file_count != 0:
|
||||||
logger.info("[%s] Now scanning subdirectory %s" % (dir.decode(headphones.SYS_ENCODING, 'replace'), subdirectory.decode(headphones.SYS_ENCODING, 'replace')))
|
logger.info("[%s] Now scanning subdirectory %s" % (dir.decode(headphones.SYS_ENCODING, 'replace'), subdirectory.decode(headphones.SYS_ENCODING, 'replace')))
|
||||||
|
|
||||||
song = os.path.join(r, files)
|
song = os.path.join(r, files)
|
||||||
@@ -130,7 +130,7 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
|
|||||||
# TODO: skip adding songs without the minimum requisite information (just a matter of putting together the right if statements)
|
# TODO: skip adding songs without the minimum requisite information (just a matter of putting together the right if statements)
|
||||||
|
|
||||||
if f_artist and f.album and f.title:
|
if f_artist and f.album and f.title:
|
||||||
CleanName = helpers.cleanName(f_artist +' '+ f.album +' '+ f.title)
|
CleanName = helpers.cleanName(f_artist + ' ' + f.album + ' ' + f.title)
|
||||||
else:
|
else:
|
||||||
CleanName = None
|
CleanName = None
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
|
|||||||
if f_artist:
|
if f_artist:
|
||||||
new_artists.append(f_artist)
|
new_artists.append(f_artist)
|
||||||
myDB.upsert("have", newValueDict, controlValueDict)
|
myDB.upsert("have", newValueDict, controlValueDict)
|
||||||
new_song_count+=1
|
new_song_count += 1
|
||||||
else:
|
else:
|
||||||
if check_exist_song['ArtistName'] != f_artist or check_exist_song['AlbumTitle'] != f.album or check_exist_song['TrackTitle'] != f.title:
|
if check_exist_song['ArtistName'] != f_artist or check_exist_song['AlbumTitle'] != f.album or check_exist_song['TrackTitle'] != f.title:
|
||||||
#Important track metadata has been modified, need to run matcher again
|
#Important track metadata has been modified, need to run matcher again
|
||||||
@@ -173,13 +173,13 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
|
|||||||
myDB.upsert("have", newValueDict, controlValueDict)
|
myDB.upsert("have", newValueDict, controlValueDict)
|
||||||
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE Location=?', [None, None, None, unicode_song_path])
|
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE Location=?', [None, None, None, unicode_song_path])
|
||||||
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE Location=?', [None, None, None, unicode_song_path])
|
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE Location=?', [None, None, None, unicode_song_path])
|
||||||
new_song_count+=1
|
new_song_count += 1
|
||||||
else:
|
else:
|
||||||
#This track information hasn't changed
|
#This track information hasn't changed
|
||||||
if f_artist and check_exist_song['Matched'] != "Ignored":
|
if f_artist and check_exist_song['Matched'] != "Ignored":
|
||||||
new_artists.append(f_artist)
|
new_artists.append(f_artist)
|
||||||
|
|
||||||
file_count+=1
|
file_count += 1
|
||||||
|
|
||||||
# Now we start track matching
|
# Now we start track matching
|
||||||
logger.info("%s new/modified songs found and added to the database" % new_song_count)
|
logger.info("%s new/modified songs found and added to the database" % new_song_count)
|
||||||
@@ -202,13 +202,13 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
|
|||||||
latest_artist.append(song['ArtistName'])
|
latest_artist.append(song['ArtistName'])
|
||||||
if song_count == 0:
|
if song_count == 0:
|
||||||
logger.info("Now matching songs by %s" % song['ArtistName'])
|
logger.info("Now matching songs by %s" % song['ArtistName'])
|
||||||
elif latest_artist[song_count] != latest_artist[song_count-1] and song_count !=0:
|
elif latest_artist[song_count] != latest_artist[song_count-1] and song_count != 0:
|
||||||
logger.info("Now matching songs by %s" % song['ArtistName'])
|
logger.info("Now matching songs by %s" % song['ArtistName'])
|
||||||
|
|
||||||
song_count += 1
|
song_count += 1
|
||||||
completion_percentage = float(song_count)/total_number_of_songs * 100
|
completion_percentage = float(song_count)/total_number_of_songs * 100
|
||||||
|
|
||||||
if completion_percentage%10 == 0:
|
if completion_percentage % 10 == 0:
|
||||||
logger.info("Track matching is " + str(completion_percentage) + "% complete")
|
logger.info("Track matching is " + str(completion_percentage) + "% complete")
|
||||||
|
|
||||||
#THE "MORE-SPECIFIC" CLAUSES HERE HAVE ALL BEEN REMOVED. WHEN RUNNING A LIBRARY SCAN, THE ONLY CLAUSES THAT
|
#THE "MORE-SPECIFIC" CLAUSES HERE HAVE ALL BEEN REMOVED. WHEN RUNNING A LIBRARY SCAN, THE ONLY CLAUSES THAT
|
||||||
@@ -356,9 +356,9 @@ def update_album_status(AlbumID=None):
|
|||||||
total_tracks = 0
|
total_tracks = 0
|
||||||
have_tracks = 0
|
have_tracks = 0
|
||||||
for track in track_counter:
|
for track in track_counter:
|
||||||
total_tracks+=1
|
total_tracks += 1
|
||||||
if track['Location']:
|
if track['Location']:
|
||||||
have_tracks+=1
|
have_tracks += 1
|
||||||
if total_tracks != 0:
|
if total_tracks != 0:
|
||||||
album_completion = float(float(have_tracks) / float(total_tracks)) * 100
|
album_completion = float(float(have_tracks) / float(total_tracks)) * 100
|
||||||
else:
|
else:
|
||||||
|
|||||||
+1
-1
@@ -495,7 +495,7 @@ def get_new_releases(rgid, includeExtras=False, forcefull=False):
|
|||||||
release['ReleaseCountry'] = unicode(releasedata['country']) if 'country' in releasedata else u'Unknown'
|
release['ReleaseCountry'] = unicode(releasedata['country']) if 'country' in releasedata else u'Unknown'
|
||||||
#assuming that the list will contain media and that the format will be consistent
|
#assuming that the list will contain media and that the format will be consistent
|
||||||
try:
|
try:
|
||||||
additional_medium=''
|
additional_medium = ''
|
||||||
for position in releasedata['medium-list']:
|
for position in releasedata['medium-list']:
|
||||||
if position['format'] == releasedata['medium-list'][0]['format']:
|
if position['format'] == releasedata['medium-list'][0]['format']:
|
||||||
medium_count = int(position['position'])
|
medium_count = int(position['position'])
|
||||||
|
|||||||
+24
-24
@@ -41,10 +41,10 @@ def encode(albumPath):
|
|||||||
logger.error('Details for xld profile \'%s\' not found, files will not be re-encoded', xldProfile)
|
logger.error('Details for xld profile \'%s\' not found, files will not be re-encoded', xldProfile)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
tempDirEncode=os.path.join(albumPath, "temp")
|
tempDirEncode = os.path.join(albumPath, "temp")
|
||||||
musicFiles=[]
|
musicFiles = []
|
||||||
musicFinalFiles=[]
|
musicFinalFiles = []
|
||||||
musicTempFiles=[]
|
musicTempFiles = []
|
||||||
encoder = ""
|
encoder = ""
|
||||||
|
|
||||||
# Create temporary directory, but remove the old one first.
|
# Create temporary directory, but remove the old one first.
|
||||||
@@ -86,24 +86,24 @@ def encode(albumPath):
|
|||||||
else:
|
else:
|
||||||
if XLD:
|
if XLD:
|
||||||
encoder = os.path.join('/Applications', 'xld')
|
encoder = os.path.join('/Applications', 'xld')
|
||||||
elif headphones.CONFIG.ENCODER =='lame':
|
elif headphones.CONFIG.ENCODER == 'lame':
|
||||||
if headphones.SYS_PLATFORM == "win32":
|
if headphones.SYS_PLATFORM == "win32":
|
||||||
## NEED THE DEFAULT LAME INSTALL ON WIN!
|
## NEED THE DEFAULT LAME INSTALL ON WIN!
|
||||||
encoder = "C:/Program Files/lame/lame.exe"
|
encoder = "C:/Program Files/lame/lame.exe"
|
||||||
else:
|
else:
|
||||||
encoder="lame"
|
encoder = "lame"
|
||||||
elif headphones.CONFIG.ENCODER =='ffmpeg':
|
elif headphones.CONFIG.ENCODER == 'ffmpeg':
|
||||||
if headphones.SYS_PLATFORM == "win32":
|
if headphones.SYS_PLATFORM == "win32":
|
||||||
encoder = "C:/Program Files/ffmpeg/bin/ffmpeg.exe"
|
encoder = "C:/Program Files/ffmpeg/bin/ffmpeg.exe"
|
||||||
else:
|
else:
|
||||||
encoder="ffmpeg"
|
encoder = "ffmpeg"
|
||||||
elif headphones.CONFIG.ENCODER == 'libav':
|
elif headphones.CONFIG.ENCODER == 'libav':
|
||||||
if headphones.SYS_PLATFORM == "win32":
|
if headphones.SYS_PLATFORM == "win32":
|
||||||
encoder = "C:/Program Files/libav/bin/avconv.exe"
|
encoder = "C:/Program Files/libav/bin/avconv.exe"
|
||||||
else:
|
else:
|
||||||
encoder="avconv"
|
encoder = "avconv"
|
||||||
|
|
||||||
i=0
|
i = 0
|
||||||
encoder_failed = False
|
encoder_failed = False
|
||||||
jobs = []
|
jobs = []
|
||||||
|
|
||||||
@@ -125,12 +125,12 @@ def encode(albumPath):
|
|||||||
else:
|
else:
|
||||||
encode = True
|
encode = True
|
||||||
else:
|
else:
|
||||||
if headphones.CONFIG.ENCODEROUTPUTFORMAT=='ogg':
|
if headphones.CONFIG.ENCODEROUTPUTFORMAT == 'ogg':
|
||||||
if music.decode(headphones.SYS_ENCODING, 'replace').lower().endswith('.ogg'):
|
if music.decode(headphones.SYS_ENCODING, 'replace').lower().endswith('.ogg'):
|
||||||
logger.warn('Cannot re-encode .ogg %s', music.decode(headphones.SYS_ENCODING, 'replace'))
|
logger.warn('Cannot re-encode .ogg %s', music.decode(headphones.SYS_ENCODING, 'replace'))
|
||||||
else:
|
else:
|
||||||
encode = True
|
encode = True
|
||||||
elif (headphones.CONFIG.ENCODEROUTPUTFORMAT=='mp3' or headphones.CONFIG.ENCODEROUTPUTFORMAT=='m4a'):
|
elif (headphones.CONFIG.ENCODEROUTPUTFORMAT == 'mp3' or headphones.CONFIG.ENCODEROUTPUTFORMAT == 'm4a'):
|
||||||
if (music.decode(headphones.SYS_ENCODING, 'replace').lower().endswith('.'+headphones.CONFIG.ENCODEROUTPUTFORMAT) and (int(infoMusic.bitrate / 1000 ) <= headphones.CONFIG.BITRATE)):
|
if (music.decode(headphones.SYS_ENCODING, 'replace').lower().endswith('.'+headphones.CONFIG.ENCODEROUTPUTFORMAT) and (int(infoMusic.bitrate / 1000 ) <= headphones.CONFIG.BITRATE)):
|
||||||
logger.info('%s has bitrate <= %skb, will not be re-encoded', music, headphones.CONFIG.BITRATE)
|
logger.info('%s has bitrate <= %skb, will not be re-encoded', music, headphones.CONFIG.BITRATE)
|
||||||
else:
|
else:
|
||||||
@@ -143,7 +143,7 @@ def encode(albumPath):
|
|||||||
musicFiles[i] = None
|
musicFiles[i] = None
|
||||||
musicTempFiles[i] = None
|
musicTempFiles[i] = None
|
||||||
|
|
||||||
i=i+1
|
i = i+1
|
||||||
|
|
||||||
# Encode music files
|
# Encode music files
|
||||||
if len(jobs) > 0:
|
if len(jobs) > 0:
|
||||||
@@ -271,9 +271,9 @@ def command(encoder, musicSource, musicDest, albumPath):
|
|||||||
opts = []
|
opts = []
|
||||||
if not headphones.CONFIG.ADVANCEDENCODER:
|
if not headphones.CONFIG.ADVANCEDENCODER:
|
||||||
opts.extend(['-h'])
|
opts.extend(['-h'])
|
||||||
if headphones.CONFIG.ENCODERVBRCBR=='cbr':
|
if headphones.CONFIG.ENCODERVBRCBR == 'cbr':
|
||||||
opts.extend(['--resample', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-b', str(headphones.CONFIG.BITRATE)])
|
opts.extend(['--resample', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-b', str(headphones.CONFIG.BITRATE)])
|
||||||
elif headphones.CONFIG.ENCODERVBRCBR=='vbr':
|
elif headphones.CONFIG.ENCODERVBRCBR == 'vbr':
|
||||||
opts.extend(['-v', str(headphones.CONFIG.ENCODERQUALITY)])
|
opts.extend(['-v', str(headphones.CONFIG.ENCODERQUALITY)])
|
||||||
else:
|
else:
|
||||||
advanced = (headphones.CONFIG.ADVANCEDENCODER.split())
|
advanced = (headphones.CONFIG.ADVANCEDENCODER.split())
|
||||||
@@ -288,13 +288,13 @@ def command(encoder, musicSource, musicDest, albumPath):
|
|||||||
cmd = [encoder, '-i', musicSource]
|
cmd = [encoder, '-i', musicSource]
|
||||||
opts = []
|
opts = []
|
||||||
if not headphones.CONFIG.ADVANCEDENCODER:
|
if not headphones.CONFIG.ADVANCEDENCODER:
|
||||||
if headphones.CONFIG.ENCODEROUTPUTFORMAT=='ogg':
|
if headphones.CONFIG.ENCODEROUTPUTFORMAT == 'ogg':
|
||||||
opts.extend(['-acodec', 'libvorbis'])
|
opts.extend(['-acodec', 'libvorbis'])
|
||||||
if headphones.CONFIG.ENCODEROUTPUTFORMAT=='m4a':
|
if headphones.CONFIG.ENCODEROUTPUTFORMAT == 'm4a':
|
||||||
opts.extend(['-strict', 'experimental'])
|
opts.extend(['-strict', 'experimental'])
|
||||||
if headphones.CONFIG.ENCODERVBRCBR=='cbr':
|
if headphones.CONFIG.ENCODERVBRCBR == 'cbr':
|
||||||
opts.extend(['-ar', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-ab', str(headphones.CONFIG.BITRATE) + 'k'])
|
opts.extend(['-ar', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-ab', str(headphones.CONFIG.BITRATE) + 'k'])
|
||||||
elif headphones.CONFIG.ENCODERVBRCBR=='vbr':
|
elif headphones.CONFIG.ENCODERVBRCBR == 'vbr':
|
||||||
opts.extend(['-aq', str(headphones.CONFIG.ENCODERQUALITY)])
|
opts.extend(['-aq', str(headphones.CONFIG.ENCODERQUALITY)])
|
||||||
opts.extend(['-y', '-ac', '2', '-vn'])
|
opts.extend(['-y', '-ac', '2', '-vn'])
|
||||||
else:
|
else:
|
||||||
@@ -309,13 +309,13 @@ def command(encoder, musicSource, musicDest, albumPath):
|
|||||||
cmd = [encoder, '-i', musicSource]
|
cmd = [encoder, '-i', musicSource]
|
||||||
opts = []
|
opts = []
|
||||||
if not headphones.CONFIG.ADVANCEDENCODER:
|
if not headphones.CONFIG.ADVANCEDENCODER:
|
||||||
if headphones.CONFIG.ENCODEROUTPUTFORMAT=='ogg':
|
if headphones.CONFIG.ENCODEROUTPUTFORMAT == 'ogg':
|
||||||
opts.extend(['-acodec', 'libvorbis'])
|
opts.extend(['-acodec', 'libvorbis'])
|
||||||
if headphones.CONFIG.ENCODEROUTPUTFORMAT=='m4a':
|
if headphones.CONFIG.ENCODEROUTPUTFORMAT == 'm4a':
|
||||||
opts.extend(['-strict', 'experimental'])
|
opts.extend(['-strict', 'experimental'])
|
||||||
if headphones.CONFIG.ENCODERVBRCBR=='cbr':
|
if headphones.CONFIG.ENCODERVBRCBR == 'cbr':
|
||||||
opts.extend(['-ar', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-ab', str(headphones.CONFIG.BITRATE) + 'k'])
|
opts.extend(['-ar', str(headphones.CONFIG.SAMPLINGFREQUENCY), '-ab', str(headphones.CONFIG.BITRATE) + 'k'])
|
||||||
elif headphones.CONFIG.ENCODERVBRCBR=='vbr':
|
elif headphones.CONFIG.ENCODERVBRCBR == 'vbr':
|
||||||
opts.extend(['-aq', str(headphones.CONFIG.ENCODERQUALITY)])
|
opts.extend(['-aq', str(headphones.CONFIG.ENCODERQUALITY)])
|
||||||
opts.extend(['-y', '-ac', '2', '-vn'])
|
opts.extend(['-y', '-ac', '2', '-vn'])
|
||||||
else:
|
else:
|
||||||
@@ -362,7 +362,7 @@ def command(encoder, musicSource, musicDest, albumPath):
|
|||||||
|
|
||||||
|
|
||||||
def getTimeEncode(start):
|
def getTimeEncode(start):
|
||||||
seconds =int(time.time()-start)
|
seconds = int(time.time()-start)
|
||||||
hours = seconds / 3600
|
hours = seconds / 3600
|
||||||
seconds -= 3600*hours
|
seconds -= 3600*hours
|
||||||
minutes = seconds / 60
|
minutes = seconds / 60
|
||||||
|
|||||||
+20
-20
@@ -153,8 +153,8 @@ class PROWL(object):
|
|||||||
|
|
||||||
http_handler.request("POST",
|
http_handler.request("POST",
|
||||||
"/publicapi/add",
|
"/publicapi/add",
|
||||||
headers = {'Content-type': "application/x-www-form-urlencoded"},
|
headers={'Content-type': "application/x-www-form-urlencoded"},
|
||||||
body = urlencode(data))
|
body=urlencode(data))
|
||||||
response = http_handler.getresponse()
|
response = http_handler.getresponse()
|
||||||
request_status = response.status
|
request_status = response.status
|
||||||
|
|
||||||
@@ -456,9 +456,9 @@ class PUSHBULLET(object):
|
|||||||
|
|
||||||
http_handler.request("POST",
|
http_handler.request("POST",
|
||||||
"/api/pushes",
|
"/api/pushes",
|
||||||
headers = {'Content-type': "application/x-www-form-urlencoded",
|
headers={'Content-type': "application/x-www-form-urlencoded",
|
||||||
'Authorization': 'Basic %s' % base64.b64encode(headphones.CONFIG.PUSHBULLET_APIKEY + ":") },
|
'Authorization': 'Basic %s' % base64.b64encode(headphones.CONFIG.PUSHBULLET_APIKEY + ":") },
|
||||||
body = urlencode(data))
|
body=urlencode(data))
|
||||||
response = http_handler.getresponse()
|
response = http_handler.getresponse()
|
||||||
request_status = response.status
|
request_status = response.status
|
||||||
logger.debug(u"PushBullet response status: %r" % request_status)
|
logger.debug(u"PushBullet response status: %r" % request_status)
|
||||||
@@ -508,8 +508,8 @@ class PUSHALOT(object):
|
|||||||
|
|
||||||
http_handler.request("POST",
|
http_handler.request("POST",
|
||||||
"/api/sendmessage",
|
"/api/sendmessage",
|
||||||
headers = {'Content-type': "application/x-www-form-urlencoded"},
|
headers={'Content-type': "application/x-www-form-urlencoded"},
|
||||||
body = urlencode(data))
|
body=urlencode(data))
|
||||||
response = http_handler.getresponse()
|
response = http_handler.getresponse()
|
||||||
request_status = response.status
|
request_status = response.status
|
||||||
|
|
||||||
@@ -594,8 +594,8 @@ class PUSHOVER(object):
|
|||||||
|
|
||||||
http_handler.request("POST",
|
http_handler.request("POST",
|
||||||
"/1/messages.json",
|
"/1/messages.json",
|
||||||
headers = {'Content-type': "application/x-www-form-urlencoded"},
|
headers={'Content-type': "application/x-www-form-urlencoded"},
|
||||||
body = urlencode(data))
|
body=urlencode(data))
|
||||||
response = http_handler.getresponse()
|
response = http_handler.getresponse()
|
||||||
request_status = response.status
|
request_status = response.status
|
||||||
logger.debug(u"Pushover response status: %r" % request_status)
|
logger.debug(u"Pushover response status: %r" % request_status)
|
||||||
@@ -627,9 +627,9 @@ class PUSHOVER(object):
|
|||||||
class TwitterNotifier(object):
|
class TwitterNotifier(object):
|
||||||
|
|
||||||
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'
|
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'
|
||||||
ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'
|
ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'
|
||||||
AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'
|
AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'
|
||||||
SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'
|
SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.consumer_key = "oYKnp2ddX5gbARjqX8ZAAg"
|
self.consumer_key = "oYKnp2ddX5gbARjqX8ZAAg"
|
||||||
@@ -649,8 +649,8 @@ class TwitterNotifier(object):
|
|||||||
def _get_authorization(self):
|
def _get_authorization(self):
|
||||||
|
|
||||||
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() #@UnusedVariable
|
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() #@UnusedVariable
|
||||||
oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret)
|
oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret)
|
||||||
oauth_client = oauth.Client(oauth_consumer)
|
oauth_client = oauth.Client(oauth_consumer)
|
||||||
|
|
||||||
logger.info('Requesting temp token from Twitter')
|
logger.info('Requesting temp token from Twitter')
|
||||||
|
|
||||||
@@ -664,7 +664,7 @@ class TwitterNotifier(object):
|
|||||||
headphones.CONFIG.TWITTER_USERNAME = request_token['oauth_token']
|
headphones.CONFIG.TWITTER_USERNAME = request_token['oauth_token']
|
||||||
headphones.CONFIG.TWITTER_PASSWORD = request_token['oauth_token_secret']
|
headphones.CONFIG.TWITTER_PASSWORD = request_token['oauth_token_secret']
|
||||||
|
|
||||||
return self.AUTHORIZATION_URL+"?oauth_token="+ request_token['oauth_token']
|
return self.AUTHORIZATION_URL+"?oauth_token=" + request_token['oauth_token']
|
||||||
|
|
||||||
def _get_credentials(self, key):
|
def _get_credentials(self, key):
|
||||||
request_token = {}
|
request_token = {}
|
||||||
@@ -679,14 +679,14 @@ class TwitterNotifier(object):
|
|||||||
logger.info('Generating and signing request for an access token using key '+key)
|
logger.info('Generating and signing request for an access token using key '+key)
|
||||||
|
|
||||||
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() #@UnusedVariable
|
signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() #@UnusedVariable
|
||||||
oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret)
|
oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret)
|
||||||
logger.info('oauth_consumer: '+str(oauth_consumer))
|
logger.info('oauth_consumer: '+str(oauth_consumer))
|
||||||
oauth_client = oauth.Client(oauth_consumer, token)
|
oauth_client = oauth.Client(oauth_consumer, token)
|
||||||
logger.info('oauth_client: '+str(oauth_client))
|
logger.info('oauth_client: '+str(oauth_client))
|
||||||
resp, content = oauth_client.request(self.ACCESS_TOKEN_URL, method='POST', body='oauth_verifier=%s' % key)
|
resp, content = oauth_client.request(self.ACCESS_TOKEN_URL, method='POST', body='oauth_verifier=%s' % key)
|
||||||
logger.info('resp, content: '+str(resp)+','+str(content))
|
logger.info('resp, content: '+str(resp)+','+str(content))
|
||||||
|
|
||||||
access_token = dict(parse_qsl(content))
|
access_token = dict(parse_qsl(content))
|
||||||
logger.info('access_token: '+str(access_token))
|
logger.info('access_token: '+str(access_token))
|
||||||
|
|
||||||
logger.info('resp[status] = '+str(resp['status']))
|
logger.info('resp[status] = '+str(resp['status']))
|
||||||
@@ -702,10 +702,10 @@ class TwitterNotifier(object):
|
|||||||
|
|
||||||
def _send_tweet(self, message=None):
|
def _send_tweet(self, message=None):
|
||||||
|
|
||||||
username=self.consumer_key
|
username = self.consumer_key
|
||||||
password=self.consumer_secret
|
password = self.consumer_secret
|
||||||
access_token_key=headphones.CONFIG.TWITTER_USERNAME
|
access_token_key = headphones.CONFIG.TWITTER_USERNAME
|
||||||
access_token_secret=headphones.CONFIG.TWITTER_PASSWORD
|
access_token_secret = headphones.CONFIG.TWITTER_PASSWORD
|
||||||
|
|
||||||
logger.info(u"Sending tweet: "+message)
|
logger.info(u"Sending tweet: "+message)
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ def verify(albumid, albumpath, Kind=None, forced=False):
|
|||||||
|
|
||||||
# Split cue
|
# Split cue
|
||||||
if downloaded_cuecount and downloaded_cuecount >= len(downloaded_track_list):
|
if downloaded_cuecount and downloaded_cuecount >= len(downloaded_track_list):
|
||||||
if headphones.CONFIG.KEEP_TORRENT_FILES and Kind=="torrent":
|
if headphones.CONFIG.KEEP_TORRENT_FILES and Kind == "torrent":
|
||||||
albumpath = helpers.preserve_torrent_direcory(albumpath)
|
albumpath = helpers.preserve_torrent_direcory(albumpath)
|
||||||
if albumpath and helpers.cue_split(albumpath):
|
if albumpath and helpers.cue_split(albumpath):
|
||||||
downloaded_track_list = helpers.get_downloaded_track_list(albumpath)
|
downloaded_track_list = helpers.get_downloaded_track_list(albumpath)
|
||||||
@@ -283,7 +283,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
|||||||
|
|
||||||
logger.info('Starting post-processing for: %s - %s' % (release['ArtistName'], release['AlbumTitle']))
|
logger.info('Starting post-processing for: %s - %s' % (release['ArtistName'], release['AlbumTitle']))
|
||||||
# Check to see if we're preserving the torrent dir
|
# Check to see if we're preserving the torrent dir
|
||||||
if headphones.CONFIG.KEEP_TORRENT_FILES and Kind=="torrent" and 'headphones-modified' not in albumpath:
|
if headphones.CONFIG.KEEP_TORRENT_FILES and Kind == "torrent" and 'headphones-modified' not in albumpath:
|
||||||
new_folder = os.path.join(albumpath, 'headphones-modified'.encode(headphones.SYS_ENCODING, 'replace'))
|
new_folder = os.path.join(albumpath, 'headphones-modified'.encode(headphones.SYS_ENCODING, 'replace'))
|
||||||
logger.info("Copying files to 'headphones-modified' subfolder to preserve downloaded files for seeding")
|
logger.info("Copying files to 'headphones-modified' subfolder to preserve downloaded files for seeding")
|
||||||
try:
|
try:
|
||||||
@@ -337,7 +337,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
|||||||
|
|
||||||
#start encoding
|
#start encoding
|
||||||
if headphones.CONFIG.MUSIC_ENCODER:
|
if headphones.CONFIG.MUSIC_ENCODER:
|
||||||
downloaded_track_list=music_encoder.encode(albumpath)
|
downloaded_track_list = music_encoder.encode(albumpath)
|
||||||
|
|
||||||
if not downloaded_track_list:
|
if not downloaded_track_list:
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1049,7 +1049,7 @@ def searchTorrent(album, new=False, losslessOnly=False, albumlength=None):
|
|||||||
# Replace bad characters in the term and unicode it
|
# Replace bad characters in the term and unicode it
|
||||||
term = re.sub('[\.\-\/]', ' ', term).encode('utf-8')
|
term = re.sub('[\.\-\/]', ' ', term).encode('utf-8')
|
||||||
artistterm = re.sub('[\.\-\/]', ' ', cleanartist).encode('utf-8', 'replace')
|
artistterm = re.sub('[\.\-\/]', ' ', cleanartist).encode('utf-8', 'replace')
|
||||||
albumterm = re.sub('[\.\-\/]', ' ', cleanalbum).encode('utf-8', 'replace')
|
albumterm = re.sub('[\.\-\/]', ' ', cleanalbum).encode('utf-8', 'replace')
|
||||||
|
|
||||||
# If Preferred Bitrate and High Limit and Allow Lossless then get both lossy and lossless
|
# If Preferred Bitrate and High Limit and Allow Lossless then get both lossy and lossless
|
||||||
if headphones.CONFIG.PREFERRED_QUALITY == 2 and headphones.CONFIG.PREFERRED_BITRATE and headphones.CONFIG.PREFERRED_BITRATE_HIGH_BUFFER and headphones.CONFIG.PREFERRED_BITRATE_ALLOW_LOSSLESS:
|
if headphones.CONFIG.PREFERRED_QUALITY == 2 and headphones.CONFIG.PREFERRED_BITRATE and headphones.CONFIG.PREFERRED_BITRATE_HIGH_BUFFER and headphones.CONFIG.PREFERRED_BITRATE_ALLOW_LOSSLESS:
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ def getTorrentFolder(torrentid):
|
|||||||
|
|
||||||
tries = 1
|
tries = 1
|
||||||
|
|
||||||
while percentdone == 0 and tries <10:
|
while percentdone == 0 and tries < 10:
|
||||||
tries+=1
|
tries += 1
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
response = torrentAction(method, arguments)
|
response = torrentAction(method, arguments)
|
||||||
percentdone = response['arguments']['torrents'][0]['percentDone']
|
percentdone = response['arguments']['torrents'][0]['percentDone']
|
||||||
@@ -95,7 +95,7 @@ def setSeedRatio(torrentid, ratio):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def removeTorrent(torrentid, remove_data = False):
|
def removeTorrent(torrentid, remove_data=False):
|
||||||
|
|
||||||
method = 'torrent-get'
|
method = 'torrent-get'
|
||||||
arguments = { 'ids': torrentid, 'fields': ['isFinished', 'name']}
|
arguments = { 'ids': torrentid, 'fields': ['isFinished', 'name']}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class utorrentclient(object):
|
|||||||
TOKEN_REGEX = "<div id='token' style='display:none;'>([^<>]+)</div>"
|
TOKEN_REGEX = "<div id='token' style='display:none;'>([^<>]+)</div>"
|
||||||
UTSetting = namedtuple("UTSetting", ["name", "int", "str", "access"])
|
UTSetting = namedtuple("UTSetting", ["name", "int", "str", "access"])
|
||||||
|
|
||||||
def __init__(self, base_url = None, username = None, password = None,):
|
def __init__(self, base_url=None, username=None, password=None,):
|
||||||
|
|
||||||
host = headphones.CONFIG.UTORRENT_HOST
|
host = headphones.CONFIG.UTORRENT_HOST
|
||||||
if not host.startswith('http'):
|
if not host.startswith('http'):
|
||||||
@@ -133,7 +133,7 @@ class utorrentclient(object):
|
|||||||
return settings[key]
|
return settings[key]
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
def remove(self, hash, remove_data = False):
|
def remove(self, hash, remove_data=False):
|
||||||
if remove_data:
|
if remove_data:
|
||||||
params = [('action', 'removedata'), ('hash', hash)]
|
params = [('action', 'removedata'), ('hash', hash)]
|
||||||
else:
|
else:
|
||||||
@@ -165,7 +165,7 @@ def labelTorrent(hash):
|
|||||||
uTorrentClient.setprops(hash, 'label', label)
|
uTorrentClient.setprops(hash, 'label', label)
|
||||||
|
|
||||||
|
|
||||||
def removeTorrent(hash, remove_data = False):
|
def removeTorrent(hash, remove_data=False):
|
||||||
uTorrentClient = utorrentclient()
|
uTorrentClient = utorrentclient()
|
||||||
status, torrentList = uTorrentClient.list()
|
status, torrentList = uTorrentClient.list()
|
||||||
torrents = torrentList['torrents']
|
torrents = torrentList['torrents']
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ def update():
|
|||||||
update_dir = os.path.join(headphones.PROG_DIR, 'update')
|
update_dir = os.path.join(headphones.PROG_DIR, 'update')
|
||||||
version_path = os.path.join(headphones.PROG_DIR, 'version.txt')
|
version_path = os.path.join(headphones.PROG_DIR, 'version.txt')
|
||||||
|
|
||||||
logger.info('Downloading update from: '+ tar_download_url)
|
logger.info('Downloading update from: ' + tar_download_url)
|
||||||
data = request.request_content(tar_download_url)
|
data = request.request_content(tar_download_url)
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
|
|||||||
+19
-19
@@ -56,7 +56,7 @@ class WebInterface(object):
|
|||||||
|
|
||||||
def index(self):
|
def index(self):
|
||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
index.exposed=True
|
index.exposed = True
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -99,7 +99,7 @@ class WebInterface(object):
|
|||||||
extras_dict[extra] = "checked"
|
extras_dict[extra] = "checked"
|
||||||
else:
|
else:
|
||||||
extras_dict[extra] = ""
|
extras_dict[extra] = ""
|
||||||
i+=1
|
i += 1
|
||||||
|
|
||||||
return serve_template(templatename="artist.html", title=artist['ArtistName'], artist=artist, albums=albums, extras=extras_dict)
|
return serve_template(templatename="artist.html", title=artist['ArtistName'], artist=artist, albums=albums, extras=extras_dict)
|
||||||
artistPage.exposed = True
|
artistPage.exposed = True
|
||||||
@@ -123,7 +123,7 @@ class WebInterface(object):
|
|||||||
raise cherrypy.HTTPRedirect("home")
|
raise cherrypy.HTTPRedirect("home")
|
||||||
|
|
||||||
if not album['ArtistName']:
|
if not album['ArtistName']:
|
||||||
title = ' - '
|
title = ' - '
|
||||||
else:
|
else:
|
||||||
title = album['ArtistName'] + ' - '
|
title = album['ArtistName'] + ' - '
|
||||||
if not album['AlbumTitle']:
|
if not album['AlbumTitle']:
|
||||||
@@ -215,7 +215,7 @@ class WebInterface(object):
|
|||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
namecheck = myDB.select('SELECT ArtistName from artists where ArtistID=?', [ArtistID])
|
namecheck = myDB.select('SELECT ArtistName from artists where ArtistID=?', [ArtistID])
|
||||||
for name in namecheck:
|
for name in namecheck:
|
||||||
artistname=name['ArtistName']
|
artistname = name['ArtistName']
|
||||||
myDB.action('DELETE from artists WHERE ArtistID=?', [ArtistID])
|
myDB.action('DELETE from artists WHERE ArtistID=?', [ArtistID])
|
||||||
|
|
||||||
from headphones import cache
|
from headphones import cache
|
||||||
@@ -255,7 +255,7 @@ class WebInterface(object):
|
|||||||
def refreshArtist(self, ArtistID):
|
def refreshArtist(self, ArtistID):
|
||||||
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID, False, True]).start()
|
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID, False, True]).start()
|
||||||
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
||||||
refreshArtist.exposed=True
|
refreshArtist.exposed = True
|
||||||
|
|
||||||
def markAlbums(self, ArtistID=None, action=None, **args):
|
def markAlbums(self, ArtistID=None, action=None, **args):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -511,7 +511,7 @@ class WebInterface(object):
|
|||||||
if match_tracks:
|
if match_tracks:
|
||||||
myDB.upsert("tracks", newValueDict, controlValueDict)
|
myDB.upsert("tracks", newValueDict, controlValueDict)
|
||||||
myDB.action('UPDATE have SET Matched="Manual" WHERE CleanName=?', [new_clean_filename])
|
myDB.action('UPDATE have SET Matched="Manual" WHERE CleanName=?', [new_clean_filename])
|
||||||
update_count+=1
|
update_count += 1
|
||||||
#This was throwing errors and I don't know why, but it seems to be working fine.
|
#This was throwing errors and I don't know why, but it seems to be working fine.
|
||||||
#else:
|
#else:
|
||||||
#logger.info("There was an error modifying Artist %s. This should not have happened" % existing_artist)
|
#logger.info("There was an error modifying Artist %s. This should not have happened" % existing_artist)
|
||||||
@@ -550,7 +550,7 @@ class WebInterface(object):
|
|||||||
myDB.upsert("tracks", newValueDict, controlValueDict)
|
myDB.upsert("tracks", newValueDict, controlValueDict)
|
||||||
myDB.action('UPDATE have SET Matched="Manual" WHERE CleanName=?', [new_clean_filename])
|
myDB.action('UPDATE have SET Matched="Manual" WHERE CleanName=?', [new_clean_filename])
|
||||||
album_id = match_tracks['AlbumID']
|
album_id = match_tracks['AlbumID']
|
||||||
update_count+=1
|
update_count += 1
|
||||||
#This was throwing errors and I don't know why, but it seems to be working fine.
|
#This was throwing errors and I don't know why, but it seems to be working fine.
|
||||||
#else:
|
#else:
|
||||||
#logger.info("There was an error modifying Artist %s / Album %s with clean name %s" % (existing_artist, existing_album, existing_clean_string))
|
#logger.info("There was an error modifying Artist %s / Album %s with clean name %s" % (existing_artist, existing_album, existing_clean_string))
|
||||||
@@ -607,7 +607,7 @@ class WebInterface(object):
|
|||||||
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
||||||
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
||||||
myDB.action('UPDATE have SET CleanName=?, Matched="Failed" WHERE ArtistName=? AND AlbumTitle=? AND TrackTitle=?', (original_clean, artist, album, track_title))
|
myDB.action('UPDATE have SET CleanName=?, Matched="Failed" WHERE ArtistName=? AND AlbumTitle=? AND TrackTitle=?', (original_clean, artist, album, track_title))
|
||||||
update_count+=1
|
update_count += 1
|
||||||
if update_count > 0:
|
if update_count > 0:
|
||||||
librarysync.update_album_status()
|
librarysync.update_album_status()
|
||||||
logger.info("Artist: %s successfully restored to unmatched list" % artist)
|
logger.info("Artist: %s successfully restored to unmatched list" % artist)
|
||||||
@@ -627,7 +627,7 @@ class WebInterface(object):
|
|||||||
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
myDB.action('UPDATE tracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
||||||
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
myDB.action('UPDATE alltracks SET Location=?, BitRate=?, Format=? WHERE CleanName=?', [None, None, None, tracks['CleanName']])
|
||||||
myDB.action('UPDATE have SET CleanName=?, Matched="Failed" WHERE ArtistName=? AND AlbumTitle=? AND TrackTitle=?', (original_clean, artist, album, track_title))
|
myDB.action('UPDATE have SET CleanName=?, Matched="Failed" WHERE ArtistName=? AND AlbumTitle=? AND TrackTitle=?', (original_clean, artist, album, track_title))
|
||||||
update_count+=1
|
update_count += 1
|
||||||
if update_count > 0:
|
if update_count > 0:
|
||||||
librarysync.update_album_status(album_id)
|
librarysync.update_album_status(album_id)
|
||||||
logger.info("Album: %s successfully restored to unmatched list" % album)
|
logger.info("Album: %s successfully restored to unmatched list" % album)
|
||||||
@@ -795,7 +795,7 @@ class WebInterface(object):
|
|||||||
filtered = myDB.select(query)
|
filtered = myDB.select(query)
|
||||||
totalcount = len(filtered)
|
totalcount = len(filtered)
|
||||||
else:
|
else:
|
||||||
query = 'SELECT * from artists WHERE ArtistSortName LIKE "%' + sSearch + '%" OR LatestAlbum LIKE "%' + sSearch +'%"' + 'ORDER BY %s COLLATE NOCASE %s' % (sortcolumn, sSortDir_0)
|
query = 'SELECT * from artists WHERE ArtistSortName LIKE "%' + sSearch + '%" OR LatestAlbum LIKE "%' + sSearch + '%"' + 'ORDER BY %s COLLATE NOCASE %s' % (sortcolumn, sSortDir_0)
|
||||||
filtered = myDB.select(query)
|
filtered = myDB.select(query)
|
||||||
totalcount = myDB.select('SELECT COUNT(*) from artists')[0][0]
|
totalcount = myDB.select('SELECT COUNT(*) from artists')[0][0]
|
||||||
|
|
||||||
@@ -844,7 +844,7 @@ class WebInterface(object):
|
|||||||
s = json.dumps(dict)
|
s = json.dumps(dict)
|
||||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||||
return s
|
return s
|
||||||
getArtists_json.exposed=True
|
getArtists_json.exposed = True
|
||||||
|
|
||||||
def getAlbumsByArtist_json(self, artist=None):
|
def getAlbumsByArtist_json(self, artist=None):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -853,12 +853,12 @@ class WebInterface(object):
|
|||||||
album_list = myDB.select("SELECT AlbumTitle from albums WHERE ArtistName=?", [artist])
|
album_list = myDB.select("SELECT AlbumTitle from albums WHERE ArtistName=?", [artist])
|
||||||
for album in album_list:
|
for album in album_list:
|
||||||
album_json[counter] = album['AlbumTitle']
|
album_json[counter] = album['AlbumTitle']
|
||||||
counter+=1
|
counter += 1
|
||||||
json_albums = json.dumps(album_json)
|
json_albums = json.dumps(album_json)
|
||||||
|
|
||||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||||
return json_albums
|
return json_albums
|
||||||
getAlbumsByArtist_json.exposed=True
|
getAlbumsByArtist_json.exposed = True
|
||||||
|
|
||||||
def getArtistjson(self, ArtistID, **kwargs):
|
def getArtistjson(self, ArtistID, **kwargs):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -868,7 +868,7 @@ class WebInterface(object):
|
|||||||
'Status': artist['Status']
|
'Status': artist['Status']
|
||||||
})
|
})
|
||||||
return artist_json
|
return artist_json
|
||||||
getArtistjson.exposed=True
|
getArtistjson.exposed = True
|
||||||
|
|
||||||
def getAlbumjson(self, AlbumID, **kwargs):
|
def getAlbumjson(self, AlbumID, **kwargs):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -879,7 +879,7 @@ class WebInterface(object):
|
|||||||
'Status': album['Status']
|
'Status': album['Status']
|
||||||
})
|
})
|
||||||
return album_json
|
return album_json
|
||||||
getAlbumjson.exposed=True
|
getAlbumjson.exposed = True
|
||||||
|
|
||||||
def clearhistory(self, type=None, date_added=None, title=None):
|
def clearhistory(self, type=None, date_added=None, title=None):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
@@ -1156,7 +1156,7 @@ class WebInterface(object):
|
|||||||
extras_dict[extra] = "checked"
|
extras_dict[extra] = "checked"
|
||||||
else:
|
else:
|
||||||
extras_dict[extra] = ""
|
extras_dict[extra] = ""
|
||||||
i+=1
|
i += 1
|
||||||
|
|
||||||
config["extras"] = extras_dict
|
config["extras"] = extras_dict
|
||||||
|
|
||||||
@@ -1193,7 +1193,7 @@ class WebInterface(object):
|
|||||||
for extra in extras_list:
|
for extra in extras_list:
|
||||||
if extra:
|
if extra:
|
||||||
temp_extras_list.append(i)
|
temp_extras_list.append(i)
|
||||||
i+=1
|
i += 1
|
||||||
|
|
||||||
for extra in expected_extras:
|
for extra in expected_extras:
|
||||||
temp = '%s_temp' % extra
|
temp = '%s_temp' % extra
|
||||||
@@ -1373,7 +1373,7 @@ class Artwork(object):
|
|||||||
elif ArtistOrAlbum == "album":
|
elif ArtistOrAlbum == "album":
|
||||||
AlbumID = ID
|
AlbumID = ID
|
||||||
|
|
||||||
relpath = cache.getArtwork(ArtistID, AlbumID)
|
relpath = cache.getArtwork(ArtistID, AlbumID)
|
||||||
|
|
||||||
if not relpath:
|
if not relpath:
|
||||||
relpath = "data/interfaces/default/images/no-cover-art.png"
|
relpath = "data/interfaces/default/images/no-cover-art.png"
|
||||||
@@ -1407,7 +1407,7 @@ class Artwork(object):
|
|||||||
elif ArtistOrAlbum == "album":
|
elif ArtistOrAlbum == "album":
|
||||||
AlbumID = ID
|
AlbumID = ID
|
||||||
|
|
||||||
relpath = cache.getThumb(ArtistID, AlbumID)
|
relpath = cache.getThumb(ArtistID, AlbumID)
|
||||||
|
|
||||||
if not relpath:
|
if not relpath:
|
||||||
relpath = "data/interfaces/default/images/no-cover-artist.png"
|
relpath = "data/interfaces/default/images/no-cover-artist.png"
|
||||||
|
|||||||
Reference in New Issue
Block a user