From ebf19914b46a9216a594fb7ae57d7dd639ec1d75 Mon Sep 17 00:00:00 2001
From: rembo10
Date: Mon, 9 Apr 2012 12:10:37 +0530
Subject: [PATCH] Added option to mark all albums as wanted, updated config
pages with new options
---
data/interfaces/brink/config.html | 57 +++++++++++++++++++-
data/interfaces/default/config.html | 3 +-
data/interfaces/remix/config.html | 80 +++++++++++++++++++++++------
headphones/__init__.py | 11 ++--
headphones/importer.py | 4 +-
headphones/webserve.py | 8 +--
6 files changed, 137 insertions(+), 26 deletions(-)
diff --git a/data/interfaces/brink/config.html b/data/interfaces/brink/config.html
index 8ab21c0b..ce10c1eb 100644
--- a/data/interfaces/brink/config.html
+++ b/data/interfaces/brink/config.html
@@ -448,8 +448,14 @@
Automatically Include Extras When Adding an Artist
- (EPs, Compilations, Live Albums, Remix Albums and Singles)
-
+ (EPs, Compilations, Live Albums, Remix Albums and Singles)
+
+ Automatically Mark Upcoming Albums as Wanted
+
+
+ Automatically Mark All Albums as Wanted
+
+
Interface:
@@ -608,6 +614,34 @@
Update XBMC Library
Send Notification to XBMC
+ Enable NotifyMyAndroid
+
+
NotifyMyAndroid API Key:
+ Separate multiple api keys with commas
+ Priority:
+ %for x in [-2,-1,0,1,2]:
+ <%
+ if config['nma_priority'] == x:
+ nma_priority_selected = 'selected'
+ else:
+ nma_priority_selected = ''
+
+ if x == -2:
+ nma_priority_value = 'Very Low'
+ elif x == -1:
+ nma_priority_value = 'Moderate'
+ elif x == 0:
+ nma_priority_value = 'Normal'
+ elif x == 1:
+ nma_priority_value = 'High'
+ else:
+ nma_priority_value = 'Emergency'
+ %>
+
+ %endfor
+
+
+
@@ -764,6 +798,25 @@
}
});
+ if ($("#nma").is(":checked"))
+ {
+ $("#nmaoptions").show();
+ }
+ else
+ {
+ $("#nmaoptions").hide();
+ }
+
+ $("#nma").click(function(){
+ if ($("#nma").is(":checked"))
+ {
+ $("#nmaoptions").show("fast");
+ }
+ else
+ {
+ $("#nmaoptions").hide("fast");
+ }
+ });
$("#mirror").change(handleNewSelection);
handleNewSelection.apply($("#mirror"));
diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html
index b7c756c3..dae45c58 100644
--- a/data/interfaces/default/config.html
+++ b/data/interfaces/default/config.html
@@ -326,7 +326,8 @@
Automatically Include Extras When Adding an Artist
(EPs, Compilations, Live Albums, Remix Albums and Singles)
- Automatically Mark Upcoming Albums as Wanted
+ Automatically Mark Upcoming Albums as Wanted
+ Automatically Mark All Albums as Wanted
Interface:
@@ -456,6 +458,34 @@
XBMC Password:
Update XBMC Library
Send Notification to XBMC
+
+ Enable NotifyMyAndroid
+
+
NotifyMyAndroid API Key:
+ Separate multiple api keys with commas
+ Priority:
+ %for x in [-2,-1,0,1,2]:
+ <%
+ if config['nma_priority'] == x:
+ nma_priority_selected = 'selected'
+ else:
+ nma_priority_selected = ''
+
+ if x == -2:
+ nma_priority_value = 'Very Low'
+ elif x == -1:
+ nma_priority_value = 'Moderate'
+ elif x == 0:
+ nma_priority_value = 'Normal'
+ elif x == 1:
+ nma_priority_value = 'High'
+ else:
+ nma_priority_value = 'Emergency'
+ %>
+
+ %endfor
+
+
@@ -610,6 +640,26 @@
}
});
+ if ($("#nma").is(":checked"))
+ {
+ $("#nmaoptions").show();
+ }
+ else
+ {
+ $("#nmaoptions").hide();
+ }
+
+ $("#nma").click(function(){
+ if ($("#nma").is(":checked"))
+ {
+ $("#nmaoptions").show("fast");
+ }
+ else
+ {
+ $("#nmaoptions").hide("fast");
+ }
+ });
+
$("#mirror").change(handleNewSelection);
handleNewSelection.apply($("#mirror"));
diff --git a/headphones/__init__.py b/headphones/__init__.py
index 5afa87f3..6985d996 100644
--- a/headphones/__init__.py
+++ b/headphones/__init__.py
@@ -83,7 +83,8 @@ BLACKHOLE = None
BLACKHOLE_DIR = None
USENET_RETENTION = None
INCLUDE_EXTRAS = False
-AUTOMARK_WANTED = False
+AUTOWANT_UPCOMING = False
+AUTOWANT_ALL = False
SEARCH_INTERVAL = 360
LIBRARYSCAN_INTERVAL = 300
@@ -211,7 +212,7 @@ def initialize():
global __INITIALIZED__, FULL_PATH, PROG_DIR, VERBOSE, DAEMON, DATA_DIR, CONFIG_FILE, CFG, CONFIG_VERSION, LOG_DIR, CACHE_DIR, \
HTTP_PORT, HTTP_HOST, HTTP_USERNAME, HTTP_PASSWORD, HTTP_ROOT, LAUNCH_BROWSER, API_ENABLED, API_KEY, GIT_PATH, \
CURRENT_VERSION, LATEST_VERSION, MUSIC_DIR, DESTINATION_DIR, PREFERRED_QUALITY, PREFERRED_BITRATE, DETECT_BITRATE, \
- ADD_ARTISTS, CORRECT_METADATA, MOVE_FILES, RENAME_FILES, FOLDER_FORMAT, FILE_FORMAT, CLEANUP_FILES, INCLUDE_EXTRAS, AUTOMARK_WANTED, \
+ ADD_ARTISTS, CORRECT_METADATA, MOVE_FILES, RENAME_FILES, FOLDER_FORMAT, FILE_FORMAT, CLEANUP_FILES, INCLUDE_EXTRAS, AUTOWANT_UPCOMING, AUTOWANT_ALL, \
ADD_ALBUM_ART, EMBED_ALBUM_ART, EMBED_LYRICS, DOWNLOAD_DIR, BLACKHOLE, BLACKHOLE_DIR, USENET_RETENTION, SEARCH_INTERVAL, \
TORRENTBLACKHOLE_DIR, NUMBEROFSEEDERS, ISOHUNT, KAT, MININOVA, DOWNLOAD_TORRENT_DIR, \
LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \
@@ -276,7 +277,8 @@ def initialize():
BLACKHOLE_DIR = check_setting_str(CFG, 'General', 'blackhole_dir', '')
USENET_RETENTION = check_setting_int(CFG, 'General', 'usenet_retention', '')
INCLUDE_EXTRAS = bool(check_setting_int(CFG, 'General', 'include_extras', 0))
- AUTOMARK_WANTED = bool(check_setting_int(CFG, 'General', 'automark_wanted', 1))
+ AUTOWANT_UPCOMING = bool(check_setting_int(CFG, 'General', 'autowant_upcoming', 1))
+ AUTOWANT_ALL = bool(check_setting_int(CFG, 'General', 'autowant_all', 0))
SEARCH_INTERVAL = check_setting_int(CFG, 'General', 'search_interval', 360)
LIBRARYSCAN_INTERVAL = check_setting_int(CFG, 'General', 'libraryscan_interval', 300)
@@ -498,7 +500,8 @@ def config_write():
new_config['General']['blackhole_dir'] = BLACKHOLE_DIR
new_config['General']['usenet_retention'] = USENET_RETENTION
new_config['General']['include_extras'] = int(INCLUDE_EXTRAS)
- new_config['General']['automark_wanted'] = int(AUTOMARK_WANTED)
+ new_config['General']['autowant_upcoming'] = int(AUTOWANT_UPCOMING)
+ new_config['General']['autowant_all'] = int(AUTOWANT_ALL)
new_config['General']['numberofseeders'] = NUMBEROFSEEDERS
new_config['General']['torrentblackhole_dir'] = TORRENTBLACKHOLE_DIR
diff --git a/headphones/importer.py b/headphones/importer.py
index becb33f4..c123df0a 100644
--- a/headphones/importer.py
+++ b/headphones/importer.py
@@ -156,7 +156,9 @@ def addArtisttoDB(artistid, extrasonly=False):
"Type": rg['type']
}
- if release_dict['releasedate'] > helpers.today() and headphones.AUTOMARK_WANTED:
+ if headphones.AUTOWANT_ALL:
+ newValueDict['Status'] = "Wanted"
+ elif release_dict['releasedate'] > helpers.today() and headphones.AUTOWANT_UPCOMING:
newValueDict['Status'] = "Wanted"
else:
newValueDict['Status'] = "Skipped"
diff --git a/headphones/webserve.py b/headphones/webserve.py
index aad58320..32459a27 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -383,7 +383,8 @@ class WebInterface(object):
"folder_format" : headphones.FOLDER_FORMAT,
"file_format" : headphones.FILE_FORMAT,
"include_extras" : checked(headphones.INCLUDE_EXTRAS),
- "automark_wanted" : checked(headphones.AUTOMARK_WANTED),
+ "autowant_upcoming" : checked(headphones.AUTOWANT_UPCOMING),
+ "autowant_all" : checked(headphones.AUTOWANT_ALL),
"log_dir" : headphones.LOG_DIR,
"interface_list" : interface_list,
"encode": checked(headphones.ENCODE),
@@ -426,7 +427,7 @@ class WebInterface(object):
usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, newznab=0, newznab_host=None, newznab_apikey=None,
nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, newzbin=0, newzbin_uid=None, newzbin_password=None, preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0,
torrentblackhole_dir=None, download_torrent_dir=None, numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0,
- rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, interface=None, log_dir=None,
+ rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None,
encode=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=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, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None):
@@ -482,7 +483,8 @@ class WebInterface(object):
headphones.FOLDER_FORMAT = folder_format
headphones.FILE_FORMAT = file_format
headphones.INCLUDE_EXTRAS = include_extras
- headphones.AUTOMARK_WANTED = automark_wanted
+ headphones.AUTOWANT_UPCOMING = autowant_upcoming
+ headphones.AUTOWANT_ALL = autowant_all
headphones.INTERFACE = interface
headphones.LOG_DIR = log_dir
headphones.ENCODE = encode