Added descriptions from last fm, formatted album page, added retry buttons

This commit is contained in:
Remy
2011-08-07 21:18:42 -07:00
parent 6c235732e2
commit 45563c821c
15 changed files with 306 additions and 92 deletions
+26 -12
View File
@@ -7,26 +7,36 @@
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="refreshArtist?ArtistID=${album['ArtistID']}">Mark Album as Wanted</a></li>
<li><a href="deleteArtist?ArtistID=${album['ArtistID']}">Delete Artist</a></li>
%if album['Status'] == 'Paused':
<li><a href="resumeArtist?ArtistID=${album['ArtistID']}">Resume Artist</a></li>
%if album['Status'] == 'Skipped':
<li><a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False">Mark Album as Wanted</a></li>
%elif album['Status'] == 'Snatched' or 'Downloaded':
<li><a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False">Retry Download</a></li>
<li><a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True">Try New Version</a></li>
%else:
<li><a href="pauseArtist?ArtistID=${album['ArtistID']}">Pause Artist</a></li>
%endif
<li><a href="getExtras?ArtistID=${album['ArtistID']}">Get Extras</a></li>
<li><a href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False">Mark Album as Skipped</a></li>
%endif
</ul>
</div>
</%def>
<%def name="body()">
<div class="table_wrapper">
<h2><a href="artistPage?ArtistID=${album['ArtistID']}"><- Back to ${album['ArtistName']}</a></h2>
<div id="albumheader">
<img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.LZZZZZZZ.jpg" height="200" width="200" alt="albumart" class="albumArt">
<h1>${album['AlbumTitle']}</h1>
<h2>${album['ArtistName']}</h2>
<br>
<%
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']]))
%>
<h3>Tracks: ${totaltracks}</h3>
<h3>Duration: ${helpers.convert_milliseconds(totalduration)}</h3>
%if description:
<h3>Description: </h3>
${description['Summary']}
%endif
</div>
<div id="track_wrapper">
<table class="display" id="track_table">
@@ -35,14 +45,18 @@
<th id="number">#</th>
<th id="name">Track Title</th>
<th id="duration">Duration</th>
<th id="have">Have</th>
<th id="have"></th>
</tr>
</thead>
<tbody>
<%
i = 0
%>
%for track in tracks:
<%
trackmatch = 'asd'
if len(trackmatch):
i += 1
have = myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle like ? AND TrackTitle like ?', [album['ArtistName'], album['AlbumTitle'], track['TrackTitle']])
if len(have):
grade = 'A'
check = '<img src="images/checkmark.png" alt="checkmark">'
else:
@@ -50,9 +64,9 @@
check = ''
%>
<tr class="grade${grade}">
<td id="number">#</td>
<td id="number">${i}</td>
<td id="name">${track['TrackTitle']}</td>
<td id="duration">${track['TrackDuration']}</td>
<td id="duration">${helpers.convert_milliseconds(track['TrackDuration'])}</td>
<td id="have">${check}</td>
</tr>
%endfor
+11 -2
View File
@@ -26,6 +26,7 @@
<p class="indented">Mark selected albums as
<select 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>
@@ -74,7 +75,15 @@
<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="status">${album['Status']}</td>
<td id="status">${album['Status']}
%if album['Status'] == 'Skipped':
[<a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}">want</a>]
%elif album['Status'] == 'Wanted':
[<a href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}">skip</a>]
%else:
[<a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}" title="Retry the same download again">retry</a>][<a href="queueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=True" title="Try a new download, skipping all previously tried nzbs">new</a>]
%endif
</td>
<td id="have"><span title="${percent}"><span><div class="progress-container"><div style="width:${percent}%"><div class="havetracks">${havetracks}/${totaltracks}</div></div></div></td>
</tr>
%endfor
@@ -110,7 +119,7 @@
"sInfoEmpty":"Showing 0 to 0 of 0 albums",
"sInfoFiltered":"(filtered from _MAX_ total albums)"},
"bPaginate": false,
"aaSorting": [[3, 'asc'],[2,'desc']]
"aaSorting": [[4, 'asc'],[3,'desc']]
});
});
+1 -1
View File
@@ -49,7 +49,7 @@
<li><a href="config">settings</a></li>
</ul>
<div id="searchbar">
<form action="findArtist" method="get">
<form action="search" method="get">
<input type="text" value="" onfocus="if(this.value==this.defaultValue) this.value='';" name="name" />
<select name="type">
<option value="artist">Artist</option>
+1 -1
View File
@@ -1,5 +1,6 @@
<%inherit file="base.html"/>
<form action="configUpdate" method="post">
<div id="config">
<div class="table_wrapper">
<h1>Web Interface</h1>
<table>
@@ -216,5 +217,4 @@
</p>
</form>
</div>
</div>
<%inherit file="base.html" />
+6 -1
View File
@@ -1,4 +1,7 @@
<%inherit file="base.html"/>
<%!
from headphones import helpers
%>
<%def name="headerIncludes()">
<div id="subhead_container">
@@ -22,6 +25,7 @@
<th id="filename">File Name</th>
<th id="size">Size</th>
<th id="status">Status</th>
<th id="action"></th>
</tr>
</thead>
<tbody>
@@ -39,8 +43,9 @@
<tr class="grade${grade}">
<td id="dateadded">${item['DateAdded']}</td>
<td id="filename"><a href="${item['URL']}">${item['Title']}</a></td>
<td id="size">${item['Size']}</td>
<td id="size">${helpers.bytes_to_mb(item['Size'])}</td>
<td id="status">${item['Status']}</td>
<td id="action">[<a href="queueAlbum?AlbumID=${item['AlbumID']}&redirect=history">retry</a>][<a href="queueAlbum?AlbumID=${item['AlbumID']}&new=True&redirect=history">new</a>]</td>
</tr>
%endfor
</tbody>
+31 -7
View File
@@ -1,4 +1,8 @@
<%inherit file="base.html" />
<%!
import headphones
%>
<%def name="body()">
<div class="table_wrapper">
<h1>Scan Music Library</h1><br />
@@ -10,24 +14,44 @@
as soon as you click 'Submit'
<br /><br />
<form action="musicScan" method="GET" align="center">
%if headphones.MUSIC_DIR:
<input type="text" value="${headphones.MUSIC_DIR}" name="path" size="70" />
%else:
<input type="text" value="Enter a Music Directory to scan" onfocus="if
(this.value==this.defaultValue) this.value='';" name="path" size="70" />
%endif
<input type="submit" /></form>
</div>
<div class="table_wrapper">
<div class="table_wrapper_left">
<h1>Import Last.FM Artists</h1><br />
Enter the username whose artists you want to import:<br /><br />
<form action="importLastFM" method="GET" align="center">
<input type="text" value="%s" onfocus="if
<%
if headphones.LASTFM_USERNAME:
lastfmvalue = headphones.LASTFM_USERNAME
else:
lastfmvalue = 'Last.fm Username'
%>
<input type="text" value="${lastfmvalue}" onfocus="if
(this.value==this.defaultValue) this.value='';" name="username" size="18" />
<input type="submit" /></form><br /><br /></div></div>
<div class="tableright"><div class="config"><h1>Placeholder :-)</h1><br />
<input type="submit" /></form><br /><br />
</div>
<div class="table_wrapper_right">
<h1>Placeholder :-)</h1><br />
<br /><br />
<form action="" method="GET" align="center">
<input type="text" value="" onfocus="if
(this.value==this.defaultValue) this.value='';" name="" size="18" />
<input type="submit" /></form><br /><br /></div></div><br />
<div class="table"><div class="config"><h1>Force Search</h1><br />
<input type="submit" /></form><br /><br />
</div>
<div class="table_wrapper">
<h1>Force Search</h1><br />
<a href="forceSearch">Force Check for Wanted Albums</a><br /><br />
<a href="forceUpdate">Force Update Active Artists</a><br /><br />
<a href="forcePostProcess">Force Post-Process Albums in Download Folder</a><br /><br /><br />
<a href="checkGithub">Check for Headphones Updates</a><br /><br /><br /></div></div>''' % (music_dir_input, lastfm_user_text))
<a href="checkGithub">Check for Headphones Updates</a><br /><br /><br />
</div>
</%def>
@@ -0,0 +1,70 @@
<%inherit file="base.html" />
<%def name="body()">
<div id="paddingheader">
<h1>Search Results<h1>
</div>
<table class="display" id="searchresults_table">
<thead>
<tr>
%if type == 'album':
<th id="albumname">Album Name</th>
%endif
<th id="artistname">Artist Name</th>
<th id="score">Score</th>
<th id="add"></th>
</tr>
</thead>
<tbody>
%if searchresults:
%for result in searchresults:
<%
if result['score'] == 100:
grade = 'A'
else:
grade = 'Z'
%>
<tr class="grade${grade}">
%if type == 'album':
<td id="albumname"><a href="${result['albumurl']}">${result['title']}</a></td>
%endif
<td id="artistname"><a href="${result['url']}">${result['uniquename']}</a></td>
<td id="score">${result['score']}</td>
%if type == 'album':
<td id="add"><a href="addReleaseById?rid=${result['albumid']}">Add this album</a></td>
%else:
<td id="add"><a href="addArtist?artistid=${result['id']}">Add this artist</a></td>
%endif
</tr>
%endfor
%endif
</tbody>
</table>
</%def>
<%def name="headIncludes()">
<link rel="stylesheet" href="css/data_table.css">
</%def>
<%def name="javascriptIncludes()">
<script src="js/libs/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function()
{
$('#searchresults_table').dataTable(
{
"oLanguage": {
"sLengthMenu":"Show _MENU_ results per page",
"sEmptyTable": "No results",
"sInfo":"Showing _TOTAL_ results",
"sInfoEmpty":"Showing 0 to 0 of 0 results",
"sInfoFiltered":"(filtered from _MAX_ total results)"},
"bPaginate": false,
"bFilter": false,
"aaSorting": []
});
});
</script>
</%def>
+1 -1
View File
@@ -6,6 +6,6 @@
<%def name="body()">
<div class="table_wrapper">
Headphones is ${message}
<h1>Headphones is ${message}</h1>
</div>
</%def>
+13 -5
View File
@@ -9,7 +9,7 @@
<th id="artistname">Artist</th>
<th id="albumname">Album Name</th>
<th id="reldate">Release Date</th>
<th id="type">Release Type</th>
<th id="type">Type</th>
<th id="status">Status</th>
</tr>
</thead>
@@ -26,30 +26,38 @@
%endfor
</tbody>
</table>
</div>
<form action="markAlbums" method="get">
<p class="indented">Mark selected albums as
<select name="action">
<option value="Skipped">Skipped</option>
<option value="Downloaded">Downloaded</option>
</select>
<input type="submit" value="Go">
</p>
<div class="table_wrapper">
<h1>Wanted Albums</h1>
<table class="display" id="upcoming_table">
<thead>
<tr>
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
<th id="albumart"></th>
<th id="artistname">Artist</th>
<th id="albumname">Album Name</th>
<th id="reldate">Release Date</th>
<th id="type">Release Type</th>
<th id="status">Status</th>
<th id="type">Type</th>
</tr>
</thead>
<tbody>
%for album in wanted:
<tr class="gradeZ">
<td id="select"><input type="checkbox" name="${album['AlbumID']}" class="checkbox" /></th>
<td id="albumart"><img src="http://ec1.images-amazon.com/images/P/${album['AlbumASIN']}.01.MZZZZZZZ.jpg" height="50" width="50"></td>
<td id="artistname">${album['ArtistName']}</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="status">${album['Status']}</td>
</tr>
%endfor
</tbody>