From 1c736bf2283c12f4b73dfc30ffcbf8e187db24ce Mon Sep 17 00:00:00 2001 From: Remy Date: Sun, 7 Aug 2011 02:51:12 -0700 Subject: [PATCH] some more commits, extras.html, config.html (bad layout), otherstuff, changed log levels --- data/interfaces/default/config.html | 72 +++++++++++++-------------- data/interfaces/default/logs.html | 4 +- data/interfaces/default/restart.html | 9 ---- data/interfaces/default/shutdown.html | 4 +- data/interfaces/default/upcoming.html | 44 ++++++++++++++-- data/interfaces/default/update.html | 9 ---- headphones/searcher.py | 10 ++-- headphones/updater.py | 8 +-- headphones/webserve.py | 21 +++++--- 9 files changed, 101 insertions(+), 80 deletions(-) delete mode 100644 data/interfaces/default/restart.html delete mode 100644 data/interfaces/default/update.html diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index f523535e..d68bf011 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -1,46 +1,42 @@ <%inherit file="base.html"/>
- - - - - - - - - - - - - -
-

HTTP Host:
-
- e.g. localhost or 0.0.0.0 -

-
-

HTTP Username:
- -

-
-

HTTP Port:
- -

-
-

HTTP Password:
- -

-
-

Launch Browser on Startup:

-
+

Web Interface

+ + + + + + + + + + + + +
+

HTTP Host:
+
+ e.g. localhost or 0.0.0.0 +

+
+

HTTP Username:
+ +

+
+

HTTP Port:
+ +

+
+

HTTP Password:
+ +

+
+

Launch Browser on Startup:

+
- -

- Download Settings -

-
+

Download Settings

diff --git a/data/interfaces/default/logs.html b/data/interfaces/default/logs.html index d9aad901..8434e3b6 100644 --- a/data/interfaces/default/logs.html +++ b/data/interfaces/default/logs.html @@ -19,7 +19,9 @@ %> %if out_tuple: <% - if out_tuple[1] == 'WARNING' or out_tuple[1] == 'ERROR': + if out_tuple[1] == 'DEBUG': + continue + elif out_tuple[1] == 'WARNING' or out_tuple[1] == 'ERROR': grade = 'X' else: grade = 'Z' diff --git a/data/interfaces/default/restart.html b/data/interfaces/default/restart.html deleted file mode 100644 index b2aafaa7..00000000 --- a/data/interfaces/default/restart.html +++ /dev/null @@ -1,9 +0,0 @@ -<%inherit file="base.html"/> - -<%def name="headIncludes()"> - - - -<%def name="body()"> - Headphones is restarting - \ No newline at end of file diff --git a/data/interfaces/default/shutdown.html b/data/interfaces/default/shutdown.html index f01313e1..8a882e39 100644 --- a/data/interfaces/default/shutdown.html +++ b/data/interfaces/default/shutdown.html @@ -5,5 +5,7 @@ <%def name="body()"> - Headphones is shutting down +
+ Headphones is ${message} +
\ No newline at end of file diff --git a/data/interfaces/default/upcoming.html b/data/interfaces/default/upcoming.html index 3bdd64f8..4eb45d72 100644 --- a/data/interfaces/default/upcoming.html +++ b/data/interfaces/default/upcoming.html @@ -2,9 +2,28 @@ <%def name="body()">

Upcoming Albums

- %for album in wanted: - - %endfor + + + + + + + + + + + + %for album in upcoming: + + + + + + + + %endfor + +
Album NameRelease DateRelease TypeStatus
${album['AlbumTitle']}${album['ReleaseDate']}
@@ -12,3 +31,22 @@
+ +<%def name="headIncludes()"> + + + +<%def name="javascriptIncludes()"> + + + \ No newline at end of file diff --git a/data/interfaces/default/update.html b/data/interfaces/default/update.html deleted file mode 100644 index ac8c7aa6..00000000 --- a/data/interfaces/default/update.html +++ /dev/null @@ -1,9 +0,0 @@ -<%inherit file="base.html"/> - -<%def name="headIncludes()"> - - - -<%def name="body()"> - Headphones is updating - \ No newline at end of file diff --git a/headphones/searcher.py b/headphones/searcher.py index d7bdb4c5..cf143672 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -115,7 +115,7 @@ def searchNZB(albumid=None, new=False): } searchURL = "http://rss.nzbmatrix.com/rss.php?" + urllib.urlencode(params) - logger.info(u"Parsing results from "+searchURL) + logger.debug(u'Parsing results from NZBMatrix' % searchURL) try: data = urllib2.urlopen(searchURL, timeout=20).read() except urllib2.URLError, e: @@ -161,7 +161,7 @@ def searchNZB(albumid=None, new=False): searchURL = headphones.NEWZNAB_HOST + '/api?' + urllib.urlencode(params) - logger.info(u"Parsing results from "+searchURL) + logger.debug(u'Parsing results from %s' % (searchURL, headphones.NEWZNAB_HOST)) try: data = urllib2.urlopen(searchURL, timeout=20).read() @@ -215,7 +215,7 @@ def searchNZB(albumid=None, new=False): } searchURL = 'https://secure.nzbs.org/rss.php?' + urllib.urlencode(params) - logger.info(u"Parsing results from "+searchURL) + logger.debug(u'Parsing results from %s' % (searchURL, provider)) try: data = urllib2.urlopen(searchURL, timeout=20).read() @@ -293,7 +293,7 @@ def searchNZB(albumid=None, new=False): searchURL = providerurl + "search/?%s" % urllib.urlencode(params) data = getNewzbinURL(searchURL) if data: - logger.info(u"Parsing results from "+searchURL) + logger.debug(u'Parsing results from %s' % (searchURL, providerurl)) try: d = minidom.parseString(data) @@ -440,7 +440,7 @@ def searchNZB(albumid=None, new=False): linkparams["nzbname"] = nzb_folder_name saburl = 'http://' + headphones.SAB_HOST + '/sabnzbd/api?' + urllib.urlencode(linkparams) - logger.info(u"Sending link to SABNZBD: " + saburl) + logger.debug(u"Sending link to SABNZBD: " + saburl) try: urllib.urlopen(saburl) diff --git a/headphones/updater.py b/headphones/updater.py index 77fe5485..a7cd3b95 100644 --- a/headphones/updater.py +++ b/headphones/updater.py @@ -15,10 +15,4 @@ def dbUpdate(): artistid = artist[0] importer.addArtisttoDB(artistid) - logger.info('Update complete') - - - - - - + logger.info('Update complete') \ No newline at end of file diff --git a/headphones/webserve.py b/headphones/webserve.py index 73cb42bc..887354fb 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -206,8 +206,8 @@ class WebInterface(object): def upcoming(self): myDB = db.DBConnection() - upcoming = myDB.select("SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumASIN, AlbumID, ArtistName, ArtistID from albums WHERE ReleaseDate > date('now') order by ReleaseDate DESC") - wanted = myDB.select("SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumASIN, AlbumID, ArtistName, ArtistID from albums WHERE Status='Wanted'") + upcoming = myDB.select("SELECT * from albums WHERE ReleaseDate > date('now') order by ReleaseDate DESC") + wanted = myDB.select("SELECT * from albums WHERE Status='Wanted'") return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, wanted=wanted) upcoming.exposed = True @@ -287,9 +287,13 @@ class WebInterface(object): logs.exposed = True def clearhistory(self, type=None): - logger.info(u"Clearing history where status is %s" % type) myDB = db.DBConnection() - myDB.action('DELETE from snatched WHERE Status=?', [type]) + if type == 'all': + logger.info(u"Clearing all history") + myDB.action('DELETE from snatched') + else: + logger.info(u"Clearing history where status is %s" % type) + myDB.action('DELETE from snatched WHERE Status=?', [type]) raise cherrypy.HTTPRedirect("history") clearhistory.exposed = True @@ -396,7 +400,8 @@ class WebInterface(object): def shutdown(self): logger.info(u"Headphones is shutting down...") threading.Timer(2, headphones.shutdown).start() - return serve_template(templatename="shutdown.html", title="Shutting Down") + message = 'Shutting Down' + return serve_template(templatename="shutdown.html", title="Shutting Down", message=message) return page shutdown.exposed = True @@ -404,13 +409,15 @@ class WebInterface(object): def restart(self): logger.info(u"Headphones is restarting...") threading.Timer(2, headphones.shutdown, [True]).start() - return serve_template(templatename="restart.html", title="Restarting") + message = 'Restarting' + return serve_template(templatename="shutdown.html", title="Restarting", message=message) restart.exposed = True def update(self): logger.info('Headphones is updating...') threading.Timer(2, headphones.shutdown, [True, True]).start() - return serve_template(templatename="update.html", title="Updating") + message = 'Updating' + return serve_template(templatename="shutdown.html", title="Updating", message=message) return page update.exposed = True