mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 20:59:27 +00:00
263 lines
8.6 KiB
HTML
263 lines
8.6 KiB
HTML
<%inherit file="base.html"/>
|
|
<%!
|
|
from headphones import db
|
|
import headphones
|
|
import string
|
|
%>
|
|
|
|
<%def name="body()">
|
|
<script>
|
|
$(document).ready(function(){
|
|
$('#menu_link_getextra').click(function() {
|
|
$('#dialog').dialog();
|
|
return false;
|
|
});
|
|
$('#menu_link_modifyextra').click(function() {
|
|
$('#dialog').dialog();
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<div id="dialog" title="Choose Which Extras to Fetch" style="display:none" class="configtable">
|
|
<form action="getExtras" method="get" class="ajax">
|
|
<input type="hidden" name="ArtistID" value="${artist['ArtistID']}">
|
|
<input type="hidden" name="newstyle" value="true">
|
|
%for extra in extras:
|
|
<input type="checkbox" id="${extra}" name="${extra}" value="1" ${extras[extra]} />${string.capwords(extra)}<br>
|
|
%endfor
|
|
<br>
|
|
<input id="submit" type="submit" value="Fetch Extras">
|
|
</form>
|
|
</div>
|
|
|
|
<div id="nav-sub-container">
|
|
<ul id="nav-sub">
|
|
<li><a class="refreshArtist" href="refreshArtist?ArtistID=${artist['ArtistID']}"><span class="wsr Synchronize"></span> Refresh</a></li>
|
|
<li><a href="deleteArtist?ArtistID=${artist['ArtistID']}"><span class="wsr Close"></span> Delete Artist</a></li>
|
|
%if artist['Status'] == 'Paused':
|
|
<li><a href="resumeArtist?ArtistID=${artist['ArtistID']}" ><span class="wsr Clock"></span> Resume</a></li>
|
|
%else:
|
|
<li><a href="pauseArtist?ArtistID=${artist['ArtistID']}"><span class="wsr Clock"></span> Pause</a></li>
|
|
%endif
|
|
%if artist['IncludeExtras']:
|
|
<li><a href="removeExtras?ArtistID=${artist['ArtistID']}">Remove Extras</a></li>
|
|
<li><a class="menu_link_edit" href="#">Modify Extras</a></li>
|
|
%else:
|
|
<li><a id="menu_link_getextra" href="#">Get Extras</a></li>
|
|
%endif
|
|
</ul>
|
|
<ul id="nav-view">
|
|
<li><span class="wsr Icon"></span> Viewport</li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<form class="ajax" action="markAlbums" method="get">
|
|
<div class="artist-bio-container">
|
|
<div class="artist-art">
|
|
<img src="" alt="${artist['ArtistName']}" />
|
|
</div>
|
|
%if artist['Status'] == 'Loading':
|
|
<h1><span class="wsr Loading loader"></span> Loading albums informations...</h1>
|
|
%else:
|
|
<h1>${artist['ArtistName']}</h1>
|
|
%endif
|
|
<span class="artist-bio"></span>
|
|
</div>
|
|
<div class="clear"></div>
|
|
<p class="indented">Mark 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="image-container">
|
|
<div class="image-box ${album['Status']}">
|
|
<div class="image-tag ${album['Status']}"></div>
|
|
<img />
|
|
<div class="image-actions">
|
|
%if album['Status'] == 'Skipped':
|
|
<a class="wsr" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Like"><span class="wsr Like"></span></a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a class="wsr" href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Unlike"><span class="wsr Unlike"></span></a>
|
|
%else:
|
|
<a class="wsr" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry"><span>*</span></a>
|
|
<a class="wsr" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True" title="Try new"><span>J</span></a>
|
|
%endif
|
|
<a class="wsr List" href="albumPage?AlbumID=${album['AlbumID']}" title="View"></a>
|
|
</div>
|
|
<input class="image-select" type="checkbox" name="${album['AlbumID']}" />
|
|
</div>
|
|
|
|
<div class="image-info">
|
|
<b style="display: none;">${artist['ArtistName']}</b>
|
|
<span><a href="albumPage?AlbumID=${album['AlbumID']}" title="${album['AlbumID']}">${album['AlbumTitle']}</a></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"><input class="styled" type="checkbox" name="${album['AlbumID']}" class="checkbox" /></th>
|
|
<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="wsr" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Mark Wanted"><span>O</span></a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a class="wsr" href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Unmark Wanted"><span>N</span></a>
|
|
%else:
|
|
<a class="wsr" href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry"><span>*</span></a>
|
|
<a class="wsr" 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>
|
|
$(document).ready(function(){
|
|
//Load Art
|
|
getAlbumArt();
|
|
getArtistArt();
|
|
//GridView
|
|
$("#gridView").show();
|
|
$("#listView").hide();
|
|
enit();
|
|
|
|
$('#album_table').dataTable({
|
|
"aoColumns": [
|
|
{ "bSortable": false},
|
|
{ "bSortable": false},
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
null
|
|
],
|
|
"oLanguage": {
|
|
"sLengthMenu":"Show _MENU_ albums per page",
|
|
"sEmptyTable": "No artist information available",
|
|
"sInfo":"Showing _TOTAL_ albums",
|
|
"sInfoEmpty":"No album found",
|
|
"sInfoFiltered":"(Filtered from _MAX_ total albums)"},
|
|
"bPaginate": false,
|
|
"aaSorting": [[4, 'asc'],[3,'desc']]
|
|
});
|
|
$( "#nav-sub li a" ).click(function(){
|
|
});
|
|
%if artist['Status'] == 'Loading':
|
|
var noty_id = noty({
|
|
text:'<span class="wsr Loading loader"></span> Artist is refreshing!',
|
|
layout: 'bottomRight',
|
|
type:'information'
|
|
});
|
|
%elif artist['Status'] == 'Paused':
|
|
var noty_id = noty({
|
|
text:'<span class="wsr Alert"></span> Artist is paused!',
|
|
layout: 'bottomRight',
|
|
type:'information'
|
|
});
|
|
%endif
|
|
});
|
|
function getArtistArt() {
|
|
$(".artist-bio-container").each(function(){
|
|
var artistid = "${artist['ArtistId']}";
|
|
var artistname = $(this).find("img").attr("title");
|
|
var image = $(this).find("img");
|
|
if ( !image.hasClass('done') ) {
|
|
image.addClass('done');
|
|
getArtistInfo(artistname,image,3,artistid);
|
|
}
|
|
});
|
|
}
|
|
function getAlbumArt() {
|
|
$(".image-container").each(function() {
|
|
$(this).fadeIn("slow", function(){
|
|
var element = $(this).find("img");
|
|
var artistname = $(this).find(".image-info b").text();
|
|
var albumname = $(this).find(".image-info span").text();
|
|
getAlbumInfo(artistname,albumname,element,2);
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
</%def>
|