Updated templates

This commit is contained in:
Remy
2011-08-16 23:34:45 -07:00
parent 238e28afb5
commit b9ed9bb753
13 changed files with 190 additions and 38 deletions
+1
View File
@@ -109,6 +109,7 @@ header { min-height: 68px; width: 100%; min-width: 935px; padding-left: 0px; pad
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 13px; }
p.indented { padding-top: 20px; margin-left: 20px; font-size: 14px; }
p.center { text-align: center; font-size: 18px; }
+4
View File
@@ -1,5 +1,6 @@
<%
import headphones
from headphones import version
%>
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
@@ -70,6 +71,9 @@
<footer>
<div id="version">
Version: ${headphones.CURRENT_VERSION}
%if version.HEADPHONES_VERSION != 'master':
(${version.HEADPHONES_VERSION})
%endif
</div>
<div id="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
+28 -12
View File
@@ -190,21 +190,21 @@
<tr>
<td>
<h2>Album Quality:</h2><br>
<input type="radio" name="preferred_quality" value="0" ${config['pref_qual_0']} /> Highest Quality excluding Lossless<br>
<input type="radio" name="preferred_quality" value="1" ${config['pref_qual_1']} /> Highest Quality including Lossless<br>
<input type="radio" name="preferred_quality" value="3" ${config['pref_qual_3']} /> Lossless Only<br>
<input type="radio" name="preferred_quality" value="2" ${config['pref_qual_2']} /> Preferred Bitrate:
<input type="text" name="preferred_bitrate" value="${config['pref_bitrate']}" size="3" maxlength="5" />kbps <br>
<h4><input type="radio" name="preferred_quality" value="0" ${config['pref_qual_0']} /> Highest Quality excluding Lossless</h4>
<h4><input type="radio" name="preferred_quality" value="1" ${config['pref_qual_1']} /> Highest Quality including Lossless</h4>
<h4><input type="radio" name="preferred_quality" value="3" ${config['pref_qual_3']} /> Lossless Only</h4>
<h4><input type="radio" name="preferred_quality" value="2" ${config['pref_qual_2']} /> Preferred Bitrate:
<input type="text" name="preferred_bitrate" value="${config['pref_bitrate']}" size="3" maxlength="5" />kbps</h4>
<i class="smalltext2"><input type="checkbox" name="detect_bitrate" value="1" ${config['detect_bitrate']} />Auto-Detect Preferred Bitrate </i>
</td>
<td>
<h2>Post-Processing:</h2>
<input type="checkbox" name="move_files" value="1" ${config['move_files']} /> Move downloads to Destination Folder<br />
<input type="checkbox" name="rename_files" value="1" ${config['rename_files']} /> Rename files<br>
<input type="checkbox" name="correct_metadata" value="1" ${config['correct_metadata']} /> Correct metadata<br>
<input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /> Delete leftover files (.m3u, .nfo, .sfv, .nzb, etc.)<br>
<input type="checkbox" name="add_album_art" value="1" ${config['add_album_art']}> Add album art as 'folder.jpg' to album folder<br>
<input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']}> Embed album art in each file
<h4><input type="checkbox" name="move_files" value="1" ${config['move_files']} /> Move downloads to Destination Folder</h4>
<h4><input type="checkbox" name="rename_files" value="1" ${config['rename_files']} /> Rename files</h4>
<h4><input type="checkbox" name="correct_metadata" value="1" ${config['correct_metadata']} /> Correct metadata</h4>
<h4><input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /> Delete leftover files (.m3u, .nfo, .sfv, .nzb, etc.)</h4>
<h4><input type="checkbox" name="add_album_art" value="1" ${config['add_album_art']}> Add album art as 'folder.jpg' to album folder</h4>
<h4><input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']}> Embed album art in each file</h4>
</td>
</tr>
@@ -227,7 +227,7 @@
<td>
<h2>Renaming Options:</h2>
<br>
<h3>Folder Format:</h3><input type="text" name="folder_format" value="${config['folder_format']}" size="43">
<h3>Folder Format:</h3><input type="text" name="folder_format" value="${config['folder_format']}" size="43"><br>
<i class="smalltext">Use: artist, album, year and first (first letter in artist name)<br />
E.g.: first/artist/album [year] = G/Girl Talk/All Day [2010]</i>
<br><br>
@@ -256,6 +256,22 @@
<h3>Log Directory:</h3><input type="text" name="log_dir" value="${config['log_dir']}" size="50">
</td>
</tr>
<tr>
<td>
<h2>Re-Encoding Options:</h2>
<br>
<h3><input type="checkbox" name="reencode" value="1" />Convert Lossless to mp3</h3>
<i class="smalltext">Note: this option requires the lame or ffdshow encoder</i>
<br><br>
<h3>Encoder: <select name="encoder">
<option value="lame">lame</option>
<option value="ffdshow">ffdshow</option>
</select>
Bitrate: <input type="text" name="encode_bitrate" value="" size="3" maxlength="5" />kbps <br>
<br>
<h3>Path to Encoder:</h3><input type="text" name="encoder" value="" size="43">
</td>
</tr>
</table>
</div>
+19 -1
View File
@@ -62,7 +62,7 @@
grade = 'A'
location = track['Location']
else:
grade = 'Z'
grade = 'X'
location = ''
if track['BitRate']:
@@ -83,6 +83,23 @@
<td id="bitrate">${bitrate}</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>
</tr>
%endfor
%endif
</tbody>
</table>
</div>
@@ -100,6 +117,7 @@
{
$('#track_table').dataTable(
{
"aaSorting": [],
"bFilter": false,
"bInfo": false,
"bPaginate": false
+14 -5
View File
@@ -41,11 +41,12 @@
<tr>
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
<th id="albumart"></th>
<th id="albumname">Album Name</th>
<th id="reldate">Release Date</th>
<th id="type">Release Type</th>
<th id="albumname">Name</th>
<th id="reldate">Date</th>
<th id="type">Type</th>
<th id="status">Status</th>
<th id="have">Have</th>
<th id="bitrate">Bitrate</th>
</tr>
</thead>
<tbody>
@@ -62,7 +63,7 @@
myDB = db.DBConnection()
totaltracks = len(myDB.select('SELECT TrackTitle from tracks WHERE AlbumID=?', [album['AlbumID']]))
havetracks = len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle like ?', [album['ArtistName'], album['AlbumTitle']]))
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
@@ -71,6 +72,12 @@
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}">
@@ -89,6 +96,7 @@
%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>
<td id="bitrate">${bitrate}</td>
</tr>
%endfor
</tbody>
@@ -114,7 +122,8 @@
null,
null,
null,
{ "sType": "title-numeric"}
{ "sType": "title-numeric"},
null
],
"oLanguage": {
"sLengthMenu":"Show _MENU_ albums per page",
+4
View File
@@ -1,5 +1,6 @@
<%
import headphones
from headphones import version
%>
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
@@ -70,6 +71,9 @@
<footer>
<div id="version">
Version: ${headphones.CURRENT_VERSION}
%if version.HEADPHONES_VERSION != 'master':
(${version.HEADPHONES_VERSION})
%endif
</div>
<div id="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
+28 -12
View File
@@ -190,21 +190,21 @@
<tr>
<td>
<h2>Album Quality:</h2><br>
<input type="radio" name="preferred_quality" value="0" ${config['pref_qual_0']} /> Highest Quality excluding Lossless<br>
<input type="radio" name="preferred_quality" value="1" ${config['pref_qual_1']} /> Highest Quality including Lossless<br>
<input type="radio" name="preferred_quality" value="3" ${config['pref_qual_3']} /> Lossless Only<br>
<input type="radio" name="preferred_quality" value="2" ${config['pref_qual_2']} /> Preferred Bitrate:
<input type="text" name="preferred_bitrate" value="${config['pref_bitrate']}" size="5" maxlength="5" />kbps <br>
<h4><input type="radio" name="preferred_quality" value="0" ${config['pref_qual_0']} /> Highest Quality excluding Lossless</h4>
<h4><input type="radio" name="preferred_quality" value="1" ${config['pref_qual_1']} /> Highest Quality including Lossless</h4>
<h4><input type="radio" name="preferred_quality" value="3" ${config['pref_qual_3']} /> Lossless Only</h4>
<h4><input type="radio" name="preferred_quality" value="2" ${config['pref_qual_2']} /> Preferred Bitrate:
<input type="text" name="preferred_bitrate" value="${config['pref_bitrate']}" size="3" maxlength="5" />kbps</h4>
<i class="smalltext2"><input type="checkbox" name="detect_bitrate" value="1" ${config['detect_bitrate']} />Auto-Detect Preferred Bitrate </i>
</td>
<td>
<h2>Post-Processing:</h2>
<input type="checkbox" name="move_files" value="1" ${config['move_files']} /> Move downloads to Destination Folder<br />
<input type="checkbox" name="rename_files" value="1" ${config['rename_files']} /> Rename files<br>
<input type="checkbox" name="correct_metadata" value="1" ${config['correct_metadata']} /> Correct metadata<br>
<input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /> Delete leftover files (.m3u, .nfo, .sfv, .nzb, etc.)<br>
<input type="checkbox" name="add_album_art" value="1" ${config['add_album_art']}> Add album art as 'folder.jpg' to album folder<br>
<input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']}> Embed album art in each file
<h4><input type="checkbox" name="move_files" value="1" ${config['move_files']} /> Move downloads to Destination Folder</h4>
<h4><input type="checkbox" name="rename_files" value="1" ${config['rename_files']} /> Rename files</h4>
<h4><input type="checkbox" name="correct_metadata" value="1" ${config['correct_metadata']} /> Correct metadata</h4>
<h4><input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /> Delete leftover files (.m3u, .nfo, .sfv, .nzb, etc.)</h4>
<h4><input type="checkbox" name="add_album_art" value="1" ${config['add_album_art']}> Add album art as 'folder.jpg' to album folder</h4>
<h4><input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']}> Embed album art in each file</h4>
</td>
</tr>
@@ -227,7 +227,7 @@
<td>
<h2>Renaming Options:</h2>
<br>
<h3>Folder Format:</h3><input type="text" name="folder_format" value="${config['folder_format']}" size="43">
<h3>Folder Format:</h3><input type="text" name="folder_format" value="${config['folder_format']}" size="43"><br>
<i class="smalltext">Use: artist, album, year and first (first letter in artist name)<br />
E.g.: first/artist/album [year] = G/Girl Talk/All Day [2010]</i>
<br><br>
@@ -256,6 +256,22 @@
<h3>Log Directory:</h3><input type="text" name="log_dir" value="${config['log_dir']}" size="50">
</td>
</tr>
<tr>
<td>
<h2>Re-Encoding Options:</h2>
<br>
<h3><input type="checkbox" name="reencode" value="1" />Convert Lossless to mp3</h3>
<i class="smalltext">Note: this option requires the lame or ffdshow encoder</i>
<br><br>
<h3>Encoder: <select name="encoder">
<option value="lame">lame</option>
<option value="ffdshow">ffdshow</option>
</select>
Bitrate: <input type="text" name="encode_bitrate" value="" size="3" maxlength="5" />kbps <br>
<br>
<h3>Path to Encoder:</h3><input type="text" name="encoder" value="" size="43">
</td>
</tr>
</table>
</div>
+1 -1
View File
@@ -42,7 +42,7 @@
%>
<tr class="grade${grade}">
<td id="dateadded">${item['DateAdded']}</td>
<td id="filename"><a href="${item['URL']}">${item['Title']}</a></td>
<td id="filename">${item['Title']} [<a href="${item['URL']}">nzb</a>]<a href="albumPage?AlbumID=${item['AlbumID']}">[album page]</a></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>
+8 -1
View File
@@ -1,11 +1,15 @@
<%inherit file="base.html" />
<%!
import headphones
from headphones.helpers import checked
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="manageArtists">Manage Artists</a></li>
<li><a href="manageArtists">Manage Artists</a></li>
%if not headphones.ADD_ARTISTS:
<li><a href="manageNew">Manage New Artists</a></li>
%endif
</ul>
</div>
</%def>
@@ -30,6 +34,9 @@
<input type="text" value="Enter a Music Directory to scan" onfocus="if
(this.value==this.defaultValue) this.value='';" name="path" size="70" />
%endif
<br>
<h3><input type="checkbox" name="autoadd" value="1" ${checked(headphones.ADD_ARTISTS)}>Automatically add new artists</h3>
<br><br>
<input type="submit" /></form>
</div>
+14 -1
View File
@@ -21,6 +21,7 @@
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
<th id="name">Artist Name</th>
<th id="status">Status</th>
<th id="album">Latest Album</th>
</tr>
</thead>
<tbody>
@@ -32,11 +33,22 @@
grade = 'C'
else:
grade = 'Z'
if artist['ReleaseDate'] and artist['LatestAlbum']:
releasedate = artist['ReleaseDate']
albumdisplay = '<i>%s</i> (%s)' % (artist['LatestAlbum'], artist['ReleaseDate'])
elif artist['LatestAlbum']:
releasedate = ''
albumdisplay = '<i>%s</i>' % artist['LatestAlbum']
else:
releasedate = ''
albumdisplay = '<i>None</i>'
%>
<tr class="grade${grade}">
<td id="select"><input type="checkbox" name="${artist['ArtistID']}" class="checkbox" /></td>
<td id="name"><span title="${artist['ArtistSortName']}"></span><a href="artistPage?ArtistID=${artist['ArtistID']}">${artist['ArtistName']}</a></td>
<td id="status">${artist['Status']}</td>
<td id="album"><span title="${releasedate}"></span><a href="albumPage?AlbumID=${artist['AlbumID']}">${albumdisplay}</a></td>
</tr>
%endfor
</tbody>
@@ -58,7 +70,8 @@
"aoColumns": [
null,
{ "sType": "title-string"},
null
null,
{ "sType": "title-string"}
],
"bStateSave": true,
"bPaginate": false
+52
View File
@@ -0,0 +1,52 @@
<%inherit file="base.html" />
<%!
import headphones
%>
<%def name="body()">
<div id="paddingheader">
<h1>Manage New Artists<h1>
<h3><a href="musicScan?path=${headphones.MUSIC_DIR}&redirect=manageNew">Scan Music Library</a></h3>
</div>
<form action="addArtists" method="get">
<p class="indented">
Add selected artists
<input type="submit" value="Go">
</p>
<table class="display" id="artist_table">
<thead>
<tr>
<th id="select"><input type="checkbox" onClick="toggle(this)" /></th>
<th id="name">Artist Name</th>
</tr>
</thead>
<tbody>
%for artist in headphones.NEW_ARTISTS:
<tr class="gradeZ">
<td id="select"><input type="checkbox" name="${artist}" class="checkbox" /></td>
<td id="name">${artist}</a></td>
</tr>
%endfor
</tbody>
</table>
</form>
</%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()
{
$('#artist_table').dataTable(
{
"aaSorting": [[1, 'asc']],
"bStateSave": false,
"bPaginate": false
});
});
</script>
</%def>
+15 -3
View File
@@ -22,7 +22,6 @@ def libraryScan(dir=None):
bitrates = []
myDB = db.DBConnection()
myDB.action('''DELETE from have''')
for r,d,f in os.walk(dir):
for files in f:
@@ -75,8 +74,21 @@ def libraryScan(dir=None):
# if we can't find a match in the database on a track level, it might be a new artist or it might be on a non-mb release
new_artists.append(f_artist)
# The have table will become the new database for unmatched tracks (i.e. tracks with no associated links in the database
myDB.action('INSERT INTO have VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [f_artist, f.album, f.track, f.title, f.length, f.bitrate, f.genre, f.date, f.mb_trackid, file, helpers.cleanName(f_artist+' '+f.album+' '+f.title)])
# The have table will become the new database for unmatched tracks (i.e. tracks with no associated links in the database
controlValueDict = {"Location": file}
newValueDict = {"ArtistName": f_artist,
"AlbumTitle": f.album,
"TrackNumber": f.track,
"TrackTitle": f.title,
"TrackLength": f.length,
"BitRate": f.bitrate,
"Genre": f.genre,
"Date": f.date,
"TrackID": f.mb_trackid,
"CleanName": helpers.cleanName(f_artist+' '+f.album+' '+f.title)
}
myDB.upsert("have", newValueDict, controlValueDict)
# Now check empty file paths to see if we can find a match based on their folder format
tracks = myDB.select('SELECT * from tracks WHERE Location IS NULL')
+2 -2
View File
@@ -98,7 +98,7 @@ def checkGithub():
gh = github.GitHub()
for curCommit in gh.commits.forBranch('rembo10', 'headphones', 'master'):
for curCommit in gh.commits.forBranch('rembo10', 'headphones', version.HEADPHONES_VERSION):
if not latest_commit:
latest_commit = curCommit.id
if not cur_commit:
@@ -200,5 +200,5 @@ def update():
ver_file.write(headphones.LATEST_VERSION)
ver_file.close()
except IOError, e:
logger.error(u"Unable to write version file, update not complete: "+ex(e))
logger.error(u"Unable to write for curCommit in gh.commits.forBranch file, update not complete: "+ex(e))
return