mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-20 16:03:59 +01:00
Clean merge/commit.
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
<%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
|
||||
</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>
|
||||
%for album in albums:
|
||||
<%
|
||||
%>
|
||||
<div class="album-container">
|
||||
<input type="checkbox" name="${album['AlbumID']}" />
|
||||
<img class="image" />
|
||||
<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>
|
||||
<b>${artist['ArtistName']}</b> <br />
|
||||
${album['AlbumTitle']}
|
||||
</div>
|
||||
</div>
|
||||
%endfor
|
||||
<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>
|
||||
</form>
|
||||
</%def>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
|
||||
%if artist['Status'] == 'Loading':
|
||||
<meta http-equiv="refresh" content="5">
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="javascriptIncludes()">
|
||||
<script>
|
||||
|
||||
function getArtistArt() {
|
||||
$(".album-container").each(function() {
|
||||
var id = $(this).children("input").attr("name");
|
||||
var artist = $("#paddingheader h1").text();
|
||||
var image = $(this).children("img");
|
||||
if ( !image.hasClass("done") ) {
|
||||
getArtistInfo(artist,image,2,id);
|
||||
image.addClass("done");
|
||||
$(this).fadeIn();
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function(){
|
||||
getArtistArt();
|
||||
$('#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>
|
||||
Reference in New Issue
Block a user