mirror of
https://github.com/evilhero/mylar
synced 2024-12-23 08:12:41 +00:00
163 lines
5.3 KiB
HTML
Executable file
163 lines
5.3 KiB
HTML
Executable file
<%inherit file="base.html" />
|
|
<%!
|
|
from mylar import db, helpers
|
|
myDB = db.DBConnection()
|
|
%>
|
|
|
|
<%def name="headerIncludes()">
|
|
<div id="subhead_container">
|
|
<div id="subhead_menu">
|
|
<a id="menu_link_delete" href="deleteAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}">Delete Album</a>
|
|
%if album['Status'] == 'Skipped':
|
|
<a id="menu_link_wanted" href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False', $(this),true)" data-success="'${album['AlbumTitle']}' added to queue">Mark Album as Wanted</a>
|
|
%elif album['Status'] == 'Wanted':
|
|
<a id="menu_link_check" href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True', $(this));" data-success="Forced checking successful">Force Check</a>
|
|
<a id="menu_link_skipped" href="#" onclick="doAjaxCall('unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}', $(this),true);" data-success="'${album['AlbumTitle']}' marked as Skipped">Mark Album as Skipped</a>
|
|
%else:
|
|
<a id="menu_link_retry" href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False', $(this),true);" data-success="Retrying the same version of '${album['AlbumTitle']}'">Retry Download</a>
|
|
<a id="menu_link_new" href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True', $(this),true);" data-success="Looking for a new version of '${album['AlbumTitle']}'">Try New Version</a>
|
|
%endif
|
|
</div>
|
|
</div>
|
|
<a href="artistPage?ArtistID=${album['ArtistID']}" class="back">« Back to ${album['ArtistName']}</a>
|
|
</%def>
|
|
|
|
<%def name="body()">
|
|
<div class="table_wrapper">
|
|
<div id="albumheader" class="clearfix">
|
|
<div id="albumImg">
|
|
<img height="200" alt="" class="albumArt">
|
|
</div>
|
|
|
|
<h1><a href="http://musicbrainz.org/release-group/${album['AlbumID']}">${album['AlbumTitle']}</a></h1>
|
|
<h2><a href="http://musicbrainz.org/artist/${album['ArtistID']}">${album['ArtistName']}</a></h2>
|
|
<%
|
|
totalduration = myDB.action("SELECT SUM(TrackDuration) FROM tracks WHERE AlbumID=?", [album['AlbumID']]).fetchone()[0]
|
|
totaltracks = len(myDB.select("SELECT TrackTitle from tracks WHERE AlbumID=?", [album['AlbumID']]))
|
|
try:
|
|
albumduration = helpers.convert_milliseconds(totalduration)
|
|
except:
|
|
albumduration = 'n/a'
|
|
|
|
%>
|
|
<div class="albuminfo">
|
|
<div id="albumInfo"></div>
|
|
<ul>
|
|
<li>Tracks: <span>${totaltracks}</span></li>
|
|
<li>Duration: <span>${albumduration}</span></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="track_wrapper">
|
|
<table class="display" id="track_table">
|
|
<thead>
|
|
<tr>
|
|
<th id="number">#</th>
|
|
<th id="name">Track Title</th>
|
|
<th id="duration">Duration</th>
|
|
<th id="location">Local File</th>
|
|
<th id="bitrate">Bit Rate</th>
|
|
<th id="format">Format</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
%for track in tracks:
|
|
<%
|
|
if track['Location']:
|
|
grade = 'A'
|
|
location = track['Location']
|
|
else:
|
|
grade = 'X'
|
|
location = ''
|
|
|
|
if track['BitRate']:
|
|
bitrate = str(track['BitRate']/1000) + ' kbps'
|
|
else:
|
|
bitrate = ''
|
|
|
|
try:
|
|
trackduration = helpers.convert_milliseconds(track['TrackDuration'])
|
|
except:
|
|
trackduration = 'n/a'
|
|
|
|
if not track['Format']:
|
|
format = 'Unknown'
|
|
else:
|
|
format = track['Format']
|
|
%>
|
|
<tr class="grade${grade}">
|
|
<td id="number">${track['TrackNumber']}</td>
|
|
<td id="name">${track['TrackTitle']}</td>
|
|
<td id="duration">${trackduration}</td>
|
|
<td id="location">${location}</td>
|
|
<td id="bitrate">${bitrate}</td>
|
|
<td id="format">${format}</td>
|
|
</tr>
|
|
%endfor
|
|
<%
|
|
unmatched = myDB.select('SELECT * from have WHERE ArtistName LIKE ? AND AlbumTitle LIKE ?', [album['ArtistName'], album['AlbumTitle']])
|
|
%>
|
|
%if unmatched:
|
|
%for track in unmatched:
|
|
<%
|
|
duration = helpers.convert_seconds(float(track['TrackLength']))
|
|
%>
|
|
<tr class="gradeC">
|
|
<td id="number">${track['TrackNumber']}</td>
|
|
<td id="name">${track['TrackTitle']}</td>
|
|
<td id="duration">${duration}</td>
|
|
<td id="location">${track['Location']}</td>
|
|
<td id="bitrate">${int(track['BitRate'])/1000} kbps</td>
|
|
<td id="format">${track['Format']}</td>
|
|
</tr>
|
|
%endfor
|
|
%endif
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</%def>
|
|
|
|
<%def name="headIncludes()">
|
|
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
|
|
</%def>
|
|
|
|
<%def name="javascriptIncludes()">
|
|
<script src="js/libs/jquery.dataTables.min.js"></script>
|
|
<script>
|
|
|
|
function getAlbumArt() {
|
|
var id = "${album['AlbumID']}";
|
|
var name = "${album['AlbumTitle']}";
|
|
var image = $("div#albumImg img");
|
|
if ( !image.hasClass('done') ) {
|
|
image.addClass('done');
|
|
getArtwork(image,id,name,'album');
|
|
}
|
|
}
|
|
|
|
function getAlbumInfo() {
|
|
var id = "${album['AlbumID']}";
|
|
var elem = $("#albumInfo");
|
|
getInfo(elem,id,'album');
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
getAlbumInfo();
|
|
getAlbumArt();
|
|
initActions();
|
|
setTimeout(function(){
|
|
initFancybox();
|
|
},1000);
|
|
|
|
$('#track_table').dataTable({
|
|
"aaSorting": [],
|
|
"bFilter": false,
|
|
"bInfo": false,
|
|
"bPaginate": false
|
|
});
|
|
});
|
|
|
|
</script>
|
|
</%def>
|