mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-13 07:09:27 +01:00
Changed the artists page to use the /artwork/artist|album/id path for retrieving artwork instead of doing an ajax call
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<%def name="body()">
|
||||
<div id="artistheader" class="clearfix">
|
||||
<div id="artistImg">
|
||||
<img id="artistImage" class="albumArt" alt="" />
|
||||
<img id="artistImage" class="albumArt" alt="" src="artwork/artist/${artist['ArtistID']}"/>
|
||||
</div>
|
||||
<h1>
|
||||
%if artist['Status'] == 'Loading':
|
||||
@@ -122,7 +122,7 @@
|
||||
%>
|
||||
<tr class="grade${grade}">
|
||||
<td id="select"><input type="checkbox" name="${album['AlbumID']}" class="checkbox" /></td>
|
||||
<td id="albumart"><img class="albumArt" id="${album['AlbumID']}" height="64" width="64"></td>
|
||||
<td id="albumart"><img class="albumArt" id="${album['AlbumID']}" src="/artwork/thumbs/album/${album['AlbumID']}" height="64" width="64"></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>
|
||||
@@ -202,8 +202,6 @@
|
||||
%if artist['Status'] == 'Loading':
|
||||
showMsg("Getting artist information",true);
|
||||
%endif
|
||||
getArtistArt();
|
||||
getAlbumArt();
|
||||
$('#album_table').dataTable({
|
||||
"bDestroy": true,
|
||||
"aoColumns": [
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"aTargets": [ 0 ],
|
||||
"mData":"ArtistID",
|
||||
"mRender": function ( data, type, full ) {
|
||||
return '<div id="artistImg"><img class="albumArt" alt="" id="'+ data + '" src="/thumbs/artist/' + data + '"/></div>';
|
||||
return '<div id="artistImg"><img class="albumArt" alt="" id="'+ data + '" src="/artwork/thumbs/artist/' + data + '"/></div>';
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -894,10 +894,11 @@ class WebInterface(object):
|
||||
|
||||
getImageLinks.exposed = True
|
||||
|
||||
class Thumbs(object):
|
||||
class Artwork(object):
|
||||
def index(self):
|
||||
return "Here be thumbs"
|
||||
return "Artwork"
|
||||
index.exposed = True
|
||||
|
||||
def default(self,ArtistOrAlbum="",ID=None):
|
||||
from headphones import cache
|
||||
ArtistID = None
|
||||
@@ -905,15 +906,12 @@ class Thumbs(object):
|
||||
if ArtistOrAlbum == "artist":
|
||||
ArtistID = ID
|
||||
elif ArtistOrAlbum == "album":
|
||||
AlbumID = None
|
||||
AlbumID = ID
|
||||
|
||||
relpath = cache.getThumb(ArtistID,AlbumID)
|
||||
relpath = cache.getArtwork(ArtistID,AlbumID)
|
||||
|
||||
if not relpath:
|
||||
if ArtistOrAlbum == "artist":
|
||||
relpath = "data/interfaces/default/images/no-cover-artist.png"
|
||||
elif ArtistOrAlbum == "album":
|
||||
relpath = "data/interfaces/default/images/no-cover-art.png"
|
||||
relpath = "data/interfaces/default/images/no-cover-art.png"
|
||||
cherrypy.response.headers['Content-type'] = 'image/png'
|
||||
cherrypy.response.headers['Cache-Control'] = 'no-cache'
|
||||
else:
|
||||
@@ -925,5 +923,37 @@ class Thumbs(object):
|
||||
f = open(path,'rb')
|
||||
return f.read()
|
||||
default.exposed = True
|
||||
|
||||
class Thumbs(object):
|
||||
def index(self):
|
||||
return "Here be thumbs"
|
||||
index.exposed = True
|
||||
def default(self,ArtistOrAlbum="",ID=None):
|
||||
from headphones import cache
|
||||
ArtistID = None
|
||||
AlbumID = None
|
||||
if ArtistOrAlbum == "artist":
|
||||
ArtistID = ID
|
||||
elif ArtistOrAlbum == "album":
|
||||
AlbumID = ID
|
||||
|
||||
WebInterface.thumbs = Thumbs()
|
||||
relpath = cache.getThumb(ArtistID,AlbumID)
|
||||
|
||||
if not relpath:
|
||||
relpath = "data/interfaces/default/images/no-cover-artist.png"
|
||||
cherrypy.response.headers['Content-type'] = 'image/png'
|
||||
cherrypy.response.headers['Cache-Control'] = 'no-cache'
|
||||
else:
|
||||
fileext = os.path.splitext(relpath)[1][1::]
|
||||
cherrypy.response.headers['Content-type'] = 'image/' + fileext
|
||||
cherrypy.response.headers['Cache-Control'] = 'max-age=31556926'
|
||||
|
||||
path = os.path.abspath(relpath)
|
||||
f = open(path,'rb')
|
||||
return f.read()
|
||||
default.exposed = True
|
||||
|
||||
thumbs = Thumbs()
|
||||
|
||||
|
||||
WebInterface.artwork = Artwork()
|
||||
|
||||
Reference in New Issue
Block a user