mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 20:59:27 +00:00
Bug Fixes: NZBs.org fixed, listindex error on import, illegal end of headers. New Feature: Shows the # of tracks in the Have bar.
This commit is contained in:
@@ -90,6 +90,11 @@ h1{
|
||||
font-size: 11px;
|
||||
margin-left: 45px;
|
||||
}
|
||||
.smalltext3{
|
||||
font-size: 11px;
|
||||
margin-left: 30px;
|
||||
color: #867970;
|
||||
}
|
||||
.mediumtext{
|
||||
font-size: 16px;
|
||||
margin-left: 100px;
|
||||
@@ -139,6 +144,7 @@ a.externalred {
|
||||
div.progress-container {
|
||||
border: 1px solid #ccc;
|
||||
width: 100px;
|
||||
height: 12px;
|
||||
margin: 2px 5px 2px 0;
|
||||
padding: 1px;
|
||||
float: left;
|
||||
|
||||
@@ -102,7 +102,14 @@ def artistlist_to_mbids(artistlist):
|
||||
for artist in artistlist:
|
||||
|
||||
results = mb.findArtist(artist, limit=1)
|
||||
artistid = results[0]['id']
|
||||
|
||||
try:
|
||||
artistid = results[0]['id']
|
||||
|
||||
except IndexError:
|
||||
logger.info('MusicBrainz query turned up no matches for: %s' % artist)
|
||||
continue
|
||||
|
||||
if artistid != various_artists_mbid and not is_exists(artistid):
|
||||
addArtisttoDB(artistid)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import urllib
|
||||
import string
|
||||
import lib.feedparser as feedparser
|
||||
from xml.dom import minidom
|
||||
import os, re
|
||||
|
||||
import headphones
|
||||
@@ -125,21 +126,34 @@ def searchNZB(albumid=None):
|
||||
searchURL = 'https://secure.nzbs.org/rss.php?' + urllib.urlencode(params)
|
||||
|
||||
logger.info(u"Parsing results from "+searchURL)
|
||||
d = feedparser.parse(searchURL)
|
||||
d = minidom.parse(searchURL)
|
||||
node = d.documentElement
|
||||
items = d.getElementsByTagName("item")
|
||||
|
||||
for item in d.entries:
|
||||
try:
|
||||
url = item.link
|
||||
title = item.title
|
||||
size = int(item.report_size)
|
||||
if len(items):
|
||||
|
||||
for item in items:
|
||||
|
||||
sizenode = item.getElementsByTagName("report:size")[0].childNodes
|
||||
titlenode = item.getElementsByTagName("title")[0].childNodes
|
||||
linknode = item.getElementsByTagName("link")[0].childNodes
|
||||
|
||||
for node in sizenode:
|
||||
size = int(node.data)
|
||||
for node in titlenode:
|
||||
title = node.data
|
||||
for node in linknode:
|
||||
url = node.data
|
||||
|
||||
if size < maxsize:
|
||||
resultlist.append((title, size, url))
|
||||
logger.info('Found %s. Size: %s' % (title, helpers.bytes_to_mb(size)))
|
||||
else:
|
||||
logger.info('%s is larger than the maxsize for this category, skipping. (Size: %i bytes)' % (title, size))
|
||||
|
||||
except Exception, e:
|
||||
logger.info(u"No results found. %s" % e)
|
||||
else:
|
||||
|
||||
logger.info(u"Nothing found.")
|
||||
|
||||
if len(resultlist):
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ _shutdownheader = '''
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||
<link rel="icon" type="image/x-icon" href="images/favicon.ico" />
|
||||
<link rel="apple-touch-icon" href="images/headphoneslogo.png" />
|
||||
<meta http-equiv="refresh" content="%s;url=home"></head>
|
||||
<meta http-equiv="refresh" content="%s;url=index"></head>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">'''
|
||||
|
||||
@@ -74,8 +74,8 @@ class WebInterface(object):
|
||||
(<A class="external" href="http://musicbrainz.org/artist/%s">link</a>) [<A class="externalred" href="deleteArtist?ArtistID=%s">delete</a>]</td>
|
||||
<td align="center" width="160">%s</td>
|
||||
<td align="center">%s %s</td>
|
||||
<td><div class="progress-container"><div style="width: %s%%"></div></div></td></tr>
|
||||
''' % (results[i][1], results[i][0], results[i][1], results[i][1], newStatus, newalbumName, releaseDate, percent))
|
||||
<td><div class="progress-container"><div style="width: %s%%"><div class="smalltext3">%s/%s</div></div></div></td></tr>
|
||||
''' % (results[i][1], results[i][0], results[i][1], results[i][1], newStatus, newalbumName, releaseDate, percent, havetracks, totaltracks))
|
||||
i = i+1
|
||||
|
||||
page.append('''</table></div>''')
|
||||
@@ -130,7 +130,7 @@ class WebInterface(object):
|
||||
(<A class="external" href="http://musicbrainz.org/release-group/%s.html">link</a>)</td>
|
||||
<td align="center" width="160">%s</td>
|
||||
<td align="center">%s</td>
|
||||
<td><div class="progress-container"><div style="width: %s%%"></div></div></td></tr>''' % (results[i][5], results[i][2], results[i][0], results[i][2], results[i][1], newStatus, percent))
|
||||
<td><div class="progress-container"><div style="width: %s%%"><div class="smalltext3">%s/%s</div></div></div></td></tr>''' % (results[i][5], results[i][2], results[i][0], results[i][2], results[i][1], newStatus, percent, havetracks, totaltracks))
|
||||
i = i+1
|
||||
|
||||
page.append('''</table></div>''')
|
||||
@@ -574,7 +574,7 @@ class WebInterface(object):
|
||||
def shutdown(self):
|
||||
logger.info(u"Headphones is shutting down...")
|
||||
threading.Timer(2, headphones.shutdown).start()
|
||||
page = [templates._shutdownheader % 10]
|
||||
page = [templates._shutdownheader % 15]
|
||||
page.append(templates._logobar)
|
||||
page.append(templates._nav)
|
||||
page.append('<div class="table"><div class="configtable">Shutting down Headphones...</div></div>')
|
||||
@@ -586,7 +586,7 @@ class WebInterface(object):
|
||||
def restart(self):
|
||||
logger.info(u"Headphones is restarting...")
|
||||
threading.Timer(2, headphones.shutdown, [True]).start()
|
||||
page = [templates._shutdownheader % 20]
|
||||
page = [templates._shutdownheader % 30]
|
||||
page.append(templates._logobar)
|
||||
page.append(templates._nav)
|
||||
page.append('<div class="table"><div class="configtable">Restarting Headphones...</div></div>')
|
||||
@@ -598,7 +598,7 @@ class WebInterface(object):
|
||||
def update(self):
|
||||
logger.info('Headphones is updating...')
|
||||
threading.Timer(2, headphones.shutdown, [True, True]).start()
|
||||
page = [templates._shutdownheader % 60]
|
||||
page = [templates._shutdownheader % 120]
|
||||
page.append(templates._logobar)
|
||||
page.append(templates._nav)
|
||||
page.append('<div class="table"><div class="configtable">Updating Headphones...</div></div>')
|
||||
|
||||
Reference in New Issue
Block a user