mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 12:49:26 +00:00
161 lines
5.5 KiB
HTML
161 lines
5.5 KiB
HTML
<%inherit file="base.html"/>
|
|
<%!
|
|
from headphones import db
|
|
%>
|
|
|
|
<%def name="headerIncludes()">
|
|
<div id="subhead_container">
|
|
<ul id="subhead_menu">
|
|
<li><a href="refreshArtist?ArtistID=${artist['ArtistID']}">Refresh Artist</a></li>
|
|
<li><a href="deleteArtist?ArtistID=${artist['ArtistID']}">Delete Artist</a></li>
|
|
%if artist['Status'] == 'Paused':
|
|
<li><a href="resumeArtist?ArtistID=${artist['ArtistID']}">Resume Artist</a></li>
|
|
%else:
|
|
<li><a href="pauseArtist?ArtistID=${artist['ArtistID']}">Pause Artist</a></li>
|
|
%endif
|
|
%if artist['IncludeExtras']:
|
|
<li><a href="removeExtras?ArtistID=${artist['ArtistID']}">Remove Extras</a></li>
|
|
%else:
|
|
<li><a href="getExtras?ArtistID=${artist['ArtistID']}">Get Extras</a></li>
|
|
%endif
|
|
</ul>
|
|
</div>
|
|
</%def>
|
|
|
|
<%def name="body()">
|
|
<div id="paddingheader">
|
|
<h1>
|
|
${artist['ArtistName']}
|
|
</h1>
|
|
%if artist['Status'] == 'Loading':
|
|
<span class="pageDialog">Album information for this artist is currently being loaded</span>
|
|
%endif
|
|
</div>
|
|
<form action="markAlbums" method="get"><input type="hidden" name="ArtistID" value=${artist['ArtistID']}>
|
|
<p class="indented">Mark selected albums as
|
|
<select class="styled" name="action">
|
|
<option value="Wanted">Wanted</option>
|
|
<option value="WantedNew">Wanted (new only)</option>
|
|
<option value="Skipped">Skipped</option>
|
|
<option value="Downloaded">Downloaded</option>
|
|
</select>
|
|
<input type="submit" value="GO">
|
|
</p>
|
|
<table class="display" id="album_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="select"><input id="mainCheckbox" class="styled" name="head" type="checkbox" onClick="toggle(this);headToggle();" /></th>
|
|
<th id="albumart"></th>
|
|
<th id="albumname">Name</th>
|
|
<th id="reldate">Date</th>
|
|
<th id="type">Type</th>
|
|
<th id="status">Status</th>
|
|
<th id="have">Have</th>
|
|
<th id="bitrate">Bitrate</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
%for album in albums:
|
|
<%
|
|
if album['Status'] == 'Skipped':
|
|
grade = 'Z'
|
|
elif album['Status'] == 'Wanted':
|
|
grade = 'X'
|
|
elif album['Status'] == 'Snatched':
|
|
grade = 'C'
|
|
else:
|
|
grade = 'A'
|
|
|
|
myDB = db.DBConnection()
|
|
totaltracks = len(myDB.select('SELECT TrackTitle from tracks WHERE AlbumID=?', [album['AlbumID']]))
|
|
havetracks = len(myDB.select('SELECT TrackTitle from tracks WHERE AlbumID=? AND Location IS NOT NULL', [album['AlbumID']])) + len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle LIKE ?', [album['ArtistName'], album['AlbumTitle']]))
|
|
|
|
try:
|
|
percent = (havetracks*100.0)/totaltracks
|
|
if percent > 100:
|
|
percent = 100
|
|
except (ZeroDivisionError, TypeError):
|
|
percent = 0
|
|
totaltracks = '?'
|
|
|
|
avgbitrate = myDB.action("SELECT AVG(BitRate) FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0]
|
|
if avgbitrate:
|
|
bitrate = str(int(avgbitrate)/1000) + ' kbps'
|
|
else:
|
|
bitrate = ''
|
|
|
|
%>
|
|
<tr class="grade${grade}">
|
|
<td id="select"><input class="styled" type="checkbox" name="${album['AlbumID']}" class="checkbox" /></td>
|
|
<td id="albumart">
|
|
<div class="album-art-small">
|
|
<a href="albumPage?AlbumID=${album['AlbumID']}">
|
|
<img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" title="${artist['ArtistName']} - ${album['AlbumTitle']}">
|
|
</a>
|
|
</div>
|
|
</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"><span class="btn${album['Status']} btnStatus" title="${album['Status']}">${album['Status']}</span>
|
|
%if album['Status'] == 'Skipped':
|
|
<a class="btnGet btnStatus" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Get this album">Get</a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a class="btnAbort btnStatus" href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Abort current status, and set to skipped">Abort</a>
|
|
%else:
|
|
<a class="btnRetry btnStatus" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry the same nbz">Retry</a>
|
|
<a class="btnNew btnStatus" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True" title="Try a new download, skipping all previously tried nzbs">New</a>
|
|
%endif
|
|
</td>
|
|
<td id="have"><span title="${percent}"><span>
|
|
<div class="progress-container" title="You have ${havetracks} of a total ${totaltracks}">
|
|
<div style="width:${percent}%">
|
|
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td id="bitrate">${bitrate}</td>
|
|
</tr>
|
|
%endfor
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
|
|
%if artist['Status'] == 'Loading':
|
|
<meta http-equiv="refresh" content="5">
|
|
%endif
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script src="interfaces/brink/JS/libs/jquery.dataTables.min.js"></script>
|
|
<script>
|
|
$(document).ready(function()
|
|
{
|
|
$('#album_table').dataTable(
|
|
{
|
|
"aoColumns": [
|
|
{ "bSortable": false},
|
|
{ "bSortable": false},
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
{ "sType": "title-numeric"},
|
|
null
|
|
],
|
|
"oLanguage": {
|
|
"sLengthMenu":"Show _MENU_ artist per page",
|
|
"sEmptyTable": "No artist information available",
|
|
"sInfo":"Showing _TOTAL_ artist",
|
|
"sInfoEmpty":"No artist found",
|
|
"sInfoFiltered":"(Filtered from _MAX_ total artist)"},
|
|
"bPaginate": false,
|
|
"aaSorting": [[4, 'asc'],[3,'desc']]
|
|
});
|
|
});
|
|
</script>
|
|
</%def>
|