mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 12:19:27 +00:00
165 lines
4.2 KiB
HTML
165 lines
4.2 KiB
HTML
<%inherit file="base.html"/>
|
|
<%!
|
|
from headphones import helpers
|
|
%>
|
|
|
|
<%def name="body()">
|
|
<div id="nav-sub-container">
|
|
<ul id="nav-view">
|
|
<li><span class="wsr Icon"></span> Viewport</li>
|
|
</ul>
|
|
</div>
|
|
<div id="gridView">
|
|
%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 = '?'
|
|
%>
|
|
<div class="image-container">
|
|
<div class="image-box">
|
|
<img />
|
|
<div class="image-actions">
|
|
%if artist['Status'] == 'Loading':
|
|
<span class="wsr Loading loader"></span>
|
|
%else:
|
|
${havetracks}/${totaltracks}
|
|
%endif
|
|
</div>
|
|
</div>
|
|
<div class="image-info">
|
|
<b title="${artist['ArtistID']}"><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></b>
|
|
</div>
|
|
</div>
|
|
%endfor
|
|
</div>
|
|
<div id="listView">
|
|
<table class="display" id="artist_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="albumart"></th>
|
|
<th id="name">Artist Name</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'
|
|
|
|
%>
|
|
|
|
<tr class="grade${grade}">
|
|
<td id="albumart">
|
|
<div class="album-art-small">
|
|
<img />
|
|
<div class="album-actions">
|
|
%if artist['Status'] == 'Loading':
|
|
<div>
|
|
<span class="wsr Loading loader"></span>
|
|
</div>
|
|
%endif
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></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" title="You have ${havetracks} of ${totaltracks} total.">
|
|
<span class="havetracks">${havetracks}/${totaltracks}</span>
|
|
<div style="width:${percent}%"></div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
%endfor
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script type="text/javascript" src="js/libs/jquery.dataTables.min.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){
|
|
//GridView
|
|
$("#gridView").show();
|
|
$("#listView").hide();
|
|
enit();
|
|
getArtistArt();
|
|
|
|
$('#artist_table').dataTable(
|
|
{
|
|
"aaSorting": [
|
|
],
|
|
"bPaginate": false,
|
|
"bFilter": true
|
|
});
|
|
});
|
|
function getArtistArt() {
|
|
$(".image-container").each(function() {
|
|
$(this).fadeIn('fast', function(){
|
|
var image = $(this).find("img");
|
|
var artist = $(this).find(".image-info b").text();
|
|
var id = $(this).find(".image-info b").attr('title');
|
|
if ( !image.hasClass('done') ) {
|
|
image.addClass('done');
|
|
getArtistInfo(artist,image,2,id);
|
|
}
|
|
});
|
|
});
|
|
$("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,2,id);
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
</%def> |