mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-15 16:19:28 +01:00
Modified base.html to include album search
This commit is contained in:
@@ -51,7 +51,11 @@
|
||||
<div id="searchbar">
|
||||
<form action="findArtist" method="get">
|
||||
<input type="text" value="" onfocus="if(this.value==this.defaultValue) this.value='';" name="name" />
|
||||
<input type="submit" value="Add Artist"/>
|
||||
<select name="type">
|
||||
<option value="artist">Artist</option>
|
||||
<option value="album">Album</option>
|
||||
</select>
|
||||
<input type="submit" value="Add"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="subhead">
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="albumart"></th>
|
||||
<th id="artistname">Artist</th>
|
||||
<th id="albumname">Album Name</th>
|
||||
<th id="reldate">Release Date</th>
|
||||
<th id="type">Release Type</th>
|
||||
@@ -16,10 +17,11 @@
|
||||
%for album in upcoming:
|
||||
<tr class="gradeZ">
|
||||
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
|
||||
<td id="artistname">${album['ArtistName']}</td>
|
||||
<td id="albumname"><a href="albumPage?AlbumID=${album['AlbumID']}">${album['AlbumTitle']}</a></td>
|
||||
<td id="reldate">${album['ReleaseDate']}</td>
|
||||
<td id="type"></td>
|
||||
<td id="status"></td>
|
||||
<td id="type">${album['Type']}</td>
|
||||
<td id="status">${album['Status']}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
@@ -28,6 +30,30 @@
|
||||
</div>
|
||||
<div class="table_wrapper">
|
||||
<h1>Wanted Albums</h1>
|
||||
<table class="display" id="upcoming_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th id="albumart"></th>
|
||||
<th id="artistname">Artist</th>
|
||||
<th id="albumname">Album Name</th>
|
||||
<th id="reldate">Release Date</th>
|
||||
<th id="type">Release Type</th>
|
||||
<th id="status">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
%for album in wanted:
|
||||
<tr class="gradeZ">
|
||||
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
|
||||
<td id="artistname">${album['ArtistName']}</td>
|
||||
<td id="albumname"><a href="albumPage?AlbumID=${album['AlbumID']}">${album['AlbumTitle']}</a></td>
|
||||
<td id="reldate">${album['ReleaseDate']}</td>
|
||||
<td id="type">${album['Type']}</td>
|
||||
<td id="status">${album['Status']}</td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
@@ -55,29 +55,14 @@ class WebInterface(object):
|
||||
albumPage.exposed = True
|
||||
|
||||
|
||||
def findArtist(self, name):
|
||||
def search(self, name, type):
|
||||
|
||||
page = [templates._header]
|
||||
page.append(templates._logobar)
|
||||
page.append(templates._nav)
|
||||
if len(name) == 0 or name == 'Add an artist':
|
||||
if len(name) == 0:
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
if type == 'artist':
|
||||
searchresults = mb.findArtist(name, limit=10)
|
||||
else:
|
||||
artistResults = mb.findArtist(name, limit=10)
|
||||
if not artistResults:
|
||||
logger.info(u"No results found for " + name)
|
||||
page.append('''<div class="table"><p class="center">No results! <a class="blue" href="home">Go back</a></p></div>''')
|
||||
return page
|
||||
elif len(artistResults) > 1:
|
||||
page.append('''<div class="table"><p class="center">Search returned multiple artists. Click the artist you want to add:</p>''')
|
||||
for result in artistResults:
|
||||
page.append('''<p class="mediumtext"><a href="addArtist?artistid=%s">%s</a> (<a class="externalred" href="artistInfo?artistid=%s">more info</a>)</p>''' % (result['id'], result['uniquename'], result['id']))
|
||||
page.append('''</div>''')
|
||||
return page
|
||||
else:
|
||||
for result in artistResults:
|
||||
logger.info(u"Found one artist matching your search term: " + result['name'] +" ("+ result['id']+")")
|
||||
raise cherrypy.HTTPRedirect("addArtist?artistid=%s" % result['id'])
|
||||
searchresults = mb.findRelease(name, limit=10)
|
||||
|
||||
findArtist.exposed = True
|
||||
|
||||
@@ -164,8 +149,7 @@ class WebInterface(object):
|
||||
deleteArtist.exposed = True
|
||||
|
||||
def refreshArtist(self, ArtistID):
|
||||
import importer
|
||||
importer.addArtisttoDB(artistid)
|
||||
importer.addArtisttoDB(ArtistID)
|
||||
refreshArtist.exposed=True
|
||||
|
||||
def markAlbums(self, ArtistID=None, action=None, **args):
|
||||
@@ -175,7 +159,6 @@ class WebInterface(object):
|
||||
newValueDict = {'Status': action}
|
||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||
if action == 'Wanted':
|
||||
import searcher
|
||||
searcher.searchNZB(mbid, new=False)
|
||||
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
||||
markAlbums.exposed = True
|
||||
@@ -187,7 +170,6 @@ class WebInterface(object):
|
||||
controlValueDict = {'AlbumID': AlbumID}
|
||||
newValueDict = {'Status': 'Wanted'}
|
||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||
import searcher
|
||||
searcher.searchNZB(AlbumID, new)
|
||||
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
|
||||
queueAlbum.exposed = True
|
||||
|
||||
Reference in New Issue
Block a user