Merge branch 'develop'

This commit is contained in:
Remy
2011-08-09 21:04:07 -07:00
20 changed files with 1472 additions and 41 deletions

View File

@@ -1,4 +1,8 @@
<%inherit file="base.html"/>
<%!
import headphones
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
@@ -234,8 +238,20 @@
<td>
<h2>Miscellaneous:</h2>
<br>
<h3><input type="checkbox" name="include_extras" value="1" ${config['include_extras']} />Automatically Include Extras When Adding an Artist</h3><br />
<i class="smalltext">Extras includes: EPs, Compilations, Live Albums, Remix Albums and Singles</i>
<h3><input type="checkbox" name="include_extras" value="1" ${config['include_extras']} />Automatically Include Extras When Adding an Artist</h3>
<i class="smalltext">(EPs, Compilations, Live Albums, Remix Albums and Singles)</i>
<br><br>
<h3>Interface: <select name="interface"><h3>
%for interface in config['interface_list']:
<%
if interface == headphones.INTERFACE:
selected = 'selected="selected"'
else:
selected = ''
%>
<option value="${interface}" ${selected}>${interface}</option>
%endfor
</select>
<br><br>
<h3>Log Directory:</h3><input type="text" name="log_dir" value="${config['log_dir']}" size="50">
</td>

View File

@@ -0,0 +1,105 @@
<%inherit file="base.html" />
<%!
from headphones import db, helpers
myDB = db.DBConnection()
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
%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'] == 'Wanted':
<li><a href="unqueueAlbum?AlbumID=${album['AlbumID']}&ArtistID=${album['ArtistID']}&new=False">Mark Album as Skipped</a></li>
%else:
<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>
%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']]))
try:
albumduration = helpers.convert_milliseconds(totalduration)
except:
albumduration = 'n/a'
%>
<h3>Tracks: ${totaltracks}</h3>
<h3>Duration: ${albumduration}</h3>
%if description:
<h3>Description: </h3>
${description['Summary']}
%endif
</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="have"></th>
</tr>
</thead>
<tbody>
<%
i = 0
%>
%for track in tracks:
<%
i += 1
have = myDB.select('SELECT TrackTitle from have WHERE ArtistName like ? AND AlbumTitle like ? AND TrackTitle like ?', [track['ArtistName'], track['AlbumTitle'], track['TrackTitle']])
if len(have):
grade = 'A'
check = '<img src="images/checkmark.png" alt="checkmark">'
else:
grade = 'Z'
check = ''
try:
trackduration = helpers.convert_milliseconds(track['TrackDuration'])
except:
trackduration = 'n/a'
%>
<tr class="grade${grade}">
<td id="number">${i}</td>
<td id="name">${track['TrackTitle']}</td>
<td id="duration">${trackduration}</td>
<td id="have">${check}</td>
</tr>
%endfor
</tbody>
</table>
</div>
</div>
</%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()
{
$('#track_table').dataTable(
{
"bFilter": false,
"bInfo": false,
"bPaginate": false
});
});
</script>
</%def>

View File

@@ -0,0 +1,127 @@
<%inherit file="base.html"/>
<%!
from headphones import db
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="refreshArtist?ArtistID=${artist['ArtistID']}">Refresh Artist</a></li>
<li><a href="deleteArtist?ArtistID=${artist['ArtistID']}">Delete Artist</a></li>
%if artist['Status'] == 'Paused':
<li><a href="resumeArtist?ArtistID=${artist['ArtistID']}">Resume Artist</a></li>
%else:
<li><a href="pauseArtist?ArtistID=${artist['ArtistID']}">Pause Artist</a></li>
%endif
<li><a href="getExtras?ArtistID=${artist['ArtistID']}">Get Extras</a></li>
</ul>
</div>
</%def>
<%def name="body()">
<div id="paddingheader">
<h1>${artist['ArtistName']}<h1>
</div>
<form action="markAlbums" method="get"><input type="hidden" name="ArtistID" value=${artist['ArtistID']}>
<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>
<input type="submit" value="Go">
</p>
<table class="display" id="album_table">
<thead>
<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="status">Status</th>
<th id="have">Have</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 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 = '?'
%>
<tr class="grade${grade}">
<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="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']}
%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
</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()
{
$('#album_table').dataTable(
{
"aoColumns": [
null,
null,
null,
null,
null,
null,
{ "sType": "title-numeric"}
],
"oLanguage": {
"sLengthMenu":"Show _MENU_ albums per page",
"sEmptyTable": "No album information available",
"sInfo":"Showing _TOTAL_ albums",
"sInfoEmpty":"Showing 0 to 0 of 0 albums",
"sInfoFiltered":"(filtered from _MAX_ total albums)"},
"bPaginate": false,
"aaSorting": [[4, 'asc'],[3,'desc']]
});
});
</script>
</%def>

101
data/interfaces/remix/base.html Executable file
View File

@@ -0,0 +1,101 @@
<%
import headphones
%>
<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Headphones::Remix - ${title}</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="images/favicon.ico">
<link rel="apple-touch-icon" href="images/headphoneslogo.png">
<link rel="stylesheet" href="interfaces/remix/style.css?v=2">
${next.headIncludes()}
<script src="js/libs/modernizr-1.7.min.js"></script>
</head>
<body>
<div id="container">
<header>
% if not headphones.CURRENT_VERSION:
<div id="updatebar">
You're running an unknown version of Headphones. <a class="blue" href="update">Click here to update</a>
</div>
% elif headphones.CURRENT_VERSION != headphones.LATEST_VERSION and headphones.INSTALL_TYPE != 'win':
<div id="updatebar">
A <a class="blue" href="http://github.com/rembo10/headphones/compare/${headphones.CURRENT_VERSION}...${headphones.LATEST_VERSION}"> newer version</a> is available. You're ${headphones.COMMITS_BEHIND} commits behind. <a class="blue" href="update">Click here to update</a>
</div>
% endif
<div id="logo">
<a href="home"><img src="images/headphoneslogo.png" alt="headphones"></a>
</div>
<ul id="nav">
<li><a href="home">home</a></li>
<li><a href="upcoming">upcoming</a></li>
<li><a href="extras">extras</a></li>
<li><a href="manage">manage</a></li>
<li><a href="history">history</a></li>
<li><a href="logs">logs</a></li>
<li><a href="config">settings</a></li>
</ul>
<div id="searchbar">
<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>
<option value="album">Album</option>
</select>
<input type="submit" value="Add"/>
</form>
</div>
<div id="subhead">
${next.headerIncludes()}
</div>
</header>
<div id="main" class="main">
${next.body()}
</div>
<footer>
<div id="version">
Version: ${headphones.CURRENT_VERSION}
</div>
<div id="donate">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="93FFC6WDV97QS">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</footer>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.6.2.min.js"%3E%3C/script%3E'))</script>
${next.javascriptIncludes()}
<script src="js/plugins.js"></script>
<script src="js/script.js"></script>
<!--[if lt IE 7 ]>
<script src="js/libs/dd_belatedpng.js"></script>
<script> DD_belatedPNG.fix('img, .png_bg');</script>
<![endif]-->
</body>
</html>
<%def name="javascriptIncludes()"></%def>
<%def name="headIncludes()"></%def>
<%def name="headerIncludes()"></%def>

View File

@@ -0,0 +1,265 @@
<%inherit file="base.html"/>
<%!
import headphones
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="shutdown">Shut Down</a></li>
<li><a href="restart">Restart</a></li>
</ul>
</div>
</%def>
<%def name="body()">
<div id="paddingheader">
<h1><h1>
</div>
<div class="table_wrapper">
<form action="configUpdate" method="post">
<a name="web_interface"><h1><u>Web Interface</u></h1></a>
<table class="configtable" summary="Web Interface">
<tr>
<td>
<h3>HTTP Host:</h3>
<input type="text" name="http_host" value="${config['http_host']}" size="30" maxlength="40"><br>
<i class="smalltext">i.e. localhost or 0.0.0.0</i>
</td>
<td>
<h3>HTTP Username:</h3>
<input type="text" name="http_username" value="${config['http_user']}" size="30" maxlength="40">
</td>
</tr>
<tr>
<td>
<h3>HTTP Port:</h3>
<input type="text" name="http_port" value="${config['http_port']}" size="10" maxlength="40">
</td>
<td>
<h3>HTTP Password:</h3>
<input type="password" name="http_password" value="${config['http_pass']}" size="30" maxlength="40">
</td>
</tr>
<tr>
<td>
<h3>Launch Browser on Startup: <input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} /></h3>
</td>
</tr>
</table>
</div>
<div class="table_wrapper">
<a name="download"><h1><u>Download Settings</u></h1></a>
<table class="configtable" summary="Download Settings">
<tr>
<td>
<h3>SABnzbd Host:</h3><input type="text" name="sab_host" value="${config['sab_host']}" size="30" maxlength="40"><br>
<i class="smalltext">usually localhost:8080</i>
</td>
<td>
<h3>SABnzbd Username:</h3><input type="text" name="sab_username" value="${config['sab_user']}" size="20" maxlength="40">
</td>
</tr>
<tr>
<td>
<h3>SABnzbd API:</h3><input type="text" name="sab_apikey" value="${config['sab_api']}" size="36" maxlength="40">
</td>
<td>
<h3>SABnzbd Password:</h3><input type="password" name="sab_password" value="${config['sab_pass']}" size="20" maxlength="40">
</td>
</tr>
<tr>
<td>
<h3>SABnzbd Category:</h3><input type="text" name="sab_category" value="${config['sab_cat']}" size="20" maxlength="40">
</td>
<td>
<h3>Music Download Directory:</h3><input type="text" name="download_dir" value="${config['download_dir']}" size="50"><br>
<i class="smalltext">Full path to the directory where SAB downloads your music<br>
i.e. /Users/name/Downloads/music</i>
</td>
</tr>
<tr>
<td>
<h3>Use Black Hole:</h3><input type="checkbox" name="blackhole" value=1 ${config['use_blackhole']} />
</td>
<td>
<h3>Black Hole Directory:</h3><input type="text" name="blackhole_dir" value="${config['blackhole_dir']}" size="50"><br>
<i class="smalltext">Folder your Download program watches for NZBs</i>
</td>
</tr>
<tr>
<td>
<h3>Usenet Retention:</h3><input type="text" name="usenet_retention" value="${config['usenet_retention']}" size="20" maxlength="40">
</td>
</tr>
</table>
</div>
<div class="table_wrapper">
<a name="providers"><h1><u>Search Providers</u></h1></a>
<table class="configtable" summary="Search Providers">
<tr>
<td id="middle">
<h3>NZBMatrix: <input type="checkbox" name="nzbmatrix" value="1" ${config['use_nzbmatrix']} /></h3>
</td>
<td>
<h3>NZBMatrix Username: </h3>
<input type="text" name="nzbmatrix_username" value="${config['nzbmatrix_user']}" size="30" maxlength="40">
</td>
<td>
<h3>NZBMatrix API: </h3>
<input type="text" name="nzbmatrix_apikey" value="${config['nzbmatrix_api']}" size="36" maxlength="40">
</td>
</tr>
<tr>
<td id="middle">
<h3>Newznab: <input type="checkbox" name="newznab" value="1" ${config['use_newznab']} /></h3>
</td>
<td>
<h3>Newznab Host: </h3>
<input type="text" name="newznab_host" value="${config['newznab_host']}" size="30" maxlength="40"><br>
<i class="smalltext">i.e. http://nzb.su</i>
</td>
<td>
<h3>Newznab API: </h3>
<input type="text" name="newznab_apikey" value="${config['newznab_api']}" size="36" maxlength="40">
</td>
</tr>
<tr>
<td id="middle">
<h3>NZBs.org: <input type="checkbox" name="nzbsorg" value="1" ${config['use_nzbsorg']} /></h3>
</td>
<td>
<h3>NZBs.org UID: </h3>
<input type="text" name="nzbsorg_uid" value="${config['nzbsorg_uid']}" size="30" maxlength="40">
</td>
<td>
<h3>NZBs.org Hash: </h3>
<input type="text" name="nzbsorg_hash" value="${config['nzbsorg_hash']}" size="36" maxlength="40">
</td>
</tr>
<tr>
<td id="middle">
<h3>Newzbin: <input type="checkbox" name="newzbin" value="1" ${config['use_newzbin']} /></h3>
</td>
<td>
<h3>Newzbin UID: </h3>
<input type="text" name="newzbin_uid" value="${config['newzbin_uid']}" size="30" maxlength="40">
</td>
<td>
<h3>Newzbin Password: </h3>
<input type="text" name="newzbin_password" value="${config['newzbin_pass']}" size="36" maxlength="40">
</td>
</tr>
</table>
</div>
<div class="table_wrapper">
<a name="post_processing"><h1><u>Quality &amp; Post Processing</u></h1></a>
<table class="configtable" summary="Quality & Post Processing">
<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>
<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
</td>
</tr>
<tr>
<td>
<br>
<h3>Path to Destination folder:</h3><input type="text" name="destination_dir" value="${config['dest_dir']}" size="50">
<br>
<i class="smalltext">i.e. /Users/name/Music/iTunes or /Volumes/share/music</i>
</td>
</tr>
</table>
</div>
<div class="table_wrapper">
<a name="advanced_settings"><h1><u>Advanced Settings</u></h1></a>
<table class="configtable" summary="Advanced Settings">
<tr>
<td>
<h2>Renaming Options:</h2>
<br>
<h3>Folder Format:</h3><input type="text" name="folder_format" value="${config['folder_format']}" size="43">
<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>
<h3>File Format:</h3><input type="text" name="file_format" value="${config['file_format']}" size="43">
<br>
<i class="smalltext">Use: tracknumber, title, artist, album and year</i>
</td>
<td>
<h2>Miscellaneous:</h2>
<br>
<h3><input type="checkbox" name="include_extras" value="1" ${config['include_extras']} />Automatically Include Extras When Adding an Artist</h3>
<i class="smalltext">(EPs, Compilations, Live Albums, Remix Albums and Singles)</i>
<br><br>
<h3>Interface: <select name="interface"><h3>
%for interface in config['interface_list']:
<%
if interface == headphones.INTERFACE:
selected = 'selected="selected"'
else:
selected = ''
%>
<option value="${interface}" ${selected}>${interface}</option>
%endfor
</select>
<br><br>
<h3>Log Directory:</h3><input type="text" name="log_dir" value="${config['log_dir']}" size="50">
</td>
</tr>
</table>
</div>
<p class="center"><input type="submit" value="Save Changes"><br>
(Web Interface changes require a restart to take effect)</h3>
</form>
</%def>

View File

@@ -0,0 +1,13 @@
<%inherit file="base.html" />
<%def name="body()">
<div class="table_wrapper">
<h1>Artists You Might Like</h1>
<div class="cloudtag">
<ul id="cloud">
%for artist in cloudlist:
<li><a href="addArtist?artistid=${artist['ArtistID']}" class="tag${artist['Count']}">${artist['ArtistName']}</a></li>
%endfor
</ul>
</div>
</div>
</%def>

View File

@@ -0,0 +1,79 @@
<%inherit file="base.html"/>
<%!
from headphones import helpers
%>
<%def name="headerIncludes()">
<div id="subhead_container">
<ul id="subhead_menu">
<li><a href="clearhistory?type=all">Clear All History</a></li>
<li><a href="clearhistory?type=Processed">Clear Processed</a></li>
<li><a href="clearhistory?type=Unprocessed">Clear Unprocessed</a></li>
<li><a href="clearhistory?type=Snatched">Clear Snatched</a></li>
</ul>
</div>
</%def>
<%def name="body()">
<div id="paddingheader">
History
</div>
<table class="display" id="history_table">
<thead>
<tr>
<th id="dateadded">Date Added</th>
<th id="filename">File Name</th>
<th id="size">Size</th>
<th id="status">Status</th>
<th id="action"></th>
</tr>
</thead>
<tbody>
%for item in history:
<%
if item['Status'] == 'Processed':
grade = 'A'
elif item['Status'] == 'Snatched':
grade = 'C'
elif item['Status'] == 'Unprocessed':
grade = 'X'
else:
grade = 'U'
%>
<tr class="grade${grade}">
<td id="dateadded">${item['DateAdded']}</td>
<td id="filename"><a href="${item['URL']}">${item['Title']}</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>
</tr>
%endfor
</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()
{
$('#history_table').dataTable(
{
"oLanguage": {
"sLengthMenu":"Show _MENU_ items per page",
"sEmptyTable": "No History to Display",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ items",
"sInfoEmpty":"Showing 0 to 0 of 0 items",
"sInfoFiltered":"(filtered from _MAX_ total items)"},
"bStateSave": true,
"iDisplayLength": 25,
"sPaginationType": "full_numbers"
});
});
</script>
</%def>

View File

@@ -0,0 +1,86 @@
<%inherit file="base.html"/>
<%!
from headphones import helpers
%>
<%def name="body()">
<table class="display" id="artist_table">
<thead>
<tr>
<th id="name">Artist Name</th>
<th id="status">Status</th>
<th id="album">Latest Album</th>
<th id="have">Have</th>
</tr>
</thead>
<tbody>
%for artist in artists:
<%
totaltracks = artist['TotalTracks']
havetracks = artist['HaveTracks']
if not havetracks:
havetracks = 0
try:
percent = (havetracks*100.0)/totaltracks
if percent > 100:
percent = 100
except (ZeroDivisionError, TypeError):
percent = 0
totaltracks = '?'
if artist['ReleaseDate'] and artist['LatestAlbum']:
releasedate = artist['ReleaseDate']
albumdisplay = '<i>%s</i> (%s)' % (artist['LatestAlbum'], artist['ReleaseDate'])
if releasedate > helpers.today():
grade = 'A'
else:
grade = 'Z'
elif artist['LatestAlbum']:
releasedate = ''
grade = 'Z'
albumdisplay = '<i>%s</i>' % artist['LatestAlbum']
else:
releasedate = ''
grade = 'Z'
albumdisplay = '<i>None</i>'
if artist['Status'] == 'Paused':
grade = 'X'
%>
<tr class="grade${grade}">
<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>
<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
</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()
{
$('#artist_table').dataTable(
{
"aoColumns": [
{ "sType": "title-string"},
null,
{ "sType": "title-string"},
{ "sType": "title-numeric"}
],
"bStateSave": true,
"iDisplayLength": 50,
"sPaginationType": "full_numbers",
});
});
</script>
</%def>

View File

@@ -0,0 +1,60 @@
<%inherit file="base.html"/>
<%!
from headphones import helpers
%>
<%def name="body()">
<table class="display" id="log_table">
<thead>
<tr>
<th id="timestamp">Timestamp</th>
<th id="level">Level</th>
<th id="message">Message</th>
</tr>
</thead>
<tbody>
%for line in lineList:
<%
timestamp, message, level, threadname = line
if level == 'WARNING' or level == 'ERROR':
grade = 'X'
else:
grade = 'Z'
%>
<tr class="grade${grade}">
<td id="timestamp">${timestamp}</td>
<td id="level">${level}</td>
<td id="message">${message}</td>
</tr>
%endfor
</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()
{
$('#log_table').dataTable(
{
"oLanguage": {
"sLengthMenu":"Show _MENU_ lines per page",
"sEmptyTable": "No log information available",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ lines",
"sInfoEmpty":"Showing 0 to 0 of 0 lines",
"sInfoFiltered":"(filtered from _MAX_ total lines)"},
"bStateSave": true,
"iDisplayLength": 100,
"sPaginationType": "full_numbers",
"aaSorting": []
});
});
</script>
</%def>

View File

@@ -0,0 +1,57 @@
<%inherit file="base.html" />
<%!
import headphones
%>
<%def name="body()">
<div class="table_wrapper">
<h1>Scan Music Library</h1><br />
Where do you keep your music?<br /><br />
You can put in any directory, and it will scan for audio files in that folder
(including all subdirectories)<br /><br /> For example: '/Users/name/Music'
<br /> <br />
It may take a while depending on how many files you have. You can navigate away from the page<br />
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_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">
<%
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 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 class="table_wrapper">
<h1>Force Search</h1><br />
<h3><a href="forceSearch">Force Check for Wanted Albums</a></h3>
<h3><a href="forceUpdate">Force Update Active Artists</a></h3>
<h3><a href="forcePostProcess">Force Post-Process Albums in Download Folder</a></h3><br><br>
<h3><a href="checkGithub">Check for Headphones Updates</a></h3>
</div>
</%def>

View File

@@ -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>

View File

@@ -0,0 +1,13 @@
<%inherit file="base.html"/>
<%def name="headIncludes()">
<meta http-equiv="refresh" content="${timer};url=index">
</%def>
<%def name="body()">
<div class="table_wrapper">
<div id="shutdown">
<h1>Headphones is ${message}</h1>
</div>
</div>
</%def>

298
data/interfaces/remix/style.css Executable file
View File

@@ -0,0 +1,298 @@
/* HTML5 ✰ Boilerplate */
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ''; content: none; }
ins { background-color: #ff9; color: #000; text-decoration: none; }
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
del { text-decoration: line-through; }
abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
table { border-collapse: collapse; border-spacing: 0; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
input, select { vertical-align: middle; }
body { font:13px/1.231 sans-serif; *font-size:small; }
select, input, textarea, button { font:99% sans-serif; }
pre, code, kbd, samp { font-family: monospace, sans-serif; }
html { overflow-y: scroll; }
a:hover, a:active { outline: none; }
ul, ol { margin-left: 2em; }
ol { list-style-type: decimal; }
nav ul, nav li { margin: 0; list-style:none; list-style-image: none; }
small { font-size: 85%; }
strong, th { font-weight: bold; }
td { vertical-align: top; }
sub, sup { font-size: 75%; line-height: 0; position: relative; }
sup { top: -0.5em; }
sub { bottom: -0.25em; }
pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; padding: 15px; }
textarea { overflow: auto; }
.ie6 legend, .ie7 legend { margin-left: -7px; }
input[type="radio"] { vertical-align: text-bottom; }
input[type="checkbox"] { vertical-align: bottom; }
.ie7 input[type="checkbox"] { vertical-align: baseline; }
.ie6 input { vertical-align: text-bottom; }
label, input[type="button"], input[type="submit"], input[type="image"], button { cursor: pointer; }
button, input, select, textarea { margin: 0; }
input:valid, textarea:valid { }
input:invalid, textarea:invalid { border-radius: 1px; -moz-box-shadow: 0px 0px 5px red; -webkit-box-shadow: 0px 0px 5px red; box-shadow: 0px 0px 5px red; }
.no-boxshadow input:invalid, .no-boxshadow textarea:invalid { background-color: #f0dddd; }
::-moz-selection{ background: grey; color:#fff; text-shadow: none; }
::selection { background: grey; color:#fff; text-shadow: none; }
button { width: auto; overflow: visible; }
.ie7 img { -ms-interpolation-mode: bicubic; }
body, select, input, textarea { color: #444; }
h1, h2, h3, h4, h5, h6 { font-weight: bold; }
/*
// ========================================== \\
|| ||
|| Custom Styles ||
|| ||
\\ ========================================== //
*/
a:link {
color: orange;
text-decoration: none;
}
a:visited {
color: orange;
text-decoration: none;
}
a:hover { /*this effect is not shown in NN4.xx*/
color: #999999;
text-decoration: underline;
}
a:active {/*colour in NN4.xx is red*/
color: #5E2612;
text-decoration: underline;
}
a.blue {
color: blue;
}
container { }
body { background-color: black; min-width: 935px; }
header { min-height: 68px; width: 100%; min-width: 935px; padding-left: 0px; padding-right: 10px; background-color: #black; position: fixed; z-index: 998; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p.indented { padding-top: 20px; margin-left: 20px; font-size: 14px; }
p.center { text-align: center; font-size: 18px; }
.smalltext2 { font-size: 11px; margin-left: 45px; }
div#updatebar { text-align: center; min-width: 970px; width: 100%; background-color: light-blue; float: left; }
div#logo { float: left; padding-left: 10px; }
ul#nav { margin: 25px 0 0 0; float: left; list-style-type: none; }
ul#nav li { margin: 40px 0px auto 10px; display: inline; }
ul#nav li a { padding: 5px; font-size: 16px; font-weight: bold; color: white; text-decoration: none; }
ul#nav li a:hover { background-color: #a3e532; }
div#subhead_container { height: 30px; width:100%; min-width: 1000px; background-color: blue; float: left; list-style-type: none; z-index: 998; overflow: hidden; }
ul#subhead_menu { margin-top: 5px; }
ul#subhead_menu li { width: 100%; height: 100%; display: inline; }
ul#subhead_menu li a { padding: 5px 15px 10px 15px; vertical-align: middle; color: white; font-size: 16px; text-decoration: none; }
ul#subhead_menu li a:hover { width: 100%; height: 100%; background-color: #grey; }
div#searchbar { margin: 24px 30px auto auto; float: right; }
div#main { margin: 0; padding: 80px 0 0 0; }
.table_wrapper { border-radius: 20px; -webkit-border-radius: 20px; -moz-border-radius: 20px; width: 88%; margin: 20px auto 0 auto; padding: 25px; background-color: white; position: relative; min-height: 200px; clear: both; _height: 302px; zoom: 1; }
.manage_wrapper { width: 88%; margin: 20px auto 0 auto; padding: 25px; min-height: 150px; clear: both; _height: 302px; zoom: 1; }
.table_wrapper_left { padding: 25px; background-color: #ffffff; float: left; width: 40%; min-height: 100px; margin-top: 25px; margin-left: 30px; margin-right: auto; -moz-border-radius: 20px; border-radius: 20px; }
.table_wrapper_right{ padding: 25px; background-color: #ffffff; width: 40%; min-height: 100px; margin-top: 25px; margin-left: auto; margin-right: 30px; -moz-border-radius: 20px; border-radius: 20px; }
.configtable { font-size: 14px; line-height:18px; }
.configtable td { width: 350px; padding: 10px; }
.configtable td#middle { vertical-align: middle; }
table#artist_table { background-color: white; width: 100%; padding: 20px; }
table#artist_table th#name { text-align: left; min-width: 200px; }
table#artist_table th#status { text-align: left; min-width: 50px; }
table#artist_table th#album { text-align: left; min-width: 300px; }
table#artist_table th#have { text-align: center; }
table#artist_table td#name { vertical-align: middle; text-align: left; min-width:200px; }
table#artist_table td#status { vertical-align: middle; text-align: left; min-width: 50px; }
table#artist_table td#album { vertical-align: middle; text-align: left; min-width: 300px; }
table#artist_table td#have { vertical-align: middle; }
div#paddingheader { padding-top: 48px; font-size: 24px; font-weight: bold; text-align: center; }
div#nopaddingheader { font-size: 24px; font-weight: bold; text-align: center; }
table#album_table { background-color: white; }
table#album_table th#select { vertical-align: middle; text-align: left; min-width: 25px; }
table#album_table th#albumart { text-align: left; min-width: 50px; }
table#album_table th#albumname { text-align: center; min-width: 150px; }
table#album_table th#reldate { width: 175px; text-align: center; min-width: 100px; }
table#album_table th#status { width: 175px; text-align: center; min-width: 100px; }
table#album_table th#type { width: 175px; text-align: center; min-width: 100px; }
table#album_table td#select { vertical-align: middle; text-align: left; }
table#album_table td#albumart { vertical-align: middle; text-align: left; }
table#album_table td#albumname { vertical-align: middle; text-align: center; }
table#album_table td#reldate { vertical-align: middle; text-align: center; }
table#album_table td#status { vertical-align: middle; text-align: center; }
table#album_table td#type { vertical-align: middle; text-align: center; }
table#album_table td#have { vertical-align: middle; }
img.albumArt { float: left; padding-right: 5px; }
div#albumheader { padding-top: 48px; height: 200px; }
div#track_wrapper { padding-top: 20px; text-align: center; font-size: 16px; }
table#track_table th#number { text-align: right; min-width: 20px; }
table#track_table th#name { text-align: center; min-width: 350px; }
table#track_table th#duration { width: 175px; text-align: center; min-width: 100px; }
table#track_table th#have { width: 175px; text-align: center; min-width: 100px; }
table#track_table td#number { vertical-align: middle; text-align: right; }
table#track_table td#name { vertical-align: middle; text-align: center; }
table#track_table td#duration { vertical-align: middle; text-align: center; }
table#track_table td#have { vertical-align: middle; text-align: center; }
table#history_table { background-color: white; width: 100%; }
table#log_table { background-color: white; }
table#log_table th#timestamp { text-align: left; min-width: 150px; }
table#log_table th#level { text-align: left; min-width: 60px; }
table#log_table th#message { text-align: left; min-width: 500px; }
table#upcoming_table th#albumart { text-align: center; min-width: 50px; }
table#upcoming_table th#albumname { text-align: center; min-width: 200px; }
table#upcoming_table th#artistname { text-align: center; min-width: 150px; }
table#upcoming_table th#reldate { text-align: center; min-width: 100px; }
table#upcoming_table th#type { text-align: center; min-width: 75px; }
table#upcoming_table td#select { vertical-align: middle; text-align: center; }
table#upcoming_table td#albumart { vertical-align: middle; text-align: center; min-width: 50px; }
table#upcoming_table td#albumname { vertical-align: middle; text-align: center; min-width: 200px; }
table#upcoming_table td#artistname { vertical-align: middle; text-align: center; min-width: 150px; }
table#upcoming_table td#reldate { vertical-align: middle; text-align: center; min-width: 100px; }
table#upcoming_table td#type { vertical-align: middle; text-align: center; min-width: 75px; }
table#upcoming_table td#status { vertical-align: middle; text-align: center; }
table#wanted_table th#albumart { text-align: center; min-width: 50px; }
table#wanted_table th#albumname { text-align: center; min-width: 200px; }
table#wanted_table th#artistname { text-align: center; min-width: 150px; }
table#wanted_table th#reldate { text-align: center; min-width: 100px; }
table#wanted_table th#type { text-align: center; min-width: 75px; }
table#wanted_table td#select { vertical-align: middle; text-align: center; }
table#wanted_table td#albumart { vertical-align: middle; text-align: center; min-width: 50px; }
table#wanted_table td#albumname { vertical-align: middle; text-align: center; min-width: 200px; }
table#wanted_table td#artistname { vertical-align: middle; text-align: center; min-width: 150px; }
table#wanted_table td#reldate { vertical-align: middle; text-align: center; min-width: 100px; }
table#wanted_table td#type { vertical-align: middle; text-align: center; min-width: 75px; }
table#wanted_table td#status { vertical-align: middle; text-align: center; }
table#searchresults_table th#albumname { text-align: left; min-width: 225px; }
table#searchresults_table th#artistname { text-align: center; min-width: 325px; }
table#searchresults_table th#score { text-align: center; min-width: 75px; }
table#searchresults_table td#albumname { vertical-align: middle; text-align: left; min-width: 200px; }
table#searchresults_table td#artistname { vertical-align: middle; text-align: left; min-width: 300px; }
table#searchresults_table td#score { vertical-align: middle; text-align: center; min-width: 75px; }
div.progress-container { border: 1px solid #ccc; width: 100px; height: 14px; margin: 2px 5px 2px 0; padding: 1px; float: left; background: white; }
div.progress-container > div { background-color: #a3e532; height: 14px; }
.havetracks { font-size: 13px; margin-left: 36px; padding-bottom: 3px; vertical-align: middle; }
footer { margin: 20px auto 20px auto; }
div#version { text-align: center; font-weight: bold; }
div#donate { text-align: center; margin: 20px auto 20px auto; }
div#shutdown{ text-align: center; vertical-align: middle; }
.cloudtag { padding-top: 30px; font-size:16px; }
#cloud a.tag1 { font-size: 0.7em; font-weight: 100; }
#cloud a.tag2 { font-size: 0.8em; font-weight: 200; }
#cloud a.tag3 { font-size: 0.9em; font-weight: 300; }
#cloud a.tag4 { font-size: 1.0em; font-weight: 400; }
#cloud a.tag5 { font-size: 1.2em; font-weight: 500; }
#cloud a.tag6 { font-size: 1.4em; font-weight: 600; }
#cloud a.tag7 { font-size: 1.6em; font-weight: 700; }
#cloud a.tag8 { font-size: 1.8em; font-weight: 800; }
#cloud a.tag9 { font-size: 2.2em; font-weight: 900; }
#cloud a.tag10 { font-size: 2.5em; font-weight: 900; }
#cloud { padding: 2px; line-height: 1.5em; text-align: center; }
#cloud a { padding: 0px; }
#cloud { margin: 0; }
#cloud li { display: inline; }
.ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }
.hidden { display: none; visibility: hidden; }
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.invisible { visibility: hidden; }
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }
@media all and (orientation:portrait) {
}
@media all and (orientation:landscape) {
}
@media screen and (max-device-width: 480px) {
html { -webkit-text-size-adjust:none; -ms-text-size-adjust:none; }
}
@media print {
* { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important;
-ms-filter: none !important; }
a, a:visited { color: #444 !important; text-decoration: underline; }
a[href]:after { content: " (" attr(href) ")"; }
abbr[title]:after { content: " (" attr(title) ")"; }
.ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; }
pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
thead { display: table-header-group; }
tr, img { page-break-inside: avoid; }
@page { margin: 0.5cm; }
p, h2, h3 { orphans: 3; widows: 3; }
h2, h3{ page-break-after: avoid; }
}

View File

@@ -0,0 +1,86 @@
<%inherit file="base.html" />
<%def name="body()">
<div class="table_wrapper">
<h1>Upcoming Albums</h1>
<table class="display" id="upcoming_table">
<thead>
<tr>
<th id="albumart"></th>
<th id="artistname">Artist</th>
<th id="albumname">Album Name</th>
<th id="reldate">Release Date</th>
<th id="type">Type</th>
<th id="status">Status</th>
</tr>
</thead>
<tbody>
%for album in upcoming:
<tr class="gradeZ">
<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>
</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="wanted_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">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>
</tr>
%endfor
</tbody>
</table>
</div>
</%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()
{
$('#wanted_table').dataTable(
{
"bFilter": false,
"bInfo": false,
"bPaginate": false
});
});
</script>
</%def>

View File

@@ -104,6 +104,8 @@ LASTFM_USERNAME = None
MEDIA_FORMATS = ["mp3", "flac", "aac", "ogg", "ape", "m4a"]
INTERFACE = None
def CheckSection(sec):
""" Check if INI section exists, if not create it """
try:
@@ -161,7 +163,7 @@ def initialize():
ADD_ALBUM_ART, EMBED_ALBUM_ART, DOWNLOAD_DIR, BLACKHOLE, BLACKHOLE_DIR, USENET_RETENTION, NZB_SEARCH_INTERVAL, \
LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, \
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE
if __INITIALIZED__:
return False
@@ -237,6 +239,8 @@ def initialize():
NEWZBIN_PASSWORD = check_setting_str(CFG, 'Newzbin', 'newzbin_password', '')
LASTFM_USERNAME = check_setting_str(CFG, 'General', 'lastfm_username', '')
INTERFACE = check_setting_str(CFG, 'General', 'interface', 'default')
if not LOG_DIR:
LOG_DIR = os.path.join(DATA_DIR, 'logs')
@@ -403,6 +407,7 @@ def config_write():
new_config['Newzbin']['newzbin_password'] = NEWZBIN_PASSWORD
new_config['General']['lastfm_username'] = LASTFM_USERNAME
new_config['General']['interface'] = INTERFACE
new_config.write()
@@ -436,6 +441,7 @@ def dbcheck():
c.execute('CREATE TABLE IF NOT EXISTS have (ArtistName TEXT, AlbumTitle TEXT, TrackNumber TEXT, TrackTitle TEXT, TrackLength TEXT, BitRate TEXT, Genre TEXT, Date TEXT, TrackID TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS lastfmcloud (ArtistName TEXT, ArtistID TEXT, Count INTEGER)')
c.execute('CREATE TABLE IF NOT EXISTS descriptions (ReleaseGroupID TEXT, ReleaseID TEXT, Summary TEXT, Content TEXT)')
c.execute('CREATE TABLE IF NOT EXISTS releases (ReleaseID TEXT, ReleaseGroupID TEXT, UNIQUE(ReleaseID, ReleaseGroupID))')
try:
c.execute('SELECT IncludeExtras from artists')

View File

@@ -259,29 +259,39 @@ def addArtisttoDB(artistid, extrasonly=False):
logger.info(u"Updating complete for: " + artist['artist_name'])
def addReleaseById(rid):
myDB = db.DBConnection()
#we have to make a call to get the release no matter what so we can get the RGID
#need a way around this - a local cache maybe in the future maybe?
try:
release_dict = mb.getRelease(rid)
except Exception, e:
logger.info('Unable to get release information for Release: ' + str(rid) + " " + str(e))
return
if not release_dict:
logger.info('Unable to get release information for Release: ' + str(rid) + " no dict")
return
rgid = release_dict['rgid']
rgid = None
artistid = None
release_dict = None
results = myDB.select("SELECT albums.ArtistID, releases.ReleaseGroupID from releases, albums WHERE releases.ReleaseID=? and releases.ReleaseGroupID=albums.AlbumID LIMIT 1", [rid])
for result in results:
rgid = result['ReleaseGroupID']
artistid = result['ArtistID']
logger.debug("Found a cached releaseid : releasegroupid relationship: " + rid + " : " + rgid)
if not rgid:
#didn't find it in the cache, get the information from MB
logger.debug("Didn't find releaseID " + rid + " in the cache. Looking up its ReleaseGroupID")
try:
release_dict = mb.getRelease(rid)
except Exception, e:
logger.info('Unable to get release information for Release: ' + str(rid) + " " + str(e))
return
if not release_dict:
logger.info('Unable to get release information for Release: ' + str(rid) + " no dict")
return
rgid = release_dict['rgid']
artistid = release_dict['artist_id']
#we don't want to make more calls to MB here unless we have to, could be happening quite a lot
#TODO: why do I have to str() this here? I don't get it.
rg_exists = myDB.select("SELECT * from albums WHERE AlbumID=?", [rgid])
#make sure the artist exists since I don't know what happens later if it doesn't
artist_exists = myDB.select("SELECT * from artists WHERE ArtistID=?", [release_dict['artist_id']])
if not artist_exists:
artist_exists = myDB.select("SELECT * from artists WHERE ArtistID=?", [artistid])
if not artist_exists and release_dict:
if release_dict['artist_name'].startswith('The '):
sortname = release_dict['artist_name'][4:]
else:
@@ -299,8 +309,13 @@ def addReleaseById(rid):
newValueDict['IncludeExtras'] = 1
myDB.upsert("artists", newValueDict, controlValueDict)
if not rg_exists:
elif not artist_exists and not release_dict:
logger.error("Artist does not exist in the database and did not get a valid response from MB. Skipping release.")
return
if not rg_exists and release_dict: #it should never be the case that we have an rg and not the artist
#but if it is this will fail
logger.info(u"Now adding-by-id album (" + release_dict['title'] + ") from id: " + rgid)
controlValueDict = {"AlbumID": rgid}
@@ -315,11 +330,14 @@ def addReleaseById(rid):
}
myDB.upsert("albums", newValueDict, controlValueDict)
#keep a local cache of these so that external programs that are adding releasesByID don't hammer MB
myDB.action('INSERT INTO releases VALUES( ?, ?)', [rid, release_dict['rgid']])
for track in release_dict['tracks']:
controlValueDict = {"TrackID": track['id'],
"AlbumID": release_dict['rgid']}
"AlbumID": rgid}
newValueDict = {"ArtistID": release_dict['artist_id'],
"ArtistName": release_dict['artist_name'],
"AlbumTitle": release_dict['rg_title'],
@@ -330,10 +348,12 @@ def addReleaseById(rid):
}
myDB.upsert("tracks", newValueDict, controlValueDict)
#start a search for the album
import searcher
searcher.searchNZB(rgid, False)
elif not rg_exists and not release_dict:
logger.error("ReleaseGroup does not exist in the database and did not get a valid response from MB. Skipping release.")
return
else:
logger.info('Release ' + str(rid) + " already exists in the database!")

View File

@@ -111,6 +111,12 @@ def verify(albumid, albumpath):
tracks = myDB.select('SELECT * from tracks WHERE AlbumID=?', [albumid])
downloaded_track_list = []
try:
albumpath = str(albumpath)
except UnicodeEncodeError:
albumpath = unicode(albumpath).encode('unicode_escape')
for r,d,f in os.walk(albumpath):
for files in f:
if any(files.endswith('.' + x) for x in headphones.MEDIA_FORMATS):

View File

@@ -74,17 +74,22 @@ def searchNZB(albumid=None, new=False):
dic = {'...':'', ' & ':' ', ' = ': ' ', '?':'', '$':'s', ' + ':' ', '"':'', ',':''}
cleanartistalbum = helpers.latinToAscii(helpers.replace_all(albums[0]+' '+albums[1], dic))
cleanalbum = helpers.latinToAscii(helpers.replace_all(albums[1], dic))
cleanartist = helpers.latinToAscii(helpers.replace_all(albums[0], dic))
# FLAC usually doesn't have a year for some reason so I'll leave it out:
term = re.sub('[\.\-\/]', ' ', '%s' % (cleanartistalbum)).encode('utf-8')
altterm = re.sub('[\.\-\/]', ' ', '%s %s' % (cleanartistalbum, year)).encode('utf-8')
artistterm = re.sub('[\.\-\/]', ' ', '%s' % (cleanartist)).encode('utf-8')
# FLAC usually doesn't have a year for some reason so I'll leave it out
# Various Artist albums might be listed as VA, so I'll leave that out too
# Only use the year if the term could return a bunch of different albums, i.e. self-titled albums
if albums[0] in albums[1] or len(albums[0]) < 4 or len(albums[1]) < 4:
term = altterm
term = cleanartist + ' ' + cleanalbum + ' ' + year
elif albums[0] == 'Various Artists':
term = cleanalbum + ' ' + year
else:
term = cleanartist + ' ' + cleanalbum
# Replace bad characters in the term and unicode it
term = re.sub('[\.\-\/]', ' ', term).encode('utf-8')
artistterm = re.sub('[\.\-\/]', ' ', cleanartist).encode('utf-8')
logger.info("Searching for %s since it was marked as wanted" % term)
@@ -443,7 +448,7 @@ def verifyresult(title, term):
return True
def getresultNZB(result):
if result[3] == 'Newzbin':
if result[3] == 'newzbin':
params = urllib.urlencode({"username": headphones.NEWZBIN_UID, "password": headphones.NEWZBIN_PASSWORD, "reportid": result[2]})
url = "https://www.newzbin.com" + "/api/dnzb/"
urllib._urlopener = NewzbinDownloader()
@@ -453,12 +458,18 @@ def getresultNZB(result):
logger.warn('Error fetching nzb from url: %s. Error: %s' % (url, e))
else:
try:
nzb = urllib2.urlopen(result[2], timeout=20).read()
except Exception, e:
logger.warn('Error fetching nzb from url: %s. Error: %s' % (result[2], e))
nzb = urllib2.urlopen(result[2], timeout=30).read()
except urllib2.URLError, e:
logger.warn('Error fetching nzb from url: ' + result[2] + ' %s' % e)
return nzb
def preprocess(resultlist):
if not headphones.USENET_RETENTION:
usenet_retention = 1000
else:
usenet_retention = int(headphones.USENET_RETENTION)
for result in resultlist:
nzb = getresultNZB(result)
if nzb:
@@ -467,7 +478,7 @@ def preprocess(resultlist):
node = d.documentElement
nzbfiles = d.getElementsByTagName("file")
for nzbfile in nzbfiles:
if nzbfile.getAttribute("date") < (time.time() - int(headphones.USENET_RETENTION) * 86400):
if nzbfile.getAttribute("date") < (time.time() - usenet_retention * 86400):
logger.error('NZB contains a file out of your retention. Skipping.')
continue
#TODO: Do we want rar checking in here to try to keep unknowns out?
@@ -478,4 +489,4 @@ def preprocess(resultlist):
return nzb, result
else:
logger.error("Couldn't retrieve the best nzb. Skipping.")
return (False, False)
return (False, False)

View File

@@ -17,7 +17,9 @@ from headphones.helpers import checked, radio
def serve_template(templatename, **kwargs):
template_dir = os.path.join(str(headphones.PROG_DIR), 'data/interfaces/default/')
interface_dir = os.path.join(str(headphones.PROG_DIR), 'data/interfaces/')
template_dir = os.path.join(str(interface_dir), headphones.INTERFACE)
_hplookup = TemplateLookup(directories=[template_dir])
try:
@@ -246,6 +248,10 @@ class WebInterface(object):
clearhistory.exposed = True
def config(self):
interface_dir = os.path.join(headphones.PROG_DIR, 'data/interfaces/')
interface_list = [ name for name in os.listdir(interface_dir) if os.path.isdir(os.path.join(interface_dir, name)) ]
config = {
"http_host" : headphones.HTTP_HOST,
"http_user" : headphones.HTTP_USERNAME,
@@ -289,7 +295,8 @@ class WebInterface(object):
"folder_format" : headphones.FOLDER_FORMAT,
"file_format" : headphones.FILE_FORMAT,
"include_extras" : checked(headphones.INCLUDE_EXTRAS),
"log_dir" : headphones.LOG_DIR
"log_dir" : headphones.LOG_DIR,
"interface_list" : interface_list
}
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True
@@ -299,7 +306,7 @@ class WebInterface(object):
sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, download_dir=None, blackhole=0, blackhole_dir=None,
usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, newznab=0, newznab_host=None, newznab_apikey=None,
nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, newzbin=0, newzbin_uid=None, newzbin_password=None, preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0,
rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, log_dir=None):
rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, interface=None, log_dir=None):
headphones.HTTP_HOST = http_host
headphones.HTTP_PORT = http_port
@@ -340,6 +347,7 @@ class WebInterface(object):
headphones.FOLDER_FORMAT = folder_format
headphones.FILE_FORMAT = file_format
headphones.INCLUDE_EXTRAS = include_extras
headphones.INTERFACE = interface
headphones.LOG_DIR = log_dir
headphones.config_write()

View File

@@ -22,6 +22,10 @@ def initialize(options={}):
'/': {
'tools.staticdir.root': os.path.join(headphones.PROG_DIR, 'data')
},
'/interfaces':{
'tools.staticdir.on': True,
'tools.staticdir.dir': "interfaces"
},
'/images':{
'tools.staticdir.on': True,
'tools.staticdir.dir': "images"