show a few more file details

This commit is contained in:
Adrian Sampson 2011-08-08 16:38:02 -07:00
parent 8e0638512d
commit 4dc020e4a7
2 changed files with 26 additions and 15 deletions

View file

@ -1,3 +1,17 @@
// Format times as minutes and seconds.
var timeFormat = function(secs) {
if (secs == undefined || isNaN(secs)) {
return '0:00';
}
secs = Math.round(secs);
var mins = '' + Math.round(secs / 60);
secs = '' + (secs % 60);
if (secs.length < 2) {
secs = '0' + secs;
}
return mins + ':' + secs;
}
// jQuery extension encapsulating event hookups for audio element controls.
$.fn.player = function(debug) {
// Selected element should contain an HTML5 Audio element.
@ -22,18 +36,6 @@ $.fn.player = function(debug) {
});
// Utilities.
var timeFormat = function(secs) {
if (secs == undefined || isNaN(secs)) {
return '0:00';
}
secs = Math.round(secs);
var mins = '' + Math.round(secs / 60);
secs = '' + (secs % 60);
if (secs.length < 2) {
secs = '0' + secs;
}
return mins + ':' + secs;
}
var timePercent = function(cur, total) {
if (cur == undefined || isNaN(cur) ||
total == undefined || isNaN(total) || total == 0) {

View file

@ -53,8 +53,7 @@
</span>
<span class="title"><%= title %></span>
<a class="download" href="/item/<%= id %>/file">download</a>
<button class="play">play</button>
<button class="play">&#9654;</button>
<dl>
<dt>Track</dt>
@ -63,12 +62,22 @@
<dt>Disc</dt>
<dd><%= disc %>/<%= disctotal %></dd>
<% } %>
<dt>Length</dt>
<dd><%= timeFormat(length) %></dd>
<dt>Format</dt>
<dd><%= format %></dd>
<dt>Bitrate</dt>
<dd><%= Math.round(bitrate/1000) %> kbps</dd>
<% if (mb_trackid) { %>
<dt>MuscBrainz entry</dt>
<dd>
<a href="http://musicbrainz.org/recording/<%= mb_trackid %>">view</a>
<a target="_blank" href="http://musicbrainz.org/recording/<%= mb_trackid %>">view</a>
</dd>
<% } %>
<dt>File</dt>
<dd>
<a target="_blank" class="download" href="/item/<%= id %>/file">download</a>
</dd>
<% if (lyrics) { %>
<dt>Lyrics</dt>
<dd><%= lyrics %></dd>