Added Headphones Indexer

This commit is contained in:
rembo10
2013-07-22 00:09:31 +05:30
5 changed files with 575 additions and 524 deletions

View File

@@ -39,6 +39,6 @@ Album Page with track overview:
![preview thumb](http://i.imgur.com/kcjES.png)
If you run into any issues, visit http://headphones.codeshy.com/forum and report an issue.
If you run into any issues, use the GitHub issue tracker at: http://github.com/rembo10/headphones/issues.
This is free software under the GPL v3 open source license - so feel free to do with it what you wish.

View File

@@ -20,7 +20,7 @@
<h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="settings"/>Settings</h1>
</div>
<form action="configUpdate" method="post" class="form" id="configUpdate">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Web Interface</a></li>
@@ -30,8 +30,8 @@
<li><a href="#tabs-5">Advanced Settings</a></li>
</ul>
<div id="tabs-1">
<table class="configtable" summary="Web Interface">
<tr>
<td>
@@ -41,7 +41,7 @@
<label>HTTP Host</label>
<input type="text" name="http_host" value="${config['http_host']}" size="30">
<small>e.g. localhost or 0.0.0.0</small>
</div>
</div>
<div class="row">
<label>HTTP Port</label>
<input type="text" name="http_port" value="${config['http_port']}" size="10">
@@ -50,20 +50,20 @@
<label>HTTP Username</label>
<input type="text" name="http_username" value="${config['http_user']}" size="30">
</div>
<div class="row">
<label>HTTP Password</label>
<input type="password" name="http_password" value="${config['http_pass']}" size="30">
</div>
<div class="row checkbox">
<input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} /> <label>Launch Browser on Startup</label>
<div class="row checkbox">
<input type="checkbox" name="launch_browser" value="1" ${config['launch_browser']} /> <label>Launch Browser on Startup</label>
</div>
</fieldset>
</td>
<td>
<td>
<fieldset>
<legend>API</legend>
<div class="row checkbox">
<div class="row checkbox">
<input type="checkbox" id="useapi" name="api_enabled" id="api_enabled" value="1" ${config['api_enabled']} /><label>Enable API</label>
</div>
<div id="apioptions" class="row">
@@ -73,14 +73,14 @@
<small>Current API key: <strong>${config['api_key']}</strong></small>
</div>
</fieldset>
<fieldset>
<legend>Interval</legend>
<div class="row">
<label>NZB Search Interval</label>
<input type="text" name="nzb_search_interval" value="${config['nzb_search_interval']}" size="4">mins
</div>
<div class="row">
<label>Download Scan Interval</label>
<input type="text" name="download_scan_interval" value="${config['download_scan_interval']}" size="4">mins
@@ -100,7 +100,7 @@
</table>
<input type="button" class="configsubmit" value="Save Changes" onclick="doAjaxCall('configUpdate',$(this),'tabs',true);return false;" data-success="Changes saved successfully">
</div>
<div id="tabs-2">
<table class="configtable" summary="Download Settings">
<tr>
@@ -122,7 +122,7 @@
<div class="row">
<label>SABnzbd Password:</label>
<input type="password" name="sab_password" value="${config['sab_pass']}" size="20">
</div>
</div>
<div class="row">
<label>SABnzbd API:</label>
<input type="text" name="sab_apikey" value="${config['sab_api']}" size="36">
@@ -131,8 +131,8 @@
<label>SABnzbd Category:</label>
<input type="text" name="sab_category" value="${config['sab_cat']}" size="20">
</div>
</fieldset>
</fieldset>
<fieldset id="nzbget_options">
<div class="row">
<label>NZBget Host:</label>
@@ -146,14 +146,14 @@
<div class="row">
<label>NZBget Password:</label>
<input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20">
</div>
</div>
<div class="row">
<label>NZBget Category:</label>
<input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20">
</div>
</fieldset>
<fieldset id="blackhole_options">
<div class="row">
<label>Black Hole Directory</label>
@@ -161,7 +161,7 @@
<small>Folder your Download program watches for NZBs</small>
</div>
</fieldset>
<fieldset id="nzb_download_dir">
<div class="row">
<label>Music Download Directory:</label>
@@ -169,15 +169,15 @@
<small>Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music</small>
</div>
</fieldset>
<div class="checkbox row">
<div class="checkbox row">
<input type="text" name="usenet_retention" value="${config['usenet_retention']}" size="5"><label>Usenet Retention</label>
</div>
</td>
<td>
<fieldset>
<legend>Torrents</legend>
<div class="row">
<div class="row">
<label>Black Hole Directory</label>
<input type="text" name="torrentblackhole_dir" value="${config['torrentblackhole_dir']}" size="50">
<small>Folder your Download program watches for Torrents</small>
@@ -191,15 +191,15 @@
<label>Music Download Directory</label>
<input type="text" name="download_torrent_dir" value="${config['download_torrent_dir']}" size="50">
<small>Full path where your torrent client downloads your music e.g. /Users/name/Downloads/music</small>
</div>
</div>
<div class="row checkbox">
<label>Keep Files for Seeding</label>
<input type="checkbox" name="keep_torrent_files" value="1" ${config['keep_torrent_files']}>
<input type="checkbox" name="keep_torrent_files" value="1" ${config['keep_torrent_files']}>
</div>
</fieldset>
</td>
</tr>
</tr>
</table>
<input type="button" class="configsubmit" value="Save Changes" onclick="doAjaxCall('configUpdate',$(this),'tabs',true);return false;" data-success="Changes saved successfully">
</div>
@@ -208,9 +208,29 @@
<tr>
<td>
<legend>NZBs</legend>
<fieldset>
<legend>Headphones Indexer</legend>
<div class="row checkbox">
<input id="use_headphones_indexer" type="checkbox" name="use_headphones_indexer" onclick="initConfigCheckbox($(this));" value="1" ${config['use_headphones_indexer']} /><label>Use Headphones Indexer</label>
</div>
<div class="config">
<div class="row">
<label>Username</label>
<input class="hpuser" type="text" value="${config['hpuser']}" size="20">
<small>Headphones VIP Server username & password</small>
</div>
<div class="row">
<label>Password</label>
<input class="hppass" type="password" value="${config['hppass']}" size="20">
</div>
<div class="row">
<a href="http://headphones.codeshy.com/vip" id="vipserver">Get an Account!</a>
</div>
</div>
</fieldset>
<fieldset>
<legend>Newznab</legend>
<div class="row checkbox">
<div class="row checkbox">
<input id="usenewznab" type="checkbox" name="newznab" onclick="initConfigCheckbox($(this));" value="1" ${config['use_newznab']} /><label>Use Newznab</label>
</div>
<div id="newznab_providers">
@@ -264,7 +284,7 @@
<fieldset>
<legend>NZBs.org</legend>
<div class="row checkbox">
<div class="row checkbox">
<input id="usenzbsorg" type="checkbox" name="nzbsorg" onclick="initConfigCheckbox($(this));" value="1" ${config['use_nzbsorg']} /><label>Use NZBs.org</label>
</div>
<div class="config">
@@ -276,8 +296,8 @@
</fieldset>
<fieldset>
<legend>NZBsRus</legend>
<div class="row checkbox">
<input id="usenzbsrus" type="checkbox" name="nzbsrus" onclick="initConfigCheckbox($(this));" value="1" ${config['use_nzbsrus']} /><label>Use NZBsRus</label>
<div class="row checkbox">
<input id="usenzbsrus" type="checkbox" name="nzbsrus" onclick="initConfigCheckbox($(this));" value="1" ${config['use_nzbsrus']} /><label>Use NZBsRus</label>
</div>
<div class="config">
<div class="row">
@@ -290,21 +310,15 @@
</div>
</div>
</fieldset>
<fieldset>
<legend>nzbX</legend>
<div class="row checkbox">
<input id="usenzbx" type="checkbox" name="nzbx" onclick="initConfigCheckbox($(this));" value="1" ${config['use_nzbx']} /><label>Use nzbX</label>
</div>
</fieldset>
</td>
<td>
<fieldset>
<legend>Torrents</legend>
<div class="row checkbox">
<input type="checkbox" name="use_isohunt" value="1" ${config['use_isohunt']} /><label>Isohunt</label>
<div class="row checkbox">
<input type="checkbox" name="use_isohunt" value="1" ${config['use_isohunt']} /><label>Isohunt</label>
</div>
<div class="row checkbox">
<div class="row checkbox">
<input type="checkbox" name="use_mininova" value="1" ${config['use_mininova']} /><label>Mininova</label>
</div>
<div class="row checkbox">
@@ -335,7 +349,7 @@
<input type="password" name="rutracker_password" value="${config['rutracker_password']}" size="36">
</div>
</div>
<div class="row checkbox">
<div class="row checkbox">
<input id="usewhatcd" type="checkbox" name="whatcd" onclick="initConfigCheckbox($(this));" value="1" ${config['use_whatcd']} /><label>What.cd</label>
</div>
<div class="config">
@@ -349,7 +363,7 @@
</div>
</div>
</fieldset>
</td>
</tr>
@@ -369,17 +383,17 @@
<input type="radio" id="preferred_bitrate" name="preferred_quality" value="2" ${config['pref_qual_2']} />Preferred Bitrate: <input type="text" class="override-float" name="preferred_bitrate" value="${config['pref_bitrate']}" size="3">kbps<br>
<div id="preferred_bitrate_options">
Reject if <strong>less than</strong> <input type="text" class="override-float" name="preferred_bitrate_low_buffer" value="${config['pref_bitrate_low']}" size="3">% or <strong>more than</strong> <input type="text" class="override-float" name="preferred_bitrate_high_buffer" value="${config['pref_bitrate_high']}" size="3">% of the target size (leave blank for no limit)<br><br>
<div class="row checkbox left">
<div class="row checkbox left">
<input type="checkbox" name="preferred_bitrate_allow_lossless" value="1" ${config['pref_bitrate_allow_lossless']} />
<label>Allow lossless if no good lossy match found</label>
</div>
<div class="row checkbox left">
<div class="row checkbox left">
<input type="checkbox" name="detect_bitrate" value="1" ${config['detect_bitrate']} />
<label>Auto-Detect Preferred Bitrate</label>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Search Words</legend>
@@ -408,13 +422,13 @@
<input type="checkbox" name="move_files" value="1" ${config['move_files']} /><label>Move downloads to Destination Folder</label>
<input type="checkbox" name="rename_files" value="1" ${config['rename_files']} /><label>Rename files</label>
<input type="checkbox" name="correct_metadata" value="1" ${config['correct_metadata']} /><label>Correct metadata</label>
<input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /><label>Delete leftover files <small>(.m3u, .nfo, .sfv, .nzb, etc.)</small></label>
<input type="checkbox" name="cleanup_files" value="1" ${config['cleanup_files']} /><label>Delete leftover files <small>(.m3u, .nfo, .sfv, .nzb, etc.)</small></label>
<input type="checkbox" name="add_album_art" id="add_album_art" value="1" ${config['add_album_art']}><label>Add album art jpeg to album folder</label>
<div id="album_art_options">
<div class="row">
<div class="row">
as <input type="text" class="override-float" name="album_art_format" value="${config['album_art_format']}" size="10">.jpg
</div>
<small>Use $Artist/$artist, $Album/$album, $Year/$year</small>
</div>
<small>Use $Artist/$artist, $Album/$album, $Year/$year</small>
</div>
<input type="checkbox" name="embed_album_art" value="1" ${config['embed_album_art']}><label>Embed album art in each file</label>
<input type="checkbox" name="embed_lyrics" value="1" ${config['embed_lyrics']}><label>Embed lyrics</label>
@@ -439,7 +453,7 @@
<table class="configtable" summary="Advanced Settings">
<tr>
<td>
<fieldset>
<legend>Renaming options</legend>
<div class="row">
@@ -447,7 +461,7 @@
<input type="text" name="folder_format" value="${config['folder_format']}" size="43">
<small>Use: $Artist/$artist, $Album/$album, $Year/$year, $Type/$type (release type) and $First/$first (first letter in artist name)
E.g.: $Type/$First/$artist/$album [$year] = Album/G/girl talk/all day [2010]</small>
</div>
<div class="row">
<label>File Format</label>
@@ -455,7 +469,7 @@
<small>Use: $Disc/$disc (disc #), $Track/$track (track #), $Title/$title, $Artist/$artist, $Album/$album and $Year/$year</small>
</div>
</fieldset>
<fieldset>
<legend>Re-Encoding Options</legend>
<small class="heading"><span style="float: left; margin-right: .3em; margin-top: 4px;" class="ui-icon ui-icon-info"></span>Note: this option requires the lame, ffmpeg or xld encoder</small>
@@ -467,7 +481,7 @@
<input type="checkbox" name="encoderlossless" value="1" ${config['encoderlossless']}/><label>Only re-encode lossless files (.flac)</label>
</div>
<br>
<div class="row">
<div class="row">
<input type="checkbox" name="delete_lossless_files" value="1" ${config['delete_lossless_files']}/><label>Delete original lossless files after encoding</label>
</div>
</div>
@@ -511,7 +525,7 @@
%endfor
</select>
</div>
<div class="row">
<div class="row">
<label>VBR/CBR</label>
<select name="encodervbrcbr">
%for x in ['cbr', 'vbr']:
@@ -553,8 +567,8 @@
%endfor
</select>
</div>
<%
if config["samplingfrequency"] == 44100:
freq44100 = 'selected="selected"'
@@ -571,14 +585,14 @@
</select>
</div>
</fieldset>
<fieldset>
<legend>Advanced Encoding Options</legend>
<div class="row">
<label>(ignores audio properties)</label>
<input type="text" name="advancedencoder" value="${config['advancedencoder']}" size="43">
</div>
</fieldset>
</div>
<div id="xldproperties">
@@ -593,7 +607,7 @@
</div>
</td>
<td>
<fieldset>
<legend>Miscellaneous</legend>
<div class="checkbox left row">
@@ -622,20 +636,20 @@
</div>
</div>
<div class="row left checkbox">
<input type="checkbox" name="autowant_upcoming" value="1" ${config['autowant_upcoming']} /><label>Automatically Mark Upcoming Albums as Wanted</label>
<input type="checkbox" name="autowant_upcoming" value="1" ${config['autowant_upcoming']} /><label>Automatically Mark Upcoming Albums as Wanted</label>
<div class="row leftcheckbox">
<input type="checkbox" name="autowant_all" value="1" ${config['autowant_all']} /><label>Automatically Mark All Albums as Wanted</label>
</div>
</div>
</div>
<div class="row">
<label>Cache Size (in MB):</label>
<input type="text" name="cache_sizemb" value="${config['cache_sizemb']}" size="7">
</div>
</div>
</fieldset>
<fieldset>
<legend>Interface</legend>
<div class="row">
<label>Interface</label>
<label>Interface</label>
<select name="interface"><h3>
%for interface in config['interface_list']:
<%
@@ -647,7 +661,7 @@
<option value="${interface}" ${selected}>${interface}</option>
%endfor
</select>
</div>
<div class="row">
<label>Log Directory:</label>
@@ -658,12 +672,12 @@
<input type="text" name="cache_dir" value="${config['cache_dir']}" size="50">
</div>
</fieldset>
<h2>Notifications</h2>
<fieldset>
<h3>Prowl</h3>
<h2>Notifications</h2>
<fieldset>
<h3>Prowl</h3>
<div class="row checkbox">
<input type="checkbox" name="prowl_enabled" id="prowl" value="1" ${config['prowl_enabled']} /><label>Enable Prowl Notifications</label>
</div>
@@ -678,12 +692,12 @@
<label>Priority (-2,-1,0,1 or 2):</label>
<input type="text" name="prowl_priority" value="${config['prowl_priority']}" size="2">
</div>
</div>
</div>
</fieldset>
<fieldset>
<h3>XBMC</h3>
<fieldset>
<h3>XBMC</h3>
<div class="checkbox row">
<input type="checkbox" name="xbmc_enabled" id="xbmc" value="1" ${config['xbmc_enabled']} /><label>Enable XBMC Updates</label>
</div>
@@ -693,7 +707,7 @@
<input type="text" name="xbmc_host" value="${config['xbmc_host']}" size="30">
<small>e.g. http://localhost:8080. Separate hosts with commas</small>
</div>
<div class="row">
<div class="row">
<label>XBMC Username</label><input type="text" name="xbmc_username" value="${config['xbmc_username']}" size="30">
</div>
<div class="row">
@@ -707,7 +721,7 @@
</div>
</div>
</fieldset>
<fieldset>
<h3>NotifyMyAndroid</h3>
<div class="checkbox row">
@@ -731,7 +745,7 @@
nma_priority_selected = 'selected'
else:
nma_priority_selected = ''
if x == -2:
nma_priority_value = 'Very Low'
elif x == -1:
@@ -757,8 +771,8 @@
</div>
</fieldset>
<fieldset>
<h3>Pushover</h3>
<fieldset>
<h3>Pushover</h3>
<div class="row checkbox">
<input type="checkbox" name="pushover_enabled" id="pushover" value="1" ${config['pushover_enabled']} /><label>Enable Pushover Notifications</label>
</div>
@@ -773,10 +787,10 @@
<label>Priority (-1,0, or 1):</label>
<input type="text" name="pushover_priority" value="${config['pushover_priority']}" size="2">
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Musicbrainz</legend>
<div class="row">
@@ -804,23 +818,23 @@
<label>Sleep Interval</label><input type="text" name="customsleep" value="${config['customsleep']}" size="4">
</div>
</div>
<div id="hpserveroptions">
<div class="row">
<label>Username:</label><input type="text" name="hpuser" value="${config['hpuser']}" size="20">
<label>Username:</label><input type="text" class="hpuser" name="hpuser" value="${config['hpuser']}" size="20">
</div>
<div class="row">
<label>Password:</label><input type="password" name="hppass" value="${config['hppass']}" size="15"><br>
<label>Password:</label><input type="password" class="hppass" name="hppass" value="${config['hppass']}" size="15"><br>
<a href="http://headphones.codeshy.com/vip" id="vipserver">Get an Account!</a>
</div>
</div>
</fieldset>
</td>
</tr>
</table>
<input type="button" class="configsubmit" value="Save Changes" onclick="doAjaxCall('configUpdate',$(this),'tabs',true);return false;" data-success="Changes saved successfully">
</div>
</div>
</form>
</div>
@@ -828,21 +842,21 @@
<%def name="javascriptIncludes()">
<script>
hideServerDivs = function () {
$("#customoptions").slideUp();
$("#hpserveroptions").slideUp();
};
hideEncoderDivs = function () {
$("#lameffmpegproperties").slideUp();
$("#xldproperties").slideUp();
};
handleNewServerSelection = function () {
hideServerDivs();
switch ($(this).val()) {
case 'custom':
$("#customoptions").slideDown();
@@ -852,11 +866,11 @@
break;
}
};
handleNewEncoderSelection = function () {
hideEncoderDivs();
switch ($(this).val()) {
case 'xld':
$("#xldproperties").slideDown();
@@ -869,16 +883,16 @@
break;
}
};
function openExtrasDialog() {
$("#dialog").dialog({ close: function(){
$("#dialog").dialog({ close: function(){
var elem = '<input type="button" data-success="Changes saved successfully">';
doAjaxCall('configUpdate', elem,'tabs',true);
doAjaxCall('configUpdate', elem,'tabs',true);
}}).dialog("open");
};
function initThisPage()
function initThisPage()
{
if ($("#api_enabled").is(":checked"))
{
@@ -888,7 +902,7 @@
{
$("#apioptions").hide();
}
$("#api_enabled").click(function(){
if ($("#api_enabled").is(":checked"))
{
@@ -898,11 +912,11 @@
{
$("#apioptions").slideUp();
}
});
});
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_api").click(function(){
$.get('generateAPI',
$.get('generateAPI',
function(data){
if (data.error != undefined) {
alert(data.error);
@@ -930,7 +944,7 @@
$("#encoderoptions").slideUp();
}
});
if ($("#add_album_art").is(":checked"))
{
$("#album_art_options").show();
@@ -939,7 +953,7 @@
{
$("#album_art_options").hide();
}
$("#add_album_art").click(function(){
if ($("#add_album_art").is(":checked"))
{
@@ -959,7 +973,7 @@
{
$("#prowloptions").hide();
}
$("#prowl").click(function(){
if ($("#prowl").is(":checked"))
{
@@ -969,7 +983,7 @@
{
$("#prowloptions").slideUp();
}
});
});
if ($("#xbmc").is(":checked"))
{
@@ -979,7 +993,7 @@
{
$("#xbmcoptions").hide();
}
$("#xbmc").click(function(){
if ($("#xbmc").is(":checked"))
{
@@ -989,8 +1003,8 @@
{
$("#xbmcoptions").slideUp();
}
});
});
if ($("#nma").is(":checked"))
{
$("#nmaoptions").show();
@@ -999,7 +1013,7 @@
{
$("#nmaoptions").hide();
}
$("#nma").click(function(){
if ($("#nma").is(":checked"))
{
@@ -1018,7 +1032,7 @@
{
$("#pushoveroptions").hide();
}
$("#pushover").click(function(){
if ($("#pushover").is(":checked"))
{
@@ -1028,7 +1042,7 @@
{
$("#pushoveroptions").slideUp();
}
});
});
if ($("#preferred_bitrate").is(":checked"))
{
@@ -1038,7 +1052,7 @@
{
$("#preferred_bitrate_options").hide();
}
if ($("#nzb_downloader_sabnzbd").is(":checked"))
{
$("#sabnzbd_options").show();
@@ -1084,29 +1098,29 @@
{
$("#sabnzbd_options,#nzbget_options").fadeOut("fast", function() { $("#blackhole_options").fadeIn() });
}
});
});
$("#mirror").change(handleNewServerSelection);
handleNewServerSelection.apply($("#mirror"));
$("#encoder").change(handleNewEncoderSelection);
handleNewEncoderSelection.apply($("#encoder"));
var deletedNewznabs = 0;
$(".remove").click(function() {
$(this).parent().parent().remove();
deletedNewznabs = deletedNewznabs + 1;
});
$("#modify_extras").click(openExtrasDialog);
$("#include_extras").click(function(){
if ($("#include_extras").is(":checked")){
openExtrasDialog();
}
});
%for extra in config['extras']:
$("#${extra}_temp").click(function(){
if ($(this).is(":checked")){
@@ -1116,8 +1130,8 @@
$("#${extra}").attr("checked", false);
}
});
%endfor
%endfor
$("#add_newznab").click(function() {
var intId = $("#newznab_providers > div").size() + deletedNewznabs + 1;
var formfields = $("<div class=\"config\" id=\"newznab" + intId + "\"><div class=\"row\"><label>Newznab Host</label><input type=\"text\" name=\"newznab_host" + intId + "\" size=\"30\"></div><div class=\"row\"><label>Newznab API</label><input type=\"text\" name=\"newznab_api" + intId + "\" size=\"36\"></div><div class=\"row checkbox\"><input type=\"checkbox\" name=\"newznab_enabled" + intId + "\" value=\"1\" checked /><label>Enabled</label></div>");
@@ -1125,13 +1139,21 @@
removeButton.click(function() {
$(this).parent().remove();
deletedNewznabs = deletedNewznabs + 1;
});
formfields.append(removeButton);
formfields.append("</div>");
$("#add_newznab").before(formfields);
});
$(".hpuser").keyup(function() {
$(".hpuser").val($(this).val());
});
$(".hppass").keyup(function() {
$(".hppass").val($(this).val());
});
$(function() {
$( "#tabs" ).tabs();
});
@@ -1139,7 +1161,6 @@
initConfigCheckbox("#usenewznab");
initConfigCheckbox("#usenzbsrus");
initConfigCheckbox("#usenzbsorg");
initConfigCheckbox("#usenzbx");
initConfigCheckbox("#usewaffles");
initConfigCheckbox("#userutracker");
initConfigCheckbox("#usewhatcd");
@@ -1149,6 +1170,6 @@
$(document).ready(function() {
initThisPage();
});
</script>
</%def>

View File

@@ -136,6 +136,8 @@ NZBGET_PASSWORD = None
NZBGET_CATEGORY = None
NZBGET_HOST = None
HEADPHONES_INDEXER = False
NZBMATRIX = False
NZBMATRIX_USERNAME = None
NZBMATRIX_APIKEY = None
@@ -158,8 +160,6 @@ NZBSRUS = False
NZBSRUS_UID = None
NZBSRUS_APIKEY = None
NZBX = False
PREFERRED_WORDS = None
IGNORED_WORDS = None
REQUIRED_WORDS = None
@@ -293,8 +293,8 @@ def initialize():
TORRENTBLACKHOLE_DIR, NUMBEROFSEEDERS, ISOHUNT, KAT, MININOVA, WAFFLES, WAFFLES_UID, WAFFLES_PASSKEY, \
RUTRACKER, RUTRACKER_USER, RUTRACKER_PASSWORD, WHATCD, WHATCD_USERNAME, WHATCD_PASSWORD, DOWNLOAD_TORRENT_DIR, \
LIBRARYSCAN, LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, NZBX, \
NZBGET_USERNAME, NZBGET_PASSWORD, NZBGET_CATEGORY, NZBGET_HOST, HEADPHONES_INDEXER, NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, NZBSRUS, NZBSRUS_UID, NZBSRUS_APIKEY, \
NZB_DOWNLOADER, PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \
LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \
MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, \
@@ -311,11 +311,11 @@ def initialize():
CheckSection('General')
CheckSection('SABnzbd')
CheckSection('NZBget')
CheckSection('Headphones')
CheckSection('NZBMatrix')
CheckSection('Newznab')
CheckSection('NZBsorg')
CheckSection('NZBsRus')
CheckSection('nzbX')
CheckSection('Newzbin')
CheckSection('Waffles')
CheckSection('Rutracker')
@@ -421,7 +421,9 @@ def initialize():
NZBGET_PASSWORD = check_setting_str(CFG, 'NZBget', 'nzbget_password', '')
NZBGET_CATEGORY = check_setting_str(CFG, 'NZBget', 'nzbget_category', '')
NZBGET_HOST = check_setting_str(CFG, 'NZBget', 'nzbget_host', '')
HEADPHONES_INDEXER = bool(check_setting_int(CFG, 'Headphones', 'headphones_indexer', 0))
NZBMATRIX = bool(check_setting_int(CFG, 'NZBMatrix', 'nzbmatrix', 0))
NZBMATRIX_USERNAME = check_setting_str(CFG, 'NZBMatrix', 'nzbmatrix_username', '')
NZBMATRIX_APIKEY = check_setting_str(CFG, 'NZBMatrix', 'nzbmatrix_apikey', '')
@@ -446,9 +448,7 @@ def initialize():
NZBSRUS = bool(check_setting_int(CFG, 'NZBsRus', 'nzbsrus', 0))
NZBSRUS_UID = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_uid', '')
NZBSRUS_APIKEY = check_setting_str(CFG, 'NZBsRus', 'nzbsrus_apikey', '')
NZBX = bool(check_setting_int(CFG, 'nzbX', 'nzbx', 0))
PREFERRED_WORDS = check_setting_str(CFG, 'General', 'preferred_words', '')
IGNORED_WORDS = check_setting_str(CFG, 'General', 'ignored_words', '')
REQUIRED_WORDS = check_setting_str(CFG, 'General', 'required_words', '')
@@ -554,12 +554,18 @@ def initialize():
if ENCODERFOLDER:
ENCODER_PATH = os.path.join(ENCODERFOLDER, ENCODER)
CONFIG_VERSION = '3'
if CONFIG_VERSION == '3':
#Update the BLACKHOLE option to the NZB_DOWNLOADER format
if BLACKHOLE:
NZB_DOWNLOADER = 2
CONFIG_VERSION = '4'
# Enable Headphones Indexer if they have a VIP account
if CONFIG_VERSION == '4':
if HPUSER and HPPASS:
HEADPHONES_INDEXER = True
CONFIG_VERSION = '5'
if not LOG_DIR:
LOG_DIR = os.path.join(DATA_DIR, 'logs')
@@ -763,12 +769,15 @@ def config_write():
new_config['SABnzbd']['sab_password'] = SAB_PASSWORD
new_config['SABnzbd']['sab_apikey'] = SAB_APIKEY
new_config['SABnzbd']['sab_category'] = SAB_CATEGORY
new_config['NZBget'] = {}
new_config['NZBget']['nzbget_username'] = NZBGET_USERNAME
new_config['NZBget']['nzbget_password'] = NZBGET_PASSWORD
new_config['NZBget']['nzbget_category'] = NZBGET_CATEGORY
new_config['NZBget']['nzbget_host'] = NZBGET_HOST
new_config['Headphones'] = {}
new_config['Headphones']['headphones_indexer'] = int(HEADPHONES_INDEXER)
new_config['NZBMatrix'] = {}
new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX)
@@ -802,10 +811,7 @@ def config_write():
new_config['NZBsRus']['nzbsrus'] = int(NZBSRUS)
new_config['NZBsRus']['nzbsrus_uid'] = NZBSRUS_UID
new_config['NZBsRus']['nzbsrus_apikey'] = NZBSRUS_APIKEY
new_config['nzbX'] = {}
new_config['nzbX']['nzbx'] = int(NZBX)
new_config['General']['preferred_words'] = PREFERRED_WORDS
new_config['General']['ignored_words'] = IGNORED_WORDS
new_config['General']['required_words'] = REQUIRED_WORDS
@@ -1069,17 +1075,17 @@ def dbcheck():
for artist in artists:
if artist[1]:
c.execute('UPDATE artists SET Extras=? WHERE ArtistID=?', ("1,2,3,4,5,6,7,8", artist[0]))
try:
c.execute('SELECT Kind from snatched')
except sqlite3.OperationalError:
c.execute('ALTER TABLE snatched ADD COLUMN Kind TEXT DEFAULT NULL')
try:
c.execute('SELECT SearchTerm from albums')
except sqlite3.OperationalError:
c.execute('ALTER TABLE albums ADD COLUMN SearchTerm TEXT DEFAULT NULL')
conn.commit()
c.close()

File diff suppressed because it is too large Load Diff

View File

@@ -40,17 +40,17 @@ def serve_template(templatename, **kwargs):
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:
template = _hplookup.get_template(templatename)
return template.render(**kwargs)
except:
return exceptions.html_error_template().render()
class WebInterface(object):
def index(self):
raise cherrypy.HTTPRedirect("home")
index.exposed=True
@@ -65,11 +65,11 @@ class WebInterface(object):
myDB = db.DBConnection()
artist = myDB.action('SELECT * FROM artists WHERE ArtistID=?', [ArtistID]).fetchone()
albums = myDB.select('SELECT * from albums WHERE ArtistID=? order by ReleaseDate DESC', [ArtistID])
# Don't redirect to the artist page until it has the bare minimum info inserted
# Redirect to the home page if we still can't get it after 5 seconds
# Don't redirect to the artist page until it has the bare minimum info inserted
# Redirect to the home page if we still can't get it after 5 seconds
retry = 0
while retry < 5:
if not artist:
time.sleep(1)
@@ -77,19 +77,19 @@ class WebInterface(object):
retry += 1
else:
break
if not artist:
raise cherrypy.HTTPRedirect("home")
# Serve the extras up as a dict to make things easier for new templates
extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook"]
extras_dict = {}
if not artist['Extras']:
artist_extras = ""
else:
artist_extras = artist['Extras']
i = 1
for extra in extras_list:
if str(i) in artist_extras:
@@ -100,8 +100,8 @@ class WebInterface(object):
return serve_template(templatename="artist.html", title=artist['ArtistName'], artist=artist, albums=albums, extras=extras_dict)
artistPage.exposed = True
def albumPage(self, AlbumID):
myDB = db.DBConnection()
album = myDB.action('SELECT * from albums WHERE AlbumID=?', [AlbumID]).fetchone()
@@ -110,8 +110,8 @@ class WebInterface(object):
title = album['ArtistName'] + ' - ' + album['AlbumTitle']
return serve_template(templatename="album.html", title=title, album=album, tracks=tracks, description=description)
albumPage.exposed = True
def search(self, name, type):
if len(name) == 0:
raise cherrypy.HTTPRedirect("home")
@@ -127,7 +127,7 @@ class WebInterface(object):
threading.Thread(target=lastfm.getSimilar).start()
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % artistid)
addArtist.exposed = True
def getExtras(self, ArtistID, newstyle=False, **kwargs):
# if calling this function without the newstyle, they're using the old format
# which doesn't separate extras, so we'll grab all of them
@@ -144,7 +144,7 @@ class WebInterface(object):
temp_extras_list.append(i)
i += 1
extras = ','.join(str(n) for n in temp_extras_list)
myDB = db.DBConnection()
controlValueDict = {'ArtistID': ArtistID}
newValueDict = {'IncludeExtras': 1,
@@ -153,7 +153,7 @@ class WebInterface(object):
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID, True]).start()
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
getExtras.exposed = True
def removeExtras(self, ArtistID):
myDB = db.DBConnection()
controlValueDict = {'ArtistID': ArtistID}
@@ -165,7 +165,7 @@ class WebInterface(object):
myDB.action('DELETE from albums WHERE ArtistID=? AND AlbumID=?', [ArtistID, album['AlbumID']])
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
removeExtras.exposed = True
def pauseArtist(self, ArtistID):
logger.info(u"Pausing artist: " + ArtistID)
myDB = db.DBConnection()
@@ -174,7 +174,7 @@ class WebInterface(object):
myDB.upsert("artists", newValueDict, controlValueDict)
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
pauseArtist.exposed = True
def resumeArtist(self, ArtistID):
logger.info(u"Resuming artist: " + ArtistID)
myDB = db.DBConnection()
@@ -183,7 +183,7 @@ class WebInterface(object):
myDB.upsert("artists", newValueDict, controlValueDict)
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
resumeArtist.exposed = True
def deleteArtist(self, ArtistID):
logger.info(u"Deleting all traces of artist: " + ArtistID)
myDB = db.DBConnection()
@@ -195,7 +195,7 @@ class WebInterface(object):
myDB.action('INSERT OR REPLACE into blacklist VALUES (?)', [ArtistID])
raise cherrypy.HTTPRedirect("home")
deleteArtist.exposed = True
def deleteEmptyArtists(self):
logger.info(u"Deleting all empty artists")
myDB = db.DBConnection()
@@ -208,13 +208,13 @@ class WebInterface(object):
myDB.action('DELETE from allalbums WHERE ArtistID=?', [ArtistID])
myDB.action('DELETE from alltracks WHERE ArtistID=?', [ArtistID])
myDB.action('INSERT OR REPLACE into blacklist VALUES (?)', [ArtistID])
deleteEmptyArtists.exposed = True
deleteEmptyArtists.exposed = True
def refreshArtist(self, ArtistID):
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID]).start()
threading.Thread(target=importer.addArtisttoDB, args=[ArtistID]).start()
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
refreshArtist.exposed=True
refreshArtist.exposed=True
def markAlbums(self, ArtistID=None, action=None, **args):
myDB = db.DBConnection()
if action == 'WantedNew' or action == 'WantedLossless':
@@ -237,12 +237,12 @@ class WebInterface(object):
else:
raise cherrypy.HTTPRedirect("upcoming")
markAlbums.exposed = True
def addArtists(self, **args):
threading.Thread(target=importer.artistlist_to_mbids, args=[args, True]).start()
raise cherrypy.HTTPRedirect("home")
addArtists.exposed = True
def queueAlbum(self, AlbumID, ArtistID=None, new=False, redirect=None, lossless=False):
logger.info(u"Marking album: " + AlbumID + " as wanted...")
myDB = db.DBConnection()
@@ -250,7 +250,7 @@ class WebInterface(object):
if lossless:
newValueDict = {'Status': 'Wanted Lossless'}
logger.info("...lossless only!")
else:
else:
newValueDict = {'Status': 'Wanted'}
myDB.upsert("albums", newValueDict, controlValueDict)
searcher.searchforalbum(AlbumID, new)
@@ -268,7 +268,7 @@ class WebInterface(object):
myDB.upsert("albums", newValueDict, controlValueDict)
raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % ArtistID)
unqueueAlbum.exposed = True
def deleteAlbum(self, AlbumID, ArtistID=None):
logger.info(u"Deleting all traces of album: " + AlbumID)
myDB = db.DBConnection()
@@ -279,7 +279,7 @@ class WebInterface(object):
else:
raise cherrypy.HTTPRedirect("home")
deleteAlbum.exposed = True
def switchAlbum(self, AlbumID, ReleaseID):
'''
Take the values from allalbums/alltracks (based on the ReleaseID) and swap it into the album & track tables
@@ -288,7 +288,7 @@ class WebInterface(object):
albumswitcher.switch(AlbumID, ReleaseID)
raise cherrypy.HTTPRedirect("albumPage?AlbumID=%s" % AlbumID)
switchAlbum.exposed = True
def editSearchTerm(self, AlbumID, SearchTerm):
logger.info(u"Updating search term for albumid: " + AlbumID)
myDB = db.DBConnection()
@@ -304,19 +304,19 @@ class WebInterface(object):
wanted = myDB.select("SELECT * from albums WHERE Status='Wanted'")
return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, wanted=wanted)
upcoming.exposed = True
def manage(self):
myDB = db.DBConnection()
emptyArtists = myDB.select("SELECT * FROM artists WHERE LatestAlbum IS NULL")
return serve_template(templatename="manage.html", title="Manage", emptyArtists=emptyArtists)
manage.exposed = True
def manageArtists(self):
myDB = db.DBConnection()
artists = myDB.select('SELECT * from artists order by ArtistSortName COLLATE NOCASE')
return serve_template(templatename="manageartists.html", title="Manage Artists", artists=artists)
manageArtists.exposed = True
def manageAlbums(self, Status=None):
myDB = db.DBConnection()
if Status == "Upcoming":
@@ -327,13 +327,13 @@ class WebInterface(object):
albums = myDB.select('SELECT * from albums')
return serve_template(templatename="managealbums.html", title="Manage Albums", albums=albums)
manageAlbums.exposed = True
def manageNew(self):
myDB = db.DBConnection()
newartists = myDB.select('SELECT * from newartists')
return serve_template(templatename="managenew.html", title="Manage New Artists", newartists=newartists)
manageNew.exposed = True
manageNew.exposed = True
def markArtists(self, action=None, **args):
myDB = db.DBConnection()
artistsToAdd = []
@@ -350,7 +350,7 @@ class WebInterface(object):
elif action == 'resume':
controlValueDict = {'ArtistID': ArtistID}
newValueDict = {'Status': 'Active'}
myDB.upsert("artists", newValueDict, controlValueDict)
myDB.upsert("artists", newValueDict, controlValueDict)
else:
artistsToAdd.append(ArtistID)
if len(artistsToAdd) > 0:
@@ -358,14 +358,14 @@ class WebInterface(object):
threading.Thread(target=importer.addArtistIDListToDB, args=[artistsToAdd]).start()
raise cherrypy.HTTPRedirect("home")
markArtists.exposed = True
def importLastFM(self, username):
headphones.LASTFM_USERNAME = username
headphones.config_write()
threading.Thread(target=lastfm.getArtists).start()
raise cherrypy.HTTPRedirect("home")
importLastFM.exposed = True
def importLastFMTag(self, tag, limit):
threading.Thread(target=lastfm.getTagTopArtists, args=(tag, limit)).start()
raise cherrypy.HTTPRedirect("home")
@@ -378,14 +378,14 @@ class WebInterface(object):
time.sleep(10)
raise cherrypy.HTTPRedirect("home")
importItunes.exposed = True
def musicScan(self, path, scan=0, redirect=None, autoadd=0, libraryscan=0):
headphones.LIBRARYSCAN = libraryscan
headphones.ADD_ARTISTS = autoadd
headphones.MUSIC_DIR = path
headphones.config_write()
headphones.config_write()
if scan:
try:
try:
threading.Thread(target=librarysync.libraryScan).start()
except Exception, e:
logger.error('Unable to complete the scan: %s' % e)
@@ -394,41 +394,41 @@ class WebInterface(object):
else:
raise cherrypy.HTTPRedirect("home")
musicScan.exposed = True
def forceUpdate(self):
from headphones import updater
threading.Thread(target=updater.dbUpdate).start()
raise cherrypy.HTTPRedirect("home")
forceUpdate.exposed = True
def forceSearch(self):
from headphones import searcher
threading.Thread(target=searcher.searchforalbum).start()
raise cherrypy.HTTPRedirect("home")
forceSearch.exposed = True
def forcePostProcess(self):
from headphones import postprocessor
threading.Thread(target=postprocessor.forcePostProcess).start()
raise cherrypy.HTTPRedirect("home")
forcePostProcess.exposed = True
def checkGithub(self):
from headphones import versioncheck
versioncheck.checkGithub()
raise cherrypy.HTTPRedirect("home")
checkGithub.exposed = True
def history(self):
myDB = db.DBConnection()
history = myDB.select('''SELECT * from snatched order by DateAdded DESC''')
return serve_template(templatename="history.html", title="History", history=history)
history.exposed = True
def logs(self):
return serve_template(templatename="logs.html", title="Log", lineList=headphones.LOG_LIST)
logs.exposed = True
def getLog(self,iDisplayStart=0,iDisplayLength=100,iSortCol_0=0,sSortDir_0="desc",sSearch="",**kwargs):
@@ -446,7 +446,7 @@ class WebInterface(object):
sortcolumn = 2
elif iSortCol_0 == '2':
sortcolumn = 1
filtered.sort(key=lambda x:x[sortcolumn],reverse=sSortDir_0 == "desc")
filtered.sort(key=lambda x:x[sortcolumn],reverse=sSortDir_0 == "desc")
rows = filtered[iDisplayStart:(iDisplayStart+iDisplayLength)]
rows = [[row[0],row[2],row[1]] for row in rows]
@@ -463,10 +463,10 @@ class WebInterface(object):
iDisplayStart = int(iDisplayStart)
iDisplayLength = int(iDisplayLength)
filtered = []
totalcount = 0
totalcount = 0
myDB = db.DBConnection()
sortcolumn = 'ArtistSortName'
sortbyhavepercent = False
if iSortCol_0 == '2':
@@ -477,9 +477,9 @@ class WebInterface(object):
sortbyhavepercent = True
if sSearch == "":
query = 'SELECT * from artists order by %s COLLATE NOCASE %s' % (sortcolumn,sSortDir_0)
query = 'SELECT * from artists order by %s COLLATE NOCASE %s' % (sortcolumn,sSortDir_0)
filtered = myDB.select(query)
totalcount = len(filtered)
totalcount = len(filtered)
else:
query = 'SELECT * from artists WHERE ArtistSortName LIKE "%' + sSearch + '%" OR LatestAlbum LIKE "%' + sSearch +'%"' + 'ORDER BY %s COLLATE NOCASE %s' % (sortcolumn,sSortDir_0)
filtered = myDB.select(query)
@@ -488,11 +488,11 @@ class WebInterface(object):
if sortbyhavepercent:
filtered.sort(key=lambda x:(float(x['HaveTracks'])/x['TotalTracks'] if x['TotalTracks'] > 0 else 0.0,x['HaveTracks'] if x['HaveTracks'] else 0.0),reverse=sSortDir_0 == "asc")
#can't figure out how to change the datatables default sorting order when its using an ajax datasource so ill
#can't figure out how to change the datatables default sorting order when its using an ajax datasource so ill
#just reverse it here and the first click on the "Latest Album" header will sort by descending release date
if sortcolumn == 'ReleaseDate':
filtered.reverse()
artists = filtered[iDisplayStart:(iDisplayStart+iDisplayLength)]
rows = []
@@ -502,7 +502,7 @@ class WebInterface(object):
"Status":artist["Status"],
"TotalTracks":artist["TotalTracks"],
"HaveTracks":artist["HaveTracks"],
"LatestAlbum":"",
"LatestAlbum":"",
"ReleaseDate":"",
"ReleaseInFuture":"False",
"AlbumID":"",
@@ -520,7 +520,7 @@ class WebInterface(object):
row['ReleaseDate'] = ''
row['LatestAlbum'] = artist['LatestAlbum']
row['AlbumID'] = artist['AlbumID']
rows.append(row)
@@ -543,23 +543,23 @@ class WebInterface(object):
myDB.action('DELETE from snatched WHERE Status=?', [type])
raise cherrypy.HTTPRedirect("history")
clearhistory.exposed = True
def generateAPI(self):
import hashlib, random
apikey = hashlib.sha224( str(random.getrandbits(256)) ).hexdigest()[0:32]
logger.info("New API generated")
return apikey
generateAPI.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 = {
config = {
"http_host" : headphones.HTTP_HOST,
"http_user" : headphones.HTTP_USERNAME,
"http_port" : headphones.HTTP_PORT,
@@ -586,6 +586,7 @@ class WebInterface(object):
"use_blackhole" : checked(headphones.BLACKHOLE),
"blackhole_dir" : headphones.BLACKHOLE_DIR,
"usenet_retention" : headphones.USENET_RETENTION,
"use_headphones_indexer" : checked(headphones.HEADPHONES_INDEXER),
"use_newznab" : checked(headphones.NEWZNAB),
"newznab_host" : headphones.NEWZNAB_HOST,
"newznab_api" : headphones.NEWZNAB_APIKEY,
@@ -597,7 +598,6 @@ class WebInterface(object):
"use_nzbsrus" : checked(headphones.NZBSRUS),
"nzbsrus_uid" : headphones.NZBSRUS_UID,
"nzbsrus_apikey" : headphones.NZBSRUS_APIKEY,
"use_nzbx" : checked(headphones.NZBX),
"preferred_words" : headphones.PREFERRED_WORDS,
"ignored_words" : headphones.IGNORED_WORDS,
"required_words" : headphones.REQUIRED_WORDS,
@@ -684,11 +684,11 @@ class WebInterface(object):
"hppass": headphones.HPPASS,
"cache_sizemb":headphones.CACHE_SIZEMB,
}
# Need to convert EXTRAS to a dictionary we can pass to the config: it'll come in as a string like 2,5,6,8
extras_list = ["single", "ep", "compilation", "soundtrack", "live", "remix", "spokenword", "audiobook"]
extras_dict = {}
i = 1
for extra in extras_list:
if str(i) in headphones.EXTRAS:
@@ -696,26 +696,27 @@ class WebInterface(object):
else:
extras_dict[extra] = ""
i+=1
config["extras"] = extras_dict
return serve_template(templatename="config.html", title="Settings", config=config)
return serve_template(templatename="config.html", title="Settings", config=config)
config.exposed = True
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8181, http_password=None, launch_browser=0, api_enabled=0, api_key=None,
download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None,
sab_category=None, nzbget_host=None, nzbget_username='nzbget', nzbget_password=None, nzbget_category=None, nzb_downloader=0, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, newznab=0, newznab_host=None, newznab_apikey=None,
newznab_enabled=0, nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, nzbsrus=0, nzbsrus_uid=None, nzbsrus_apikey=None, nzbx=0, preferred_words=None, required_words=None, ignored_words=None,
preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None,
def configUpdate(self, http_host='0.0.0.0', http_username=None, http_port=8181, http_password=None, launch_browser=0, api_enabled=0, api_key=None,
download_scan_interval=None, nzb_search_interval=None, libraryscan_interval=None, sab_host=None, sab_username=None, sab_apikey=None, sab_password=None,
sab_category=None, nzbget_host=None, nzbget_username='nzbget', nzbget_password=None, nzbget_category=None, nzb_downloader=0, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None,
use_headphones_indexer=0,newznab=0, newznab_host=None, newznab_apikey=None,
newznab_enabled=0, nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, nzbsrus=0, nzbsrus_uid=None, nzbsrus_apikey=None, preferred_words=None, required_words=None, ignored_words=None,
preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None,
numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0, waffles=0, waffles_uid=None, waffles_passkey=None, whatcd=0, whatcd_username=None, whatcd_password=None,
rutracker=0, rutracker_user=None, rutracker_password=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, album_art_format=None, embed_album_art=0, embed_lyrics=0,
rutracker=0, rutracker_user=None, rutracker_password=None, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, album_art_format=None, embed_album_art=0, embed_lyrics=0,
destination_dir=None, lossless_destination_dir=None, folder_format=None, file_format=None, include_extras=0, single=0, ep=0, compilation=0, soundtrack=0, live=0,
remix=0, spokenword=0, audiobook=0, autowant_upcoming=False, autowant_all=False, keep_torrent_files=False, interface=None, log_dir=None, cache_dir=None, music_encoder=0, encoder=None, xldprofile=None,
bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
delete_lossless_files=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None,
xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, nma_onsnatch=0, synoindex_enabled=False,
pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, mirror=None, customhost=None, customport=None,
bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
delete_lossless_files=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None,
xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, nma_onsnatch=0, synoindex_enabled=False,
pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, mirror=None, customhost=None, customport=None,
customsleep=None, hpuser=None, hppass=None, preferred_bitrate_high_buffer=None, preferred_bitrate_low_buffer=None, preferred_bitrate_allow_lossless=0, cache_sizemb=None, **kwargs):
headphones.HTTP_HOST = http_host
@@ -730,7 +731,7 @@ class WebInterface(object):
headphones.LIBRARYSCAN_INTERVAL = libraryscan_interval
headphones.SAB_HOST = sab_host
headphones.SAB_USERNAME = sab_username
headphones.SAB_PASSWORD = sab_password
headphones.SAB_PASSWORD = sab_password
headphones.SAB_APIKEY = sab_apikey
headphones.SAB_CATEGORY = sab_category
headphones.NZBGET_HOST = nzbget_host
@@ -742,6 +743,7 @@ class WebInterface(object):
headphones.BLACKHOLE = blackhole
headphones.BLACKHOLE_DIR = blackhole_dir
headphones.USENET_RETENTION = usenet_retention
headphones.HEADPHONES_INDEXER = use_headphones_indexer
headphones.NEWZNAB = newznab
headphones.NEWZNAB_HOST = newznab_host
headphones.NEWZNAB_APIKEY = newznab_apikey
@@ -752,7 +754,6 @@ class WebInterface(object):
headphones.NZBSRUS = nzbsrus
headphones.NZBSRUS_UID = nzbsrus_uid
headphones.NZBSRUS_APIKEY = nzbsrus_apikey
headphones.NZBX = nzbx
headphones.PREFERRED_WORDS = preferred_words
headphones.IGNORED_WORDS = ignored_words
headphones.REQUIRED_WORDS = required_words
@@ -836,9 +837,9 @@ class WebInterface(object):
headphones.CACHE_SIZEMB = int(cache_sizemb)
# Handle the variable config options. Note - keys with False values aren't getting passed
headphones.EXTRA_NEWZNABS = []
for kwarg in kwargs:
if kwarg.startswith('newznab_host'):
newznab_number = kwarg[12:]
@@ -848,26 +849,26 @@ class WebInterface(object):
newznab_enabled = int(kwargs['newznab_enabled' + newznab_number])
except KeyError:
newznab_enabled = 0
headphones.EXTRA_NEWZNABS.append((newznab_host, newznab_api, newznab_enabled))
# Convert the extras to list then string. Coming in as 0 or 1
temp_extras_list = []
extras_list = [single, ep, compilation, soundtrack, live, remix, spokenword, audiobook]
i = 1
for extra in extras_list:
if extra:
temp_extras_list.append(i)
i+=1
headphones.EXTRAS = ','.join(str(n) for n in temp_extras_list)
headphones.EXTRAS = ','.join(str(n) for n in temp_extras_list)
# Sanity checking
if headphones.SEARCH_INTERVAL < 360:
logger.info("Search interval too low. Resetting to 6 hour minimum")
headphones.SEARCH_INTERVAL = 360
# Write the config
headphones.config_write()
@@ -875,7 +876,7 @@ class WebInterface(object):
mb.startmb()
raise cherrypy.HTTPRedirect("config")
configUpdate.exposed = True
def shutdown(self):
@@ -891,14 +892,14 @@ class WebInterface(object):
message = 'Restarting...'
return serve_template(templatename="shutdown.html", title="Restarting", message=message, timer=30)
restart.exposed = True
def update(self):
headphones.SIGNAL = 'update'
message = 'Updating...'
return serve_template(templatename="shutdown.html", title="Updating", message=message, timer=120)
return page
update.exposed = True
def extras(self):
myDB = db.DBConnection()
cloudlist = myDB.select('SELECT * from lastfmcloud')
@@ -910,59 +911,59 @@ class WebInterface(object):
threading.Thread(target=importer.addReleaseById, args=[rid]).start()
raise cherrypy.HTTPRedirect("home")
addReleaseById.exposed = True
def updateCloud(self):
lastfm.getSimilar()
raise cherrypy.HTTPRedirect("extras")
updateCloud.exposed = True
def api(self, *args, **kwargs):
from headphones.api import Api
a = Api()
a.checkParams(*args, **kwargs)
data = a.fetchData()
return data
api.exposed = True
def getInfo(self, ArtistID=None, AlbumID=None):
from headphones import cache
info_dict = cache.getInfo(ArtistID, AlbumID)
return simplejson.dumps(info_dict)
getInfo.exposed = True
def getArtwork(self, ArtistID=None, AlbumID=None):
from headphones import cache
return cache.getArtwork(ArtistID, AlbumID)
getArtwork.exposed = True
def getThumb(self, ArtistID=None, AlbumID=None):
from headphones import cache
return cache.getThumb(ArtistID, AlbumID)
getThumb.exposed = True
# If you just want to get the last.fm image links for an album, make sure to pass a releaseid and not a releasegroupid
def getImageLinks(self, ArtistID=None, AlbumID=None):
from headphones import cache
image_dict = cache.getImageLinks(ArtistID, AlbumID)
return simplejson.dumps(image_dict)
getImageLinks.exposed = True
class Artwork(object):
@@ -978,7 +979,7 @@ class Artwork(object):
ArtistID = ID
elif ArtistOrAlbum == "album":
AlbumID = ID
relpath = cache.getArtwork(ArtistID,AlbumID)
if not relpath:
@@ -1011,7 +1012,7 @@ class Artwork(object):
ArtistID = ID
elif ArtistOrAlbum == "album":
AlbumID = ID
relpath = cache.getThumb(ArtistID,AlbumID)
if not relpath:
@@ -1031,8 +1032,8 @@ class Artwork(object):
f = open(path,'rb')
return f.read()
default.exposed = True
thumbs = Thumbs()
WebInterface.artwork = Artwork()