From 02ae22c81a45cece2f379a84a1218a549ed81754 Mon Sep 17 00:00:00 2001 From: Remy Date: Tue, 24 May 2011 09:48:12 -0700 Subject: [PATCH] milliseconds now show up as MM:SS on album page, added download link to album page, sending a link to SAB creates a new snatched table in db --- searcher.py | 2 ++ webServer.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/searcher.py b/searcher.py index 11261181..46b01b56 100644 --- a/searcher.py +++ b/searcher.py @@ -95,6 +95,8 @@ def searchNZB(albumid=None): urllib.urlopen(saburl) c.execute('UPDATE albums SET status = "Snatched" WHERE AlbumID="%s"' % albums[2]) + c.execute('CREATE TABLE IF NOT EXISTS snatched (Title TEXT UNIQUE, Size INTEGER, URL TEXT, DateAdded TEXT)') + c.execute('INSERT INTO snatched VALUES( ?, ?, ?, CURRENT_DATE)', (bestqual[0], bestqual[1], bestqual[2])) conn.commit() else: diff --git a/webServer.py b/webServer.py index 727683f7..d10ae9b2 100644 --- a/webServer.py +++ b/webServer.py @@ -119,17 +119,18 @@ class Headphones: c.close() i = 0 page.append('''
- %s - %s
%s + %s - %s
+ Download
%s

- ''' % (results[0][0], results[0][1], results[0][2], albumart)) + ''' % (results[0][0], results[0][1], results[0][2], AlbumID, results[0][0], albumart)) while i < len(results): page.append(''' - ''' % (i+1, results[i][3], results[i][5], results[i][4])) + ''' % (i+1, results[i][3], results[i][5], time.strftime("%M:%S", time.gmtime(int(results[i][4])/1000)))) i = i+1 page.append('''
Track # Track Title Duration
%s %s (link)%s
%s
''') @@ -182,7 +183,7 @@ class Headphones: c=conn.cursor() c.execute('CREATE TABLE IF NOT EXISTS artists (ArtistID TEXT UNIQUE, ArtistName TEXT, ArtistSortName TEXT, DateAdded TEXT, Status TEXT)') c.execute('CREATE TABLE IF NOT EXISTS albums (ArtistID TEXT, ArtistName TEXT, AlbumTitle TEXT, AlbumASIN TEXT, ReleaseDate TEXT, DateAdded TEXT, AlbumID TEXT UNIQUE, Status TEXT)') - c.execute('CREATE TABLE IF NOT EXISTS tracks (ArtistID TEXT, ArtistName TEXT, AlbumTitle TEXT, AlbumASIN TEXT, AlbumID TEXT, TrackTitle TEXT, TrackDuration TEXT, TrackID TEXT)') + c.execute('CREATE TABLE IF NOT EXISTS tracks (ArtistID TEXT, ArtistName TEXT, AlbumTitle TEXT, AlbumASIN TEXT, AlbumID TEXT, TrackTitle TEXT, TrackDuration, TrackID TEXT)') c.execute('SELECT ArtistID from artists') artistlist = c.fetchall() if any(artistid in x for x in artistlist):