mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 12:19:27 +00:00
117 lines
3.1 KiB
HTML
117 lines
3.1 KiB
HTML
<%inherit file="base.html"/>
|
|
<%!
|
|
from headphones import helpers
|
|
%>
|
|
|
|
<%def name="body()">
|
|
<table class="display" id="artist_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="albumart"></th>
|
|
<th id="name">Artist Name</th>
|
|
<th id="status">Status</th>
|
|
<th id="album">Latest Album</th>
|
|
<th id="have">Have</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
%for artist in artists:
|
|
<%
|
|
totaltracks = artist['TotalTracks']
|
|
havetracks = artist['HaveTracks']
|
|
if not havetracks:
|
|
havetracks = 0
|
|
try:
|
|
percent = (havetracks*100.0)/totaltracks
|
|
if percent > 100:
|
|
percent = 100
|
|
except (ZeroDivisionError, TypeError):
|
|
percent = 0
|
|
totaltracks = '?'
|
|
|
|
if artist['ReleaseDate'] and artist['LatestAlbum']:
|
|
releasedate = artist['ReleaseDate']
|
|
albumdisplay = '<i>%s</i> (%s)' % (artist['LatestAlbum'], artist['ReleaseDate'])
|
|
if releasedate > helpers.today():
|
|
grade = 'A'
|
|
else:
|
|
grade = 'Z'
|
|
elif artist['LatestAlbum']:
|
|
releasedate = ''
|
|
grade = 'Z'
|
|
albumdisplay = '<i>%s</i>' % artist['LatestAlbum']
|
|
else:
|
|
releasedate = ''
|
|
grade = 'Z'
|
|
albumdisplay = '<i>None</i>'
|
|
|
|
if artist['Status'] == 'Paused':
|
|
grade = 'X'
|
|
|
|
if artist['Status'] == 'Loading':
|
|
grade = 'L'
|
|
|
|
%>
|
|
<tr class="grade${grade}">
|
|
<td id="albumart"><div id="artistImg"><img class="albumArt"/></div></td>
|
|
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}" title="${artist['ArtistID']}">${artist['ArtistName']}</a></td>
|
|
<td id="status">${artist['Status']}</td>
|
|
<td id="album"><span title="${releasedate}"></span><a href="albumPage?AlbumID=${artist['AlbumID']}">${albumdisplay}</a></td>
|
|
<td id="have"><span title="${percent}"></span><div class="progress-container"><div style="width:${percent}%"><div class="havetracks">${havetracks}/${totaltracks}</div></div></div></td>
|
|
</tr>
|
|
%endfor
|
|
</tbody>
|
|
</table>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script src="js/libs/jquery.dataTables.min.js"></script>
|
|
<script>
|
|
function getArtistArt() {
|
|
$("table#artist_table tr td#name").each(function(){
|
|
var id = $(this).children('a').attr('title');
|
|
var artist = $(this).children('a').text();
|
|
var image = $(this).parent().find("td#albumart img");
|
|
if ( !image.hasClass('done') ) {
|
|
image.addClass('done');
|
|
getArtistInfo(artist,image,1,id);
|
|
}
|
|
});
|
|
}
|
|
function initThisPage() {
|
|
getArtistArt();
|
|
$('#artist_table').dataTable({
|
|
"bDestroy": true,
|
|
"aoColumnDefs": [
|
|
{ 'bSortable': false, 'aTargets': [ 0 ] }
|
|
],
|
|
"aoColumns": [
|
|
null,
|
|
{ "sType": "title-string"},
|
|
null,
|
|
{ "sType": "title-string"},
|
|
{ "sType": "title-numeric"}
|
|
],
|
|
"oLanguage": {
|
|
"sSearch": ""},
|
|
"bStateSave": true,
|
|
"iDisplayLength": 50,
|
|
"sPaginationType": "full_numbers"
|
|
});
|
|
resetFilters("artist or album");
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
initThisPage();
|
|
});
|
|
$(window).load(function(){
|
|
initFancybox();
|
|
refreshLoadArtist();
|
|
});
|
|
</script>
|
|
|
|
</%def> |