mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 20:29:27 +00:00
208 lines
6.8 KiB
HTML
208 lines
6.8 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':
|
|
<h3><span>W</span>Album information for this artist is currently being loaded</h3>
|
|
%endif
|
|
<ul id="switchViews">
|
|
<li class="active"><span class="web-symbol">¹</span></li>
|
|
</ul>
|
|
</div>
|
|
<form class="ajax" 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>
|
|
<div id="gridView">
|
|
%for album in albums:
|
|
<%
|
|
%>
|
|
<div class="album-container">
|
|
<div class="album-image-container">
|
|
<input class="album-select" type="checkbox" name="${album['AlbumID']}" />
|
|
<img class="album-image" />
|
|
</div>
|
|
<div class="album-actions">
|
|
%if album['Status'] == 'Skipped':
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Mark Wanted"><span>O</span></a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a class="web-symbol" href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Unmark Wanted"><span>N</span></a>
|
|
%else:
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry"><span>*</span></a>
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True" title="Try new"><span>J</span></a>
|
|
%endif
|
|
</div>
|
|
<div class="album-info">
|
|
<b>${artist['ArtistName']}</b> <br />
|
|
<span>${album['AlbumTitle']}</span>
|
|
</div>
|
|
</div>
|
|
%endfor
|
|
</div>
|
|
<div id="listView">
|
|
<table class="display" id="album_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="select"><input id="mainCheckbox" 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="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"></td>
|
|
<td id="albumart">
|
|
<div class="album-art-small">
|
|
<a href="albumPage?AlbumID=${album['AlbumID']}" title="${album['AlbumID']}">
|
|
<div class="status">
|
|
%if album['Status'] == 'Skipped':
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Mark Wanted"><span>O</span></a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a class="web-symbol" href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Unmark Wanted"><span>N</span></a>
|
|
%else:
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry"><span>*</span></a>
|
|
<a class="web-symbol" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True" title="Try new"><span>J</span></a>
|
|
%endif
|
|
</div>
|
|
</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="have">
|
|
<div class="progress-container" title="You have ${havetracks} of a total ${totaltracks}">
|
|
<span title="${percent}">${percent}</span>
|
|
<div style="width:${percent}%">
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td id="bitrate">${bitrate}</td>
|
|
</tr>
|
|
%endfor
|
|
</tbody>
|
|
</table>
|
|
</div><!--end listView-->
|
|
</form>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
|
|
%if artist['Status'] == 'Loading':
|
|
<meta http-equiv="refresh" content="5">
|
|
%endif
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script>
|
|
function getAlbumInfoGrid() {
|
|
$(".album-container").each(function() {
|
|
$(this).fadeIn("slow", function(){
|
|
var element = $(this).find("img.album-image");
|
|
var artistname = $(this).find(".album-info b").text();
|
|
var albumname = $(this).find(".album-info span").text();
|
|
getAlbumInfo(artistname,albumname,element,2);
|
|
});
|
|
});
|
|
}
|
|
$(document).ready(function(){
|
|
//ListView
|
|
getAlbumInfoGrid();
|
|
//GridView
|
|
$("#gridView").show();
|
|
$("#listView").hide();
|
|
enit();
|
|
$("#switchViews li").click(function(){
|
|
$("#gridView").toggle();
|
|
$("#listView").toggle();
|
|
var text = $(this).children("span").text() == '¹' ? '²' : '¹';
|
|
enit();
|
|
});
|
|
|
|
$('#album_table').dataTable({
|
|
"aoColumns": [
|
|
{ "bSortable": false},
|
|
{ "bSortable": false},
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
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>
|