mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-05 04:29:25 +01:00
Bug fixes: ascii errors? Rss timeouts, albums with special characters not being sent to sab
This commit is contained in:
@@ -21,7 +21,7 @@ def scanMusic(dir=None):
|
||||
if any(files.endswith(x) for x in (".mp3", ".flac", ".aac", ".ogg", ".ape")):
|
||||
logger.debug('File found: %s' % files)
|
||||
try:
|
||||
results.append(os.path.join(r, files))
|
||||
results.append(os.path.join(r.encode('UTF-8'), files.encode('UTF-8')))
|
||||
except UnicodeDecodeError, e:
|
||||
logger.error('Can not decode file %s. Error: %s' % (str(files), str(e)))
|
||||
continue
|
||||
|
||||
@@ -70,7 +70,7 @@ def searchNZB(albumid=None):
|
||||
logger.info('%s is larger than the maxsize for this category, skipping. (Size: %i bytes)' % (title, size))
|
||||
|
||||
except AttributeError, e:
|
||||
logger.info(u"No results found.")
|
||||
logger.info(u"No results found from NZBMatrix for %s" % term)
|
||||
|
||||
if headphones.NEWZNAB:
|
||||
|
||||
@@ -96,7 +96,7 @@ def searchNZB(albumid=None):
|
||||
|
||||
|
||||
if not len(d.entries):
|
||||
logger.info(u"No results found.")
|
||||
logger.info(u"No results found from %s for %s" % (headphones.NEWZNAB_HOST, term))
|
||||
|
||||
else:
|
||||
for item in d.entries:
|
||||
@@ -164,7 +164,7 @@ def searchNZB(albumid=None):
|
||||
|
||||
else:
|
||||
|
||||
logger.info(u"Nothing found.")
|
||||
logger.info('No results found from NZBs.org for %s' % term)
|
||||
|
||||
if len(resultlist):
|
||||
|
||||
@@ -194,7 +194,7 @@ def searchNZB(albumid=None):
|
||||
linkparams["cat"] = headphones.SAB_CATEGORY
|
||||
|
||||
linkparams["name"] = downloadurl
|
||||
linkparams["nzbname"] = ('%s - %s [%s]' % (albums[0], albums[1], year))
|
||||
linkparams["nzbname"] = ('%s - %s [%s]' % (albums[0].encode('UTF-8'), albums[1].encode('UTF-8'), year))
|
||||
|
||||
saburl = 'http://' + headphones.SAB_HOST + '/sabnzbd/api?' + urllib.urlencode(linkparams)
|
||||
logger.info(u"Sending link to SABNZBD: " + saburl)
|
||||
|
||||
@@ -36,8 +36,8 @@ _nav = '''<div class="nav">
|
||||
<a href="history">HISTORY</a>
|
||||
<a href="config">SETTINGS</a>
|
||||
<div style="float:right">
|
||||
<a href="restart" title="Restart"><img src="images/restart.png" height="15px" width="15px"></a>
|
||||
<a href="shutdown" title="Shutdown"><img src="images/shutdown.png" height="15px" width="15px"></a>
|
||||
<a href="restart" title="Restart"><img src="images/restart.png" height="15px" width="15px" border="0"></a>
|
||||
<a href="shutdown" title="Shutdown"><img src="images/shutdown.png" height="15px" width="15px" border="0"></a>
|
||||
</div>
|
||||
</div>'''
|
||||
|
||||
|
||||
@@ -230,6 +230,7 @@ class WebInterface(object):
|
||||
page.append('''MusicBrainz Link: <a class="external" href="http://www.musicbrainz.org/artist/%s">http://www.musicbrainz.org/artist/%s</a></br></br><b>Albums:</b><br />''' % (artistid, artistid))
|
||||
for rg in artist['releasegroups']:
|
||||
page.append('''%s <br />''' % rg['title'])
|
||||
page.append('''<div class="center"><a href="addArtist?artistid=%s">Add this artist!</a></div>''' % artistid)
|
||||
return page
|
||||
|
||||
artistInfo.exposed = True
|
||||
@@ -287,7 +288,8 @@ class WebInterface(object):
|
||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||
|
||||
import searcher
|
||||
searcher.searchNZB(AlbumID)
|
||||
threading.Thread(target=searcher.searchNZB, args=[AlbumID]).start()
|
||||
time.sleep(5)
|
||||
|
||||
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
||||
|
||||
|
||||
@@ -2911,7 +2911,7 @@ def _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, h
|
||||
opener = apply(urllib2.build_opener, tuple(handlers + [_FeedURLHandler()]))
|
||||
opener.addheaders = [] # RMK - must clear so we only send our custom User-Agent
|
||||
try:
|
||||
return opener.open(request)
|
||||
return opener.open(request, timeout=15)
|
||||
finally:
|
||||
opener.close() # JohnD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user