Added config, extras, manage, upcoming

This commit is contained in:
Remy
2011-08-07 01:31:38 -07:00
parent 74149a6d3c
commit ca7526262c
10 changed files with 458 additions and 176 deletions

View File

@@ -136,11 +136,11 @@ 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: center; min-width: 300px; }
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: center; min-width: 300px; }
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; }
@@ -190,6 +190,25 @@ footer { margin: 20px auto 20px auto; }
div#version { text-align: center; font-weight: bold; }
div#donate { text-align: center; margin: 20px auto 20px auto; }
.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; }

View File

@@ -0,0 +1,82 @@
<%inherit file="base.html" />
<%!
from headphones import db, helpers
myDB = db.DBConnection()
%>
<%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>
%else:
<li><a href="pauseArtist?ArtistID=${album['ArtistID']}">Pause Artist</a></li>
%endif
<li><a href="getExtras?ArtistID=${album['ArtistID']}">Get Extras</a></li>
</ul>
</div>
</%def>
<%def name="body()">
<div class="table_wrapper">
<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>
<h3>Description: </h3>
</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">Have</th>
</tr>
</thead>
<tbody>
%for track in tracks:
<%
trackmatch = 'asd'
if len(trackmatch):
grade = 'A'
check = '<img src="images/checkmark.png" alt="checkmark">'
else:
grade = 'Z'
check = ''
%>
<tr class="grade${grade}">
<td id="number">#</td>
<td id="name">${track['TrackTitle']}</td>
<td id="duration">${track['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

@@ -27,9 +27,17 @@
<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">
<img src="images/headphoneslogo.png" alt="headphones">
<a href="home"><img src="images/headphoneslogo.png" alt="headphones"></a>
</div>
<ul id="nav">
<li><a href="home">home</a></li>

View File

@@ -0,0 +1,224 @@
<%inherit file="base.html"/>
<form action="configUpdate" method="post">
<div class="table_wrapper">
<table class="configtable" summary="Web Interface">
<tr>
<td>
<p> HTTP Host: <br />
<input type="text" name="http_host" value="${config['http_host']}" size="30" maxlength="40"><br />
<i class="smalltext">e.g. localhost or 0.0.0.0</i>
</p>
</td>
<td>
<p>HTTP Username: <br />
<input type="text" name="http_username" value="${config['http_user']}" size="30" maxlength="40">
</p>
</td>
</tr>
<tr>
<td>
<p>HTTP Port: <br />
<input type="text" name="http_port" value="${config['http_port']}" size="20" maxlength="40">
</p>
</td>
<td>
<p>HTTP Password: <br />
<input type="password" name="http_password" value="${config['http_pass']}" size="30" maxlength="40">
</p>
</td>
</tr>
<tr>
<td>
<p>Launch Browser on Startup:<input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} /></p>
</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>
<p>SABnzbd Host:</p>
<input type="text" name="sab_host" value="${config['sab_host']}" size="30" maxlength="40"><br />
<i class="smalltext">e.g. localhost:8080</i>
</td>
<td>
<p>SABnzbd Username:</p>
<input type="text" name="sab_username" value="${config['sab_user']}" size="20" maxlength="40">
</td>
</tr>
<tr>
<td>
<p>SABnzbd API:</p>
<input type="text" name="sab_apikey" value="${config['sab_api']}" size="46" maxlength="40">
</td>
<td>
<p>SABnzbd Password:</p>
<input type="password" name="sab_password" value="${config['sab_pass']}" size="20" maxlength="40">
</td>
</tr>
<tr>
<td>
<p>SABnzbd Category:</p>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20" maxlength="40"></td>
<td>
<p>Music Download Directory:</p>
<input type="text" name="download_dir" value="${config['download_dir']}" size="60"><br />
<i class="smalltext">Full path to the directory where SAB downloads your music<br />
e.g. Downloads/music or /Users/name/Downloads/music</i>
</td>
</tr>
<tr>
<td>
<p>Use Black Hole:</p>
<input type="checkbox" name="blackhole" value=1 ${config['use_blackhole']} />
</td>
<td>
<p>Black Hole Directory:</p>
<input type="text" name="blackhole_dir" value="${config['blackhole_dir']}" size="60"><br />
<i class="smalltext">Folder your Download program watches for NZBs</i>
</td>
</tr>
<tr>
<td>
<p>Usenet Retention:</p>
<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>
<p>NZBMatrix: <input type="checkbox" name="nzbmatrix" value="1" ${config['use_nzbmatrix']} /></p>
</td>
<td>
<p>NZBMatrix Username: <br> <input type="text" name="nzbmatrix_username" value="${config['nzbmatrix_user']}" size="30" maxlength="40"></p>
</td>
<td>
<p>NZBMatrix API: <br> <input type="text" name="nzbmatrix_apikey" value="${config['nzbmatrix_api']}" size="46" maxlength="40"></p>
</td>
</tr>
<tr>
<td>
<p>Newznab: <input type="checkbox" name="newznab" value="1" ${config['use_newznab']} /></p>
</td>
<td>
<p>Newznab Host:<br> <input type="text" name="newznab_host" value="${config['newznab_host']}" size="30" maxlength="40"><br />
<i class="smalltext">i.e. http://nzb.su</i></p>
</td>
<td>
<p>Newznab API:<br> <input type="text" name="newznab_apikey" value="${config['newznab_api']}" size="46" maxlength="40"></p>
</td>
</tr>
<tr>
<td>
<p>NZBs.org:<input type="checkbox" name="nzbsorg" value="1" ${config['use_nzbsorg']} /></p>
</td>
<td>
<p>NZBs.org UID:<br> <input type="text" name="nzbsorg_uid" value="${config['nzbsorg_uid']}" size="30" maxlength="40"></p>
</td>
<td>
<p>NZBs.org Hash:<br> <input type="text" name="nzbsorg_hash" value="${config['nzbsorg_hash']}" size="46" maxlength="40"></p>
</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>
<b>Album Quality:</b>
<p>
<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_2']} />Lossless Only<br />
<input type="radio" name="preferred_quality" value="2" ${config['pref_qual_3']} />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>
</p>
</td>
<td>
<b>Post-Processing:</b>
<p>
<input type="checkbox" name="move_files" value="1" ${config['move_files']} />Move downloads to Music Folder<br />
<input type="checkbox" name="rename_files" value="1" ${config['rename_files']} />Rename &amp; add metadata<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<br />
<input type="checkbox" name="add_album_art" value="1" ${config['add_album_art']} />Add album art<br />
<input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']} />Embed album art in each file<br />
</p>
</td>
</tr>
<tr>
<td>
<p>
<b>Path to Music folder</b>:<br />
<input type="text" name="destination_dir" value="${config['dest_dir']}" size="60" maxlength="200"> <br />
<i class="smalltext">e.g. /Users/name/Music/iTunes or /Volumes/share/music</i>
</p>
</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>
<b>Renaming Options:</b>
<p>
<b>Folder Format</b>:<br />
<input type="text" name="folder_format" value="${config['folder_format']}" size="60">
<br />
<i class="smalltext">Use: artist, album and year, '/' for directories. <br />E.g.: artist/album [year]</i>
</p>
<p>
<b>File Format</b>:<br />
<input type="text" name="file_format" value="${config['file_format']}" size="60">
<br>
<i class="smalltext">Use: tracknumber, title, artist, album and year</i>
</p>
</td>
<td>
<b>Miscellaneous:</b>
<p>
<input type="checkbox" name="include_extras" value="1" ${config['include_extras']} />Automatically Include Extras When Adding an Artist<br />
<i class="smalltext">Extras includes: EPs, Compilations, Live Albums, Remix Albums and Singles</i>
</p>
<b>Log Directory</b>:
<p>
<input type="text" name="log_dir" value="${config['log_dir']}" size="40" />
</p>
</td>
</tr>
</table>
</div>
<p class="center">
<input type="submit" value="Save Changes"><br />
(Web Interface changes require a restart to take effect)
</p>
</form>
</div>
</div>
<%inherit file="base.html" />

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

@@ -4,9 +4,9 @@
<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>
<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>

View File

@@ -30,7 +30,7 @@
if artist['ReleaseDate'] and artist['LatestAlbum']:
releasedate = artist['ReleaseDate']
albumdisplay = '%s (%s)' % (artist['LatestAlbum'], artist['ReleaseDate'])
albumdisplay = '<i>%s</i> (%s)' % (artist['LatestAlbum'], artist['ReleaseDate'])
if releasedate > helpers.today():
grade = 'A'
else:
@@ -38,21 +38,21 @@
elif artist['LatestAlbum']:
releasedate = ''
grade = 'Z'
albumdisplay = artist['LatestAlbum']
albumdisplay = '<i>%s</i>' % artist['LatestAlbum']
else:
releasedate = ''
grade = 'Z'
albumdisplay = 'None'
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="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>
<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>

View File

@@ -0,0 +1,33 @@
<%inherit file="base.html" />
<%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">
<input type="submit" /></form>
</div>
<div class="table_wrapper">
<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
(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 />
<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 />
<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))
</%def>

View File

@@ -0,0 +1,14 @@
<%inherit file="base.html" />
<%def name="body()">
<div class="table_wrapper">
<h1>Upcoming Albums</h1>
%for album in wanted:
%endfor
</div>
<div class="table_wrapper">
<h1>Wanted Albums</h1>
</div>
</%def>

View File

@@ -10,10 +10,11 @@ import threading
import headphones
from headphones.mb import getReleaseGroup
from headphones import templates, logger, searcher, db, importer, helpers, mb, lastfm
from headphones import logger, searcher, db, importer, lastfm
from headphones.helpers import checked, radio
def serve_template(templatename, **kwargs):
template_dir = os.path.join(str(headphones.PROG_DIR), 'data/interfaces/default/')
@@ -181,18 +182,14 @@ class WebInterface(object):
def queueAlbum(self, AlbumID, ArtistID, new=False):
logger.info(u"Marking album: " + AlbumID + "as wanted...")
myDB = db.DBConnection()
controlValueDict = {'AlbumID': AlbumID}
newValueDict = {'Status': 'Wanted'}
myDB.upsert("albums", newValueDict, controlValueDict)
import searcher
searcher.searchNZB(AlbumID, new)
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
queueAlbum.exposed = True
def unqueueAlbum(self, AlbumID, ArtistID):
@@ -208,112 +205,14 @@ class WebInterface(object):
unqueueAlbum.exposed = True
def upcoming(self):
page = [templates._header]
page.append(templates._logobar)
page.append(templates._nav)
myDB = db.DBConnection()
albums = myDB.select("SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumASIN, AlbumID, ArtistName, ArtistID from albums WHERE ReleaseDate > date('now') order by ReleaseDate DESC")
upcoming = myDB.select("SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumASIN, AlbumID, ArtistName, ArtistID from albums WHERE ReleaseDate > date('now') order by ReleaseDate DESC")
wanted = myDB.select("SELECT AlbumTitle, ReleaseDate, DateAdded, AlbumASIN, AlbumID, ArtistName, ArtistID from albums WHERE Status='Wanted'")
page.append('''<div class="table"><table border="0" cellpadding="3">
<tr>
<th align="center" width="300"></th>
<th align="center" width="300"><div class="bigtext">Upcoming Albums<br /><br /></div></th>
<th align="center" width="300"></th>
<th> </th>
</tr>''')
if len(albums) == 0:
page.append("""</table><div class="center">No albums are coming out soon :(<br />
(try adding some more artists!)</div><table>""")
i = 0
while i < len(albums):
if albums[i][3]:
albumart = '''<br /><a href="http://www.amazon.com/dp/%s"><img src="http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg" height="200" width="200"></a><br /><br />''' % (albums[i][3], albums[i][3])
else:
albumart = 'No Album Art... yet.'
page.append('''<tr><td align="center" width="300">%s</td>
<td align="center" width="300"><a href="artistPage?ArtistID=%s">%s</a></td>
<td align="center" width="300"><a href="albumPage?AlbumID=%s"><i>%s</i> (%s)</a></td></tr>
''' % (albumart, albums[i][6], albums[i][5], albums[i][4], albums[i][0], albums[i][1]))
i += 1
page.append('''</table></div>''')
if len(wanted):
page.append('''<div class="table"><table border="0" cellpadding="3">
<tr>
<th align="center" width="300"></th>
<th align="center" width="300"><div class="bigtext">Wanted Albums<br /><br /></div></th>
<th align="center" width="300"></th>
<th> </th>
</tr>''')
i = 0
while i < len(wanted):
if wanted[i][3]:
albumart = '''<br /><a href="http://www.amazon.com/dp/%s"><img src="http://ec1.images-amazon.com/images/P/%s.01.LZZZZZZZ.jpg" height="200" width="200"></a><br /><br />''' % (wanted[i][3], wanted[i][3])
else:
albumart = 'No Album Art... yet.'
page.append('''<tr><td align="center" width="300">%s</td>
<td align="center" width="300"><a href="artistPage?ArtistID=%s">%s</a></td>
<td align="center" width="300"><a href="albumPage?AlbumID=%s"><i>%s</i> (%s)</a></td></tr>
''' % (albumart, wanted[i][6], wanted[i][5], wanted[i][4], wanted[i][0], wanted[i][1]))
i += 1
page.append('''</table></div>''')
if len(albums):
page.append(templates._footer % headphones.CURRENT_VERSION)
return page
return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, wanted=wanted)
upcoming.exposed = True
def manage(self):
if headphones.LASTFM_USERNAME:
lastfm_user_text = headphones.LASTFM_USERNAME
else:
lastfm_user_text = 'Last.FM Username'
if headphones.MUSIC_DIR:
music_dir_input = '''<input type="text" value="%s" name="path" size="70" />''' % headphones.MUSIC_DIR
else:
music_dir_input = '''<input type="text" value="Enter a Music Directory to scan" onfocus="if
(this.value==this.defaultValue) this.value='';" name="path" size="70" />'''
page = [templates._header]
page.append(templates._logobar)
page.append(templates._nav)
page.append('''
<div class="table"><div class="config"><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">
%s
<input type="submit" /></form><br /><br /></div></div>
<div class="tableleft"><div class="config"><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
(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 />
<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 />
<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))
page.append(templates._footer % headphones.CURRENT_VERSION)
return page
return serve_template(templatename="manage.html", title="Manage")
manage.exposed = True
def importLastFM(self, username):
@@ -387,67 +286,57 @@ class WebInterface(object):
return serve_template(templatename="logs.html", title="Log", lineList=lineList[0:500])
logs.exposed = True
def clearhistory(self):
logger.info(u"Clearing history")
def clearhistory(self, type=None):
logger.info(u"Clearing history where status is %s" % type)
myDB = db.DBConnection()
myDB.action('''DELETE from snatched''')
myDB.action('DELETE from snatched WHERE Status=?', [type])
raise cherrypy.HTTPRedirect("history")
clearhistory.exposed = True
def config(self):
page = [templates._header]
page.append(templates._logobar)
page.append(templates._nav)
page.append(templates.configform % (
headphones.HTTP_HOST,
headphones.HTTP_USERNAME,
headphones.HTTP_PORT,
headphones.HTTP_PASSWORD,
checked(headphones.LAUNCH_BROWSER),
headphones.SAB_HOST,
headphones.SAB_USERNAME,
headphones.SAB_APIKEY,
headphones.SAB_PASSWORD,
headphones.SAB_CATEGORY,
headphones.DOWNLOAD_DIR,
checked(headphones.BLACKHOLE),
headphones.BLACKHOLE_DIR,
headphones.USENET_RETENTION,
checked(headphones.NZBMATRIX),
headphones.NZBMATRIX_USERNAME,
headphones.NZBMATRIX_APIKEY,
checked(headphones.NEWZNAB),
headphones.NEWZNAB_HOST,
headphones.NEWZNAB_APIKEY,
checked(headphones.NZBSORG),
headphones.NZBSORG_UID,
headphones.NZBSORG_HASH,
checked(headphones.NEWZBIN),
headphones.NEWZBIN_UID,
headphones.NEWZBIN_PASSWORD,
radio(headphones.PREFERRED_QUALITY, 0),
radio(headphones.PREFERRED_QUALITY, 1),
radio(headphones.PREFERRED_QUALITY, 3),
radio(headphones.PREFERRED_QUALITY, 2),
headphones.PREFERRED_BITRATE,
checked(headphones.DETECT_BITRATE),
checked(headphones.MOVE_FILES),
checked(headphones.RENAME_FILES),
checked(headphones.CORRECT_METADATA),
checked(headphones.CLEANUP_FILES),
checked(headphones.ADD_ALBUM_ART),
checked(headphones.EMBED_ALBUM_ART),
headphones.DESTINATION_DIR,
headphones.FOLDER_FORMAT,
headphones.FILE_FORMAT,
checked(headphones.INCLUDE_EXTRAS),
headphones.LOG_DIR
))
page.append(templates._footer % headphones.CURRENT_VERSION)
return page
config = {
"http_host" : headphones.HTTP_HOST,
"http_user" : headphones.HTTP_USERNAME,
"http_port" : headphones.HTTP_PORT,
"http_pass" : headphones.HTTP_PASSWORD,
"launch_browser" : checked(headphones.LAUNCH_BROWSER),
"sab_host" : headphones.SAB_HOST,
"sab_user" : headphones.SAB_USERNAME,
"sab_api" : headphones.SAB_APIKEY,
"sab_pass" : headphones.SAB_PASSWORD,
"sab_cat" : headphones.SAB_CATEGORY,
"download_dir" : headphones.DOWNLOAD_DIR,
"use_blackhole" : checked(headphones.BLACKHOLE),
"blackhole_dir" : headphones.BLACKHOLE_DIR,
"usenet_retention" : headphones.USENET_RETENTION,
"use_nzbmatrix" : checked(headphones.NZBMATRIX),
"nzbmatrix_user" : headphones.NZBMATRIX_USERNAME,
"nzbmatrix_api" : headphones.NZBMATRIX_APIKEY,
"use_newznab" : checked(headphones.NEWZNAB),
"newznab_host" : headphones.NEWZNAB_HOST,
"newznab_api" : headphones.NEWZNAB_APIKEY,
"use_nzbsorg" : checked(headphones.NZBSORG),
"nzbsorg_uid" : headphones.NZBSORG_UID,
"nzbsorg_hash" : headphones.NZBSORG_HASH,
"pref_qual_0" : radio(headphones.PREFERRED_QUALITY, 0),
"pref_qual_1" : radio(headphones.PREFERRED_QUALITY, 1),
"pref_qual_2" : radio(headphones.PREFERRED_QUALITY, 3),
"pref_qual_3" : radio(headphones.PREFERRED_QUALITY, 2),
"pref_bitrate" : headphones.PREFERRED_BITRATE,
"detect_bitrate" : checked(headphones.DETECT_BITRATE),
"move_files" : checked(headphones.MOVE_FILES),
"rename_files" : checked(headphones.RENAME_FILES),
"correct_metadata" : checked(headphones.CORRECT_METADATA),
"cleanup_files" : checked(headphones.CLEANUP_FILES),
"add_album_art" : checked(headphones.ADD_ALBUM_ART),
"embed_album_art" : checked(headphones.EMBED_ALBUM_ART),
"dest_dir" : headphones.DESTINATION_DIR,
"folder_format" : headphones.FOLDER_FORMAT,
"file_format" : headphones.FILE_FORMAT,
"include_extras" : checked(headphones.INCLUDE_EXTRAS),
"log_dir" : headphones.LOG_DIR
}
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True