mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 12:19:27 +00:00
Merge remote-tracking branch 'sjengfred/master' into develop
This commit is contained in:
@@ -187,7 +187,7 @@
|
||||
<!--Download Settings-->
|
||||
<div id="DownloadSettings">
|
||||
<h1><span class="wsr">u</span>Download Settings</h1>
|
||||
<small>Setup SABnzbd or BitTorrent</small>
|
||||
<small>Setup SABnzbd, NZBGET or BitTorrent</small>
|
||||
|
||||
<!--Sabnzdb-->
|
||||
<div>
|
||||
@@ -230,7 +230,7 @@
|
||||
<tr>
|
||||
<td>
|
||||
<label for="download_dir">Download Directory:</label>
|
||||
<br /><small>Full path to the directory where SAB downloads your music.</small>
|
||||
<br /><small>Full path to the directory where SAB or NZBget downloads your music.</small>
|
||||
</td>
|
||||
<td><input type="text" name="download_dir" value="${config['download_dir']}" size="40" /></td>
|
||||
</tr>
|
||||
@@ -238,6 +238,44 @@
|
||||
</div>
|
||||
<!--end Sabnzdb-->
|
||||
|
||||
<!--NZBget-->
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h2>NZBget</h2>
|
||||
<small></small>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="nzbget_host">Host:</label>
|
||||
<br /><small>Usually http://localhost:6789</small>
|
||||
</td>
|
||||
<td><input type="text" name="nzbget_host" value="${config['nzbget_host']}" size="30" maxlength="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="nzbget_username">Username:</label>
|
||||
<br /><small>Type the user name for NZBget</small>
|
||||
</td>
|
||||
<td><input type="text" name="nzbget_username" value="${config['nzbget_user']}" size="20" maxlength="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="nzbget_password">Password:</label>
|
||||
<br /><small>Enter the password for NZBget</small>
|
||||
</td>
|
||||
<td><input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20" maxlength="40" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="nzbget_category">Category:</label>
|
||||
<small>Write the category label name from NZBget</small>
|
||||
</td>
|
||||
<td><input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20" maxlength="40" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<!--end NZBget-->
|
||||
|
||||
<!--Torrents-->
|
||||
<div>
|
||||
<table>
|
||||
|
||||
@@ -116,10 +116,36 @@
|
||||
<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 class="smalltext">Full path to the directory where SAB or NZBget downloads your music<br>
|
||||
e.g. /Users/name/Downloads/music</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h2>NZBget:</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>NZBget Host:</h3><input type="text" name="nzbget_host" value="${config['nzbget_host']}" size="30" maxlength="40"><br>
|
||||
|
||||
<i class="smalltext">usually http://localhost:6789</i>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<h3>NZBget Username:</h3><input type="text" name="nzbget_username" value="${config['nzbget_user']}" size="20" maxlength="40">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h3>NZBget Password:</h3><input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20" maxlength="40">
|
||||
</td>
|
||||
<td>
|
||||
<h3>NZBget Category:</h3><input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20" maxlength="40">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -134,10 +134,33 @@
|
||||
<div class="row">
|
||||
<label>Music Download Directory:</label>
|
||||
<input type="text" name="download_dir" value="${config['download_dir']}" size="50">
|
||||
<small>Full path where SAB downloads your music. e.g. /Users/name/Downloads/music</small>
|
||||
<small>Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend>NZBget</legend>
|
||||
<div class="row">
|
||||
<label>NZBget Host:</label>
|
||||
<input type="text" name="nzbget_host" value="${config['nzbget_host']}" size="30">
|
||||
<small>usually http://localhost:6789</small>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>NZBget Username</label>
|
||||
<input type="text" name="nzbget_username" value="${config['nzbget_user']}" size="20">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>NZBget Password:</label>
|
||||
<input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20">
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>NZBget Category:</label>
|
||||
<input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20">
|
||||
</div>
|
||||
</fieldset>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<fieldset>
|
||||
|
||||
@@ -116,10 +116,36 @@
|
||||
<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 class="smalltext">Full path to the directory where SAB or NZBget downloads your music<br>
|
||||
e.g. /Users/name/Downloads/music</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h2>NZBget:</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>NZBget Host:</h3><input type="text" name="nzbget_host" value="${config['nzbget_host']}" size="30" maxlength="40"><br>
|
||||
|
||||
<i class="smalltext">usually http://localhost:6789</i>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<h3>NZBget Username:</h3><input type="text" name="nzbget_username" value="${config['nzbget_user']}" size="20" maxlength="40">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h3>NZBget Password:</h3><input type="password" name="nzbget_password" value="${config['nzbget_pass']}" size="20" maxlength="40">
|
||||
</td>
|
||||
<td>
|
||||
<h3>NZBget Category:</h3><input type="text" name="nzbget_category" value="${config['nzbget_cat']}" size="20" maxlength="40">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# NZBGet support added by CurlyMo <development@xbian.org> as a part of XBian - XBMC on the Raspberry Pi
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import os, sys, subprocess
|
||||
@@ -128,6 +130,11 @@ SAB_PASSWORD = None
|
||||
SAB_APIKEY = None
|
||||
SAB_CATEGORY = None
|
||||
|
||||
NZBGET_USERNAME = None
|
||||
NZBGET_PASSWORD = None
|
||||
NZBGET_CATEGORY = None
|
||||
NZBGET_HOST = None
|
||||
|
||||
NZBMATRIX = False
|
||||
NZBMATRIX_USERNAME = None
|
||||
NZBMATRIX_APIKEY = None
|
||||
@@ -285,7 +292,7 @@ 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, \
|
||||
NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, NEWZNAB_ENABLED, EXTRA_NEWZNABS, \
|
||||
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, \
|
||||
PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \
|
||||
LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, ENCODERFOLDER, ENCODER_PATH, ENCODER, XLDPROFILE, BITRATE, SAMPLINGFREQUENCY, \
|
||||
@@ -302,6 +309,7 @@ def initialize():
|
||||
# Make sure all the config sections exist
|
||||
CheckSection('General')
|
||||
CheckSection('SABnzbd')
|
||||
CheckSection('NZBget')
|
||||
CheckSection('NZBMatrix')
|
||||
CheckSection('Newznab')
|
||||
CheckSection('NZBsorg')
|
||||
@@ -407,6 +415,11 @@ def initialize():
|
||||
SAB_APIKEY = check_setting_str(CFG, 'SABnzbd', 'sab_apikey', '')
|
||||
SAB_CATEGORY = check_setting_str(CFG, 'SABnzbd', 'sab_category', '')
|
||||
|
||||
NZBGET_USERNAME = check_setting_str(CFG, 'NZBget', 'nzbget_username', 'nzbget')
|
||||
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', '')
|
||||
|
||||
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', '')
|
||||
@@ -742,6 +755,12 @@ 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['NZBMatrix'] = {}
|
||||
new_config['NZBMatrix']['nzbmatrix'] = int(NZBMATRIX)
|
||||
|
||||
85
headphones/nzbget.py
Normal file
85
headphones/nzbget.py
Normal file
@@ -0,0 +1,85 @@
|
||||
# This file is modified to work with headphones by CurlyMo <development@xbian.org> as a part of XBian - XBMC on the Raspberry Pi
|
||||
|
||||
# Author: Nic Wolfe <nic@wolfeden.ca>
|
||||
# URL: http://code.google.com/p/sickbeard/
|
||||
#
|
||||
# This file is part of Sick Beard.
|
||||
#
|
||||
# Sick Beard is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Sick Beard is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
import httplib
|
||||
import datetime
|
||||
|
||||
import headphones
|
||||
|
||||
from base64 import standard_b64encode
|
||||
import xmlrpclib
|
||||
|
||||
#from headphones.providers.generic import GenericProvider
|
||||
|
||||
from headphones import logger
|
||||
|
||||
def sendNZB(nzb):
|
||||
|
||||
addToTop = False
|
||||
nzbgetXMLrpc = "http://%(username)s:%(password)s@%(host)s/xmlrpc"
|
||||
|
||||
if headphones.NZBGET_HOST == None:
|
||||
logger.error(u"No NZBget host found in configuration. Please configure it.")
|
||||
return False
|
||||
|
||||
url = nzbgetXMLrpc % {"host": headphones.NZBGET_HOST, "username": headphones.NZBGET_USERNAME, "password": headphones.NZBGET_PASSWORD}
|
||||
|
||||
nzbGetRPC = xmlrpclib.ServerProxy(url)
|
||||
try:
|
||||
if nzbGetRPC.writelog("INFO", "headphones connected to drop of %s any moment now." % (nzb.name + ".nzb")):
|
||||
logger.debug(u"Successful connected to NZBget")
|
||||
else:
|
||||
logger.error(u"Successful connected to NZBget, but unable to send a message" % (nzb.name + ".nzb"))
|
||||
|
||||
except httplib.socket.error:
|
||||
logger.error(u"Please check your NZBget host and port (if it is running). NZBget is not responding to this combination")
|
||||
return False
|
||||
|
||||
except xmlrpclib.ProtocolError, e:
|
||||
if (e.errmsg == "Unauthorized"):
|
||||
logger.error(u"NZBget password is incorrect.")
|
||||
else:
|
||||
logger.error(u"Protocol Error: " + e.errmsg)
|
||||
return False
|
||||
|
||||
# if it's a normal result need to download the NZB content
|
||||
if nzb.resultType == "nzb":
|
||||
genProvider = GenericProvider("")
|
||||
data = genProvider.getURL(nzb.url)
|
||||
if (data == None):
|
||||
return False
|
||||
|
||||
# if we get a raw data result thats even better
|
||||
elif nzb.resultType == "nzbdata":
|
||||
data = nzb.extraInfo[0]
|
||||
|
||||
nzbcontent64 = standard_b64encode(data)
|
||||
|
||||
logger.error(u"Sending NZB to NZBget")
|
||||
logger.debug(u"URL: " + url)
|
||||
|
||||
if nzbGetRPC.append(nzb.name + ".nzb", headphones.NZBGET_CATEGORY, addToTop, nzbcontent64):
|
||||
logger.debug(u"NZB sent to NZBget successfully")
|
||||
return True
|
||||
else:
|
||||
logger.error(u"NZBget could not add %s to the queue" % (nzb.name + ".nzb"))
|
||||
return False
|
||||
@@ -13,6 +13,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# NZBGet support added by CurlyMo <development@xbian.org> as a part of XBian - XBMC on the Raspberry Pi
|
||||
|
||||
import urllib, urllib2, urlparse, httplib
|
||||
import lib.feedparser as feedparser
|
||||
from lib.pygazelle import api as gazelleapi
|
||||
@@ -29,7 +31,7 @@ import os, re, time
|
||||
import string
|
||||
|
||||
import headphones, exceptions
|
||||
from headphones import logger, db, helpers, classes, sab
|
||||
from headphones import logger, db, helpers, classes, sab, nzbget
|
||||
|
||||
import lib.bencode as bencode
|
||||
|
||||
@@ -109,7 +111,7 @@ def searchforalbum(albumid=None, new=False, lossless=False):
|
||||
|
||||
for result in results:
|
||||
foundNZB = "none"
|
||||
if (headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBX or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE):
|
||||
if (headphones.NEWZNAB or headphones.NZBSORG or headphones.NZBX or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE or headphones.NZBGET_HOST):
|
||||
if result['Status'] == "Wanted Lossless":
|
||||
foundNZB = searchNZB(result['AlbumID'], new, losslessOnly=True)
|
||||
else:
|
||||
@@ -125,7 +127,7 @@ def searchforalbum(albumid=None, new=False, lossless=False):
|
||||
else:
|
||||
|
||||
foundNZB = "none"
|
||||
if (headphones.NZBMATRIX or headphones.NEWZNAB or headphones.NZBSORG or headphones.NEWZBIN or headphones.NZBX or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE):
|
||||
if (headphones.NZBMATRIX or headphones.NEWZNAB or headphones.NZBSORG or headphones.NEWZBIN or headphones.NZBX or headphones.NZBSRUS) and (headphones.SAB_HOST or headphones.BLACKHOLE or headphones.NZBGET_HOST):
|
||||
foundNZB = searchNZB(albumid, new, lossless)
|
||||
|
||||
if (headphones.KAT or headphones.ISOHUNT or headphones.MININOVA or headphones.WAFFLES or headphones.RUTRACKER or headphones.WHATCD) and foundNZB == "none":
|
||||
@@ -533,7 +535,14 @@ def searchNZB(albumid=None, new=False, losslessOnly=False):
|
||||
logger.info(u'Found best result: <a href="%s">%s</a> - %s' % (bestqual[2], bestqual[0], helpers.bytes_to_mb(bestqual[1])))
|
||||
# Get rid of any dodgy chars here so we can prevent sab from renaming our downloads
|
||||
nzb_folder_name = helpers.sab_sanitize_foldername(bestqual[0])
|
||||
if headphones.SAB_HOST and not headphones.BLACKHOLE:
|
||||
if headphones.NZBGET_HOST and not headphones.BLACKHOLE and not headphones.SAB_HOST:
|
||||
|
||||
nzb = classes.NZBDataSearchResult()
|
||||
nzb.extraInfo.append(data)
|
||||
nzb.name = nzb_folder_name
|
||||
nzbget.sendNZB(nzb)
|
||||
|
||||
elif headphones.SAB_HOST and not headphones.BLACKHOLE and not headphones.NZBGET_HOST:
|
||||
|
||||
nzb = classes.NZBDataSearchResult()
|
||||
nzb.extraInfo.append(data)
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Headphones. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# NZBGet support added by CurlyMo <development@xbian.org> as a part of XBian - XBMC on the Raspberry Pi
|
||||
|
||||
import os
|
||||
import cherrypy
|
||||
|
||||
@@ -573,6 +575,10 @@ class WebInterface(object):
|
||||
"sab_api" : headphones.SAB_APIKEY,
|
||||
"sab_pass" : headphones.SAB_PASSWORD,
|
||||
"sab_cat" : headphones.SAB_CATEGORY,
|
||||
"nzbget_host" : headphones.NZBGET_HOST,
|
||||
"nzbget_user" : headphones.NZBGET_USERNAME,
|
||||
"nzbget_pass" : headphones.NZBGET_PASSWORD,
|
||||
"nzbget_cat" : headphones.NZBGET_CATEGORY,
|
||||
"download_dir" : headphones.DOWNLOAD_DIR,
|
||||
"use_blackhole" : checked(headphones.BLACKHOLE),
|
||||
"blackhole_dir" : headphones.BLACKHOLE_DIR,
|
||||
@@ -702,7 +708,7 @@ class WebInterface(object):
|
||||
|
||||
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, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, newznab=0, newznab_host=None, newznab_apikey=None,
|
||||
sab_category=None, nzbget_host=None, nzbget_username='nzbget', nzbget_password=None, nzbget_category=None, 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,
|
||||
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,
|
||||
@@ -730,6 +736,10 @@ class WebInterface(object):
|
||||
headphones.SAB_PASSWORD = sab_password
|
||||
headphones.SAB_APIKEY = sab_apikey
|
||||
headphones.SAB_CATEGORY = sab_category
|
||||
headphones.NZBGET_HOST = nzbget_host
|
||||
headphones.NZBGET_USERNAME = nzbget_username
|
||||
headphones.NZBGET_PASSWORD = nzbget_password
|
||||
headphones.NZBGET_CATEGORY = nzbget_category
|
||||
headphones.DOWNLOAD_DIR = download_dir
|
||||
headphones.BLACKHOLE = blackhole
|
||||
headphones.BLACKHOLE_DIR = blackhole_dir
|
||||
|
||||
Reference in New Issue
Block a user