mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-16 16:45:32 +01:00
New feature: Seach FLAC only. Bug fix: logger rollover error
This commit is contained in:
@@ -19,7 +19,7 @@ def scanMusic(dir=None):
|
||||
for r,d,f in os.walk(dir):
|
||||
for files in f:
|
||||
if any(files.endswith(x) for x in (".mp3", ".flac", ".aac", ".ogg", ".ape")):
|
||||
logger.debug('File found: %s' % files)
|
||||
#logger.debug('File found: %s' % files)
|
||||
try:
|
||||
results.append(os.path.join(r.encode('UTF-8'), files.encode('UTF-8')))
|
||||
except UnicodeDecodeError, e:
|
||||
@@ -36,7 +36,7 @@ def scanMusic(dir=None):
|
||||
for song in results:
|
||||
try:
|
||||
f = MediaFile(song)
|
||||
logger.debug('Reading: %s' % song.decode('UTF-8'))
|
||||
#logger.debug('Reading: %s' % song.decode('UTF-8'))
|
||||
except:
|
||||
logger.warn('Could not read file: %s' % song.decode('UTF-8'))
|
||||
else:
|
||||
|
||||
@@ -29,9 +29,9 @@ def findArtist(name, limit=1):
|
||||
artistResults = q.getArtists(ws.ArtistFilter(query=name, limit=limit))
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz failed: %s' % e)
|
||||
logger.warn('Attempt to query MusicBrainz for %s failed: %s' % (name, e))
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
@@ -79,9 +79,9 @@ def getArtist(artistid):
|
||||
artist = q.getArtistById(artistid, inc)
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz failed: %s' % e)
|
||||
logger.warn('Attempt to retrieve artist information from MusicBrainz failed for artistid: %s. Sleeping 10 seconds' % artistid)
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
if not artist:
|
||||
return False
|
||||
@@ -128,9 +128,9 @@ def getReleaseGroup(rgid):
|
||||
releaseGroup = q.getReleaseGroupById(rgid, inc)
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz failed: %s' % e)
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz for release group "%s" failed. Sleeping 10 seconds' % rgid)
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
if not releaseGroup:
|
||||
return False
|
||||
@@ -150,9 +150,9 @@ def getReleaseGroup(rgid):
|
||||
releaseResult = q.getReleaseById(release.id, inc)
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information for %s from MusicBrainz failed: %s' % (releaseResult.title, e))
|
||||
logger.warn('Attempt to retrieve release information for %s from MusicBrainz failed: %s. Sleeping 10 seconds' % (releaseResult.title, e))
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
if not releaseResult:
|
||||
continue
|
||||
@@ -191,9 +191,9 @@ def getRelease(releaseid):
|
||||
results = q.getReleaseById(releaseid, inc)
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz failed: %s' % e)
|
||||
logger.warn('Attempt to retrieve information from MusicBrainz for release "%s" failed: %s. SLeeping 10 seconds' % (releaseid, e))
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
if not results:
|
||||
return False
|
||||
@@ -240,9 +240,9 @@ def findArtistbyAlbum(name):
|
||||
results = q.getReleaseGroups(f)
|
||||
break
|
||||
except WebServiceError, e:
|
||||
logger.warn('Attempt to retrieve information for %s from MusicBrainz failed: %s' % (releaseResult.title, e))
|
||||
logger.warn('Attempt to query MusicBrainz for %s failed: %s. Sleeping 10 seconds.' % (name, e))
|
||||
attempt += 1
|
||||
time.sleep(1)
|
||||
time.sleep(10)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
@@ -29,18 +29,25 @@ def searchNZB(albumid=None):
|
||||
term1 = re.sub('[\.\-]', ' ', '%s %s %s' % (clname, clalbum, year)).encode('utf-8')
|
||||
term = string.replace(term1, '"', '')
|
||||
|
||||
altterm1 = re.sub('[\.\-]', ' ', '%s %s' % (clname, clalbum)).encode('utf-8')
|
||||
altterm = string.replace(altterm1, '"', '')
|
||||
|
||||
logger.info("Searching for %s since it was marked as wanted" % term)
|
||||
|
||||
resultlist = []
|
||||
|
||||
if headphones.NZBMATRIX:
|
||||
|
||||
if headphones.PREFERRED_QUALITY:
|
||||
if headphones.PREFERRED_QUALITY == 3:
|
||||
categories = "23"
|
||||
maxsize = 10000000000
|
||||
term = altterm
|
||||
elif headphones.PREFERRED_QUALITY:
|
||||
categories = "23,22"
|
||||
maxsize = 2000000000
|
||||
else:
|
||||
categories = "22"
|
||||
maxsize = 250000000
|
||||
maxsize = 300000000
|
||||
|
||||
|
||||
params = { "page": "download",
|
||||
@@ -74,12 +81,16 @@ def searchNZB(albumid=None):
|
||||
|
||||
if headphones.NEWZNAB:
|
||||
|
||||
if headphones.PREFERRED_QUALITY:
|
||||
if headphones.PREFERRED_QUALITY == 3:
|
||||
categories = "3040"
|
||||
maxsize = 10000000000
|
||||
term = altterm
|
||||
elif headphones.PREFERRED_QUALITY:
|
||||
categories = "3040,3010"
|
||||
maxsize = 2000000000
|
||||
else:
|
||||
categories = "3010"
|
||||
maxsize = 250000000
|
||||
maxsize = 300000000
|
||||
|
||||
params = { "t": "search",
|
||||
"apikey": headphones.NEWZNAB_APIKEY,
|
||||
@@ -115,12 +126,16 @@ def searchNZB(albumid=None):
|
||||
|
||||
if headphones.NZBSORG:
|
||||
|
||||
if headphones.PREFERRED_QUALITY:
|
||||
if headphones.PREFERRED_QUALITY == 3:
|
||||
categories = "3010"
|
||||
maxsize = 10000000000
|
||||
term = altterm
|
||||
elif headphones.PREFERRED_QUALITY:
|
||||
categories = "5,3010"
|
||||
maxsize = 2000000000
|
||||
else:
|
||||
categories = "5"
|
||||
maxsize = 250000000
|
||||
maxsize = 300000000
|
||||
|
||||
params = { "action": "search",
|
||||
"dl": 1,
|
||||
|
||||
@@ -263,8 +263,9 @@ configform = form = '''
|
||||
<td>
|
||||
<b>Album Quality:</b>
|
||||
<p>
|
||||
<input type="radio" name="preferred_quality" value="0" %s />Highest Quality<br /><br />
|
||||
<input type="radio" name="preferred_quality" value="0" %s />Highest Quality excluding Lossless<br /><br />
|
||||
<input type="radio" name="preferred_quality" value="1" %s />Highest Quality including Lossless<br /><br />
|
||||
<input type="radio" name="preferred_quality" value="3" %s />Lossless Only<br /><br />
|
||||
<input type="radio" name="preferred_quality" value="2" %s />Preferred Bitrate:
|
||||
<input type="text" name="preferred_bitrate" value="%s" size="5" maxlength="5" />kbps <br>
|
||||
<i class="smalltext2"><input type="checkbox" name="detect_bitrate" value="1" %s />Auto-Detect Preferred Bitrate </i>
|
||||
|
||||
@@ -526,6 +526,7 @@ class WebInterface(object):
|
||||
headphones.NZBSORG_HASH,
|
||||
radio(headphones.PREFERRED_QUALITY, 0),
|
||||
radio(headphones.PREFERRED_QUALITY, 1),
|
||||
radio(headphones.PREFERRED_QUALITY, 3),
|
||||
radio(headphones.PREFERRED_QUALITY, 2),
|
||||
headphones.PREFERRED_BITRATE,
|
||||
checked(headphones.DETECT_BITRATE),
|
||||
|
||||
Reference in New Issue
Block a user