From ad079e9ac9231f9a67f06e5e9c93a04271f9b8cc Mon Sep 17 00:00:00 2001 From: rembo10 Date: Sat, 6 Jul 2013 01:01:59 +0530 Subject: [PATCH] Initial changes to get NZBget working alongside sab & blackhole (mostly UI change, but updated logic --- data/interfaces/default/config.html | 111 ++++++++++++++++++---------- headphones/__init__.py | 12 ++- headphones/webserve.py | 18 ++--- 3 files changed, 86 insertions(+), 55 deletions(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 0979904d..1c89d2c9 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -104,9 +104,12 @@
- + - + +
+
+ + + Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music +
+
+
+
+ + + Folder your Download program watches for NZBs +
+
+ +
+ +
+ @@ -367,9 +362,9 @@
Quality
- - - + + + Preferred Bitrate: kbps
Reject if less than % or more than % of the target size (leave blank for no limit)

@@ -1042,16 +1037,52 @@ { $("#preferred_bitrate_options").hide(); } - + + if ($("#nzb_downloader_sabnzbd").is(":checked")) + { + $("#sabnzbd_options,#nzb_download_dir").show(); + $("#nzbget_options,#blackhole_options").hide(); + } + if ($("#nzb_downloader_nzbget").is(":checked")) + { + $("#sabnzbd_options,#blackhole_options").hide(); + $("#nzbget_options,#nzb_download_dir").show(); + } + if ($("#nzb_downloader_blackhole").is(":checked")) + { + $("#sabnzbd_options,#nzbget_options,#nzb_download_dir").hide(); + $("#blackhole_options").show(); + } + $('input[type=radio]').change(function(){ if ($("#preferred_bitrate").is(":checked")) { $("#preferred_bitrate_options").slideDown("fast"); } - else + if ($("#preferred_quality0").is(":checked")) { $("#preferred_bitrate_options").slideUp("fast"); } + if ($("#preferred_quality1").is(":checked")) + { + $("#preferred_bitrate_options").slideUp("fast"); + } + if ($("#preferred_quality3").is(":checked")) + { + $("#preferred_bitrate_options").slideUp("fast"); + } + if ($("#nzb_downloader_sabnzbd").is(":checked")) + { + $("#nzbget_options,#blackhole_options").fadeOut("fast", function() { $("#sabnzbd_options,#nzb_download_dir").fadeIn() }); + } + if ($("#nzb_downloader_nzbget").is(":checked")) + { + $("#sabnzbd_options,#blackhole_options").fadeOut("fast", function() { $("#nzbget_options,#nzb_download_dir").fadeIn() }); + } + if ($("#nzb_downloader_blackhole").is(":checked")) + { + $("#sabnzbd_options,#nzbget_options,#nzb_download_dir").fadeOut("fast", function() { $("#blackhole_options").fadeIn() }); + } }); $("#mirror").change(handleNewServerSelection); diff --git a/headphones/__init__.py b/headphones/__init__.py index 3dce3f57..42906fe9 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -109,6 +109,7 @@ ADD_ALBUM_ART = False ALBUM_ART_FORMAT = None EMBED_ALBUM_ART = False EMBED_LYRICS = False +NZB_DOWNLOADER = None DOWNLOAD_DIR = None BLACKHOLE = None BLACKHOLE_DIR = None @@ -294,7 +295,7 @@ def initialize(): 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, \ - PREFERRED_WORDS, REQUIRED_WORDS, IGNORED_WORDS, \ + 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, \ PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_KEYS, PUSHOVER_ONSNATCH, MIRRORLIST, \ @@ -375,6 +376,7 @@ def initialize(): ALBUM_ART_FORMAT = check_setting_str(CFG, 'General', 'album_art_format', 'folder') EMBED_ALBUM_ART = bool(check_setting_int(CFG, 'General', 'embed_album_art', 0)) EMBED_LYRICS = bool(check_setting_int(CFG, 'General', 'embed_lyrics', 0)) + NZB_DOWNLOADER = check_setting_int(CFG, 'General', 'nzb_downloader', 0) DOWNLOAD_DIR = check_setting_str(CFG, 'General', 'download_dir', '') BLACKHOLE = bool(check_setting_int(CFG, 'General', 'blackhole', 0)) BLACKHOLE_DIR = check_setting_str(CFG, 'General', 'blackhole_dir', '') @@ -552,6 +554,12 @@ 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' if not LOG_DIR: LOG_DIR = os.path.join(DATA_DIR, 'logs') @@ -712,8 +720,8 @@ def config_write(): new_config['General']['album_art_format'] = ALBUM_ART_FORMAT new_config['General']['embed_album_art'] = int(EMBED_ALBUM_ART) new_config['General']['embed_lyrics'] = int(EMBED_LYRICS) + new_config['General']['nzb_downloader'] = NZB_DOWNLOADER new_config['General']['download_dir'] = DOWNLOAD_DIR - new_config['General']['blackhole'] = int(BLACKHOLE) new_config['General']['blackhole_dir'] = BLACKHOLE_DIR new_config['General']['usenet_retention'] = USENET_RETENTION new_config['General']['include_extras'] = int(INCLUDE_EXTRAS) diff --git a/headphones/webserve.py b/headphones/webserve.py index 66ff59e1..6d1a0f12 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -579,13 +579,13 @@ class WebInterface(object): "nzbget_user" : headphones.NZBGET_USERNAME, "nzbget_pass" : headphones.NZBGET_PASSWORD, "nzbget_cat" : headphones.NZBGET_CATEGORY, + "nzb_downloader_sabnzbd" : radio(headphones.NZB_DOWNLOADER, 0), + "nzb_downloader_nzbget" : radio(headphones.NZB_DOWNLOADER, 1), + "nzb_downloader_blackhole" : radio(headphones.NZB_DOWNLOADER, 2), "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, @@ -594,9 +594,6 @@ class WebInterface(object): "use_nzbsorg" : checked(headphones.NZBSORG), "nzbsorg_uid" : headphones.NZBSORG_UID, "nzbsorg_hash" : headphones.NZBSORG_HASH, -# "use_newzbin" : checked(headphones.NEWZBIN), -# "newzbin_uid" : headphones.NEWZBIN_UID, -# "newzbin_pass" : headphones.NEWZBIN_PASSWORD, "use_nzbsrus" : checked(headphones.NZBSRUS), "nzbsrus_uid" : headphones.NZBSRUS_UID, "nzbsrus_apikey" : headphones.NZBSRUS_APIKEY, @@ -708,7 +705,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, 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, + 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, 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, @@ -740,13 +737,11 @@ class WebInterface(object): headphones.NZBGET_USERNAME = nzbget_username headphones.NZBGET_PASSWORD = nzbget_password headphones.NZBGET_CATEGORY = nzbget_category + headphones.NZB_DOWNLOADER = int(nzb_downloader) headphones.DOWNLOAD_DIR = download_dir headphones.BLACKHOLE = blackhole headphones.BLACKHOLE_DIR = blackhole_dir headphones.USENET_RETENTION = usenet_retention -# headphones.NZBMATRIX = nzbmatrix -# headphones.NZBMATRIX_USERNAME = nzbmatrix_username -# headphones.NZBMATRIX_APIKEY = nzbmatrix_apikey headphones.NEWZNAB = newznab headphones.NEWZNAB_HOST = newznab_host headphones.NEWZNAB_APIKEY = newznab_apikey @@ -754,9 +749,6 @@ class WebInterface(object): headphones.NZBSORG = nzbsorg headphones.NZBSORG_UID = nzbsorg_uid headphones.NZBSORG_HASH = nzbsorg_hash -# headphones.NEWZBIN = newzbin -# headphones.NEWZBIN_UID = newzbin_uid -# headphones.NEWZBIN_PASSWORD = newzbin_password headphones.NZBSRUS = nzbsrus headphones.NZBSRUS_UID = nzbsrus_uid headphones.NZBSRUS_APIKEY = nzbsrus_apikey
-
- SABnzbd +
+
+ Usenet + Sabnzbd NZBget Blackhole +
+
@@ -116,7 +119,7 @@
-
+
@@ -128,20 +131,9 @@
-
-
- Downloads -
- - - Full path where SAB or NZBget downloads your music. e.g. /Users/name/Downloads/music -
-
-
-
- NZBget +
@@ -151,7 +143,7 @@
-
+
@@ -160,8 +152,27 @@
-
Torrents @@ -185,22 +196,6 @@
-
- Usenet -
- -
-
-
- - - Folder your Download program watches for NZBs -
-
-
- -
-