From 44acaf75992f798c7b95d6ba6695e52425cda8be Mon Sep 17 00:00:00 2001 From: gotson Date: Fri, 28 Mar 2014 17:37:19 +0800 Subject: [PATCH 1/7] Songkick API key now properly stored in config.ini (and empty by default) Added possibility to filter Songkick results per location (so far using a metro-area id) --- data/interfaces/default/artist.html | 9 ++++++++- data/interfaces/default/config.html | 29 +++++++++++++++++++++++++++++ headphones/__init__.py | 15 +++++++++++++-- headphones/webserve.py | 8 ++++++-- 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index d57233d1..178d7b94 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -178,7 +178,14 @@ $.getJSON("http://api.songkick.com/api/3.0/artists/mbid:${artist['ArtistID']}/calendar.json?apikey=${headphones.SONGKICK_APIKEY}&jsoncallback=?", function(data){ - if (data['resultsPage'].totalEntries >= 1) { + if (data['resultsPage'].totalEntries >= 1) { + + if( ${headphones.SONGKICK_FILTER_ENABLED} ) { + data.resultsPage.results.event = $.grep(data.resultsPage.results.event, function(element,index){ + return element.venue.metroArea.id == ${headphones.SONGKICK_LOCATION}; + }); + } + var tourDate; calendarDomNode.show(); diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 7417aab3..f9e00ea8 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -974,6 +974,15 @@ +
+ +
+
+
+ + +
+
@@ -1327,6 +1336,26 @@ $("#twitteroptions").slideUp(); } }); + + if ($("#songkick_filter").is(":checked")) + { + $("#songkick_filteroptions").show(); + } + else + { + $("#songkick_filteroptions").hide(); + } + + $("#songkick_filter").click(function(){ + if ($("#songkick_filter").is(":checked")) + { + $("#songkick_filteroptions").slideDown(); + } + else + { + $("#songkick_filteroptions").slideUp(); + } + }); if ($("#preferred_bitrate").is(":checked")) { diff --git a/headphones/__init__.py b/headphones/__init__.py index 45301577..16836bde 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -265,7 +265,9 @@ CUSTOMPORT = None CUSTOMSLEEP = None HPUSER = None HPPASS = None -SONGKICK_APIKEY = "nd1We7dFW2RqxPw8" +SONGKICK_APIKEY = None +SONGKICK_LOCATION = None +SONGKICK_FILTER_ENABLED = False CACHE_SIZEMB = 32 JOURNAL_MODE = None @@ -342,7 +344,7 @@ def initialize(): MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \ XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \ PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB, JOURNAL_MODE, UMASK, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \ - PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, \ + PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, SONGKICK_APIKEY, SONGKICK_LOCATION, SONGKICK_FILTER_ENABLED, \ POST_PROCESSING_DIR @@ -580,6 +582,10 @@ def initialize(): TWITTER_USERNAME = check_setting_str(CFG, 'Twitter', 'twitter_username', '') TWITTER_PASSWORD = check_setting_str(CFG, 'Twitter', 'twitter_password', '') TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'Headphones') + + SONGKICK_APIKEY = check_setting_str(CFG, 'Songkick', 'songkick_apikey', '') + SONGKICK_LOCATION = check_setting_str(CFG, 'Songkick', 'songkick_location', '') + SONGKICK_FILTER_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_filter_enabled', 0)) MIRROR = check_setting_str(CFG, 'General', 'mirror', 'musicbrainz.org') CUSTOMHOST = check_setting_str(CFG, 'General', 'customhost', 'localhost') @@ -975,6 +981,11 @@ def config_write(): new_config['Twitter']['twitter_password'] = TWITTER_PASSWORD new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX + new_config['Songkick'] = {} + new_config['Songkick']['songkick_apikey'] = SONGKICK_APIKEY + new_config['Songkick']['songkick_location'] = SONGKICK_LOCATION + new_config['Songkick']['songkick_filter_enabled'] = SONGKICK_FILTER_ENABLED + new_config['Synoindex'] = {} new_config['Synoindex']['synoindex_enabled'] = int(SYNOINDEX_ENABLED) diff --git a/headphones/webserve.py b/headphones/webserve.py index fa53d183..072d8841 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -974,6 +974,8 @@ class WebInterface(object): "hpuser": headphones.HPUSER, "hppass": headphones.HPPASS, "songkick_apikey": headphones.SONGKICK_APIKEY, + "songkick_location": headphones.SONGKICK_LOCATION, + "songkick_filter_enabled": checked(headphones.SONGKICK_FILTER_ENABLED), "cache_sizemb": headphones.CACHE_SIZEMB, "file_permissions": headphones.FILE_PERMISSIONS, "folder_permissions": headphones.FOLDER_PERMISSIONS, @@ -1013,7 +1015,7 @@ class WebInterface(object): pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, pushbullet_enabled=0, pushbullet_onsnatch=0, pushbullet_apikey=None, pushbullet_deviceid=None, twitter_enabled=0, twitter_onsnatch=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, enable_https=0, https_cert=None, https_key=None, file_permissions=None, folder_permissions=None, plex_enabled=0, plex_server_host=None, plex_client_host=None, plex_username=None, - plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, songkick_apikey=None, **kwargs): + plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, songkick_apikey=None, songkick_location=None, songkick_filter_enabled=0, **kwargs): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -1155,6 +1157,9 @@ class WebInterface(object): headphones.PUSHBULLET_ONSNATCH = pushbullet_onsnatch headphones.PUSHBULLET_APIKEY = pushbullet_apikey headphones.PUSHBULLET_DEVICEID = pushbullet_deviceid + headphones.SONGKICK_APIKEY = songkick_apikey + headphones.SONGKICK_LOCATION = songkick_location + headphones.SONGKICK_FILTER_ENABLED = songkick_filter_enabled headphones.TWITTER_ENABLED = twitter_enabled headphones.TWITTER_ONSNATCH = twitter_onsnatch headphones.MIRROR = mirror @@ -1163,7 +1168,6 @@ class WebInterface(object): headphones.CUSTOMSLEEP = customsleep headphones.HPUSER = hpuser headphones.HPPASS = hppass - headphones.SONGKICK_APIKEY = songkick_apikey headphones.CACHE_SIZEMB = int(cache_sizemb) headphones.FILE_PERMISSIONS = file_permissions headphones.FOLDER_PERMISSIONS = folder_permissions From 96bc2b835c502ad75297b6dedf4bb8da023c966b Mon Sep 17 00:00:00 2001 From: gotson Date: Fri, 28 Mar 2014 18:06:32 +0800 Subject: [PATCH 2/7] Songkick is now optional --- data/interfaces/default/artist.html | 4 ++- data/interfaces/default/config.html | 41 +++++++++++++++++++++++------ headphones/__init__.py | 5 +++- headphones/webserve.py | 4 ++- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index 178d7b94..85676f2d 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -269,7 +269,9 @@ initActions(); initThisPage(); getArtistBio(); - getArtistsCalendar(); + if( ${headphones.SONGKICK_ENABLED} ){ + getArtistsCalendar(); + } }); diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index f9e00ea8..398a2237 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -970,17 +970,22 @@
Songkick -
- - -
- +
-
+
- - + + +
+
+ +
+
+
+ + +
@@ -1337,6 +1342,26 @@ } }); + if ($("#songkick").is(":checked")) + { + $("#songkickoptions").show(); + } + else + { + $("#songkickoptions").hide(); + } + + $("#songkick").click(function(){ + if ($("#songkick").is(":checked")) + { + $("#songkickoptions").slideDown(); + } + else + { + $("#songkickoptions").slideUp(); + } + }); + if ($("#songkick_filter").is(":checked")) { $("#songkick_filteroptions").show(); diff --git a/headphones/__init__.py b/headphones/__init__.py index 16836bde..2d4da6fe 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -265,6 +265,7 @@ CUSTOMPORT = None CUSTOMSLEEP = None HPUSER = None HPPASS = None +SONGKICK_ENABLED = False SONGKICK_APIKEY = None SONGKICK_LOCATION = None SONGKICK_FILTER_ENABLED = False @@ -344,7 +345,7 @@ def initialize(): MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \ XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \ PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB, JOURNAL_MODE, UMASK, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \ - PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, SONGKICK_APIKEY, SONGKICK_LOCATION, SONGKICK_FILTER_ENABLED, \ + PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, SONGKICK_ENABLED, SONGKICK_APIKEY, SONGKICK_LOCATION, SONGKICK_FILTER_ENABLED, \ POST_PROCESSING_DIR @@ -583,6 +584,7 @@ def initialize(): TWITTER_PASSWORD = check_setting_str(CFG, 'Twitter', 'twitter_password', '') TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'Headphones') + SONGKICK_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_enabled', 0)) SONGKICK_APIKEY = check_setting_str(CFG, 'Songkick', 'songkick_apikey', '') SONGKICK_LOCATION = check_setting_str(CFG, 'Songkick', 'songkick_location', '') SONGKICK_FILTER_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_filter_enabled', 0)) @@ -982,6 +984,7 @@ def config_write(): new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Songkick'] = {} + new_config['Songkick']['songkick_enabled'] = SONGKICK_ENABLED new_config['Songkick']['songkick_apikey'] = SONGKICK_APIKEY new_config['Songkick']['songkick_location'] = SONGKICK_LOCATION new_config['Songkick']['songkick_filter_enabled'] = SONGKICK_FILTER_ENABLED diff --git a/headphones/webserve.py b/headphones/webserve.py index 072d8841..520e0d57 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -973,6 +973,7 @@ class WebInterface(object): "customsleep": headphones.CUSTOMSLEEP, "hpuser": headphones.HPUSER, "hppass": headphones.HPPASS, + "songkick_enabled": checked(headphones.SONGKICK_ENABLED), "songkick_apikey": headphones.SONGKICK_APIKEY, "songkick_location": headphones.SONGKICK_LOCATION, "songkick_filter_enabled": checked(headphones.SONGKICK_FILTER_ENABLED), @@ -1015,7 +1016,7 @@ class WebInterface(object): pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, pushbullet_enabled=0, pushbullet_onsnatch=0, pushbullet_apikey=None, pushbullet_deviceid=None, twitter_enabled=0, twitter_onsnatch=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, enable_https=0, https_cert=None, https_key=None, file_permissions=None, folder_permissions=None, plex_enabled=0, plex_server_host=None, plex_client_host=None, plex_username=None, - plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, songkick_apikey=None, songkick_location=None, songkick_filter_enabled=0, **kwargs): + plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, songkick_enabled=0, songkick_apikey=None, songkick_location=None, songkick_filter_enabled=0, **kwargs): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -1157,6 +1158,7 @@ class WebInterface(object): headphones.PUSHBULLET_ONSNATCH = pushbullet_onsnatch headphones.PUSHBULLET_APIKEY = pushbullet_apikey headphones.PUSHBULLET_DEVICEID = pushbullet_deviceid + headphones.SONGKICK_ENABLED = songkick_enabled headphones.SONGKICK_APIKEY = songkick_apikey headphones.SONGKICK_LOCATION = songkick_location headphones.SONGKICK_FILTER_ENABLED = songkick_filter_enabled From dc07138cafb707fd107e51117cd5abe6b1065c93 Mon Sep 17 00:00:00 2001 From: gotson Date: Fri, 28 Mar 2014 18:09:23 +0800 Subject: [PATCH 3/7] Small bugfix on error: TypeError: cannot concatenate 'str' and 'int' objects --- headphones/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headphones/__init__.py b/headphones/__init__.py index 45301577..d0c7396c 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -312,7 +312,7 @@ def check_setting_str(config, cfg_name, item_name, def_val, log=True): config[cfg_name][item_name] = my_val if log: - logger.debug(item_name + " -> " + my_val) + logger.debug(item_name + " -> " + str(my_val)) else: logger.debug(item_name + " -> ******") return my_val From df9432163e4cab50995cdf01b004f80b7c563965 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 28 Mar 2014 10:16:41 -0700 Subject: [PATCH 4/7] Reverted commit 2e64968 which added a new post processing dir --- data/interfaces/default/config.html | 5 ----- headphones/__init__.py | 6 +----- headphones/postprocessor.py | 17 +++++++++++------ headphones/webserve.py | 6 ++---- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 7417aab3..5ccca6bf 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -508,11 +508,6 @@ -
- - - Set this to where your download client puts its completed downloads in -
diff --git a/headphones/__init__.py b/headphones/__init__.py index 45301577..426b638a 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -92,7 +92,6 @@ CHECK_GITHUB = False CHECK_GITHUB_ON_STARTUP = False CHECK_GITHUB_INTERVAL = None -POST_PROCESSING_DIR = None MUSIC_DIR = None DESTINATION_DIR = None LOSSLESS_DESTINATION_DIR = None @@ -342,8 +341,7 @@ def initialize(): MIRROR, CUSTOMHOST, CUSTOMPORT, CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, \ XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \ PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB, JOURNAL_MODE, UMASK, ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, \ - PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH, \ - POST_PROCESSING_DIR + PLEX_ENABLED, PLEX_SERVER_HOST, PLEX_CLIENT_HOST, PLEX_USERNAME, PLEX_PASSWORD, PLEX_UPDATE, PLEX_NOTIFY, PUSHALOT_ENABLED, PUSHALOT_APIKEY, PUSHALOT_ONSNATCH if __INITIALIZED__: @@ -406,7 +404,6 @@ def initialize(): CHECK_GITHUB_ON_STARTUP = bool(check_setting_int(CFG, 'General', 'check_github_on_startup', 1)) CHECK_GITHUB_INTERVAL = check_setting_int(CFG, 'General', 'check_github_interval', 360) - POST_PROCESSING_DIR = check_setting_str(CFG, 'General', 'post_processing_dir', '') MUSIC_DIR = check_setting_str(CFG, 'General', 'music_dir', '') DESTINATION_DIR = check_setting_str(CFG, 'General', 'destination_dir', '') LOSSLESS_DESTINATION_DIR = check_setting_str(CFG, 'General', 'lossless_destination_dir', '') @@ -800,7 +797,6 @@ def config_write(): new_config['General']['check_github_on_startup'] = int(CHECK_GITHUB_ON_STARTUP) new_config['General']['check_github_interval'] = CHECK_GITHUB_INTERVAL - new_config['General']['post_processing_dir'] = POST_PROCESSING_DIR new_config['General']['music_dir'] = MUSIC_DIR new_config['General']['destination_dir'] = DESTINATION_DIR new_config['General']['lossless_destination_dir'] = LOSSLESS_DESTINATION_DIR diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index d2fcc8cc..492b69c0 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -55,7 +55,7 @@ def checkFolder(): for nzb_folder_name in nzb_album_possibilities: - nzb_album_path = os.path.join(headphones.POST_PROCESSING_DIR, nzb_folder_name).encode(headphones.SYS_ENCODING, 'replace') + nzb_album_path = os.path.join(headphones.DOWNLOAD_DIR, nzb_folder_name).encode(headphones.SYS_ENCODING, 'replace') if os.path.exists(nzb_album_path): logger.debug('Found %s in NZB download folder. Verifying....' % album['FolderName']) @@ -63,7 +63,7 @@ def checkFolder(): if album['Kind'] == 'torrent': - torrent_album_path = os.path.join(headphones.POST_PROCESSING_DIR, album['FolderName']).encode(headphones.SYS_ENCODING,'replace') + torrent_album_path = os.path.join(headphones.DOWNLOAD_TORRENT_DIR, album['FolderName']).encode(headphones.SYS_ENCODING,'replace') if os.path.exists(torrent_album_path): logger.debug('Found %s in torrent download folder. Verifying....' % album['FolderName']) @@ -921,10 +921,15 @@ def renameUnprocessedFolder(albumpath): def forcePostProcess(): download_dirs = [] - if headphones.POST_PROCESSING_DIR: - download_dirs.append(headphones.POST_PROCESSING_DIR.encode(headphones.SYS_ENCODING, 'replace')) - - logger.info('Checking to see if there are any folders to process in: %s' % str(download_dirs).decode(headphones.SYS_ENCODING, 'replace')) + if headphones.DOWNLOAD_DIR: + download_dirs.append(headphones.DOWNLOAD_DIR.encode(headphones.SYS_ENCODING, 'replace')) + if headphones.DOWNLOAD_TORRENT_DIR: + download_dirs.append(headphones.DOWNLOAD_TORRENT_DIR.encode(headphones.SYS_ENCODING, 'replace')) + + # If DOWNLOAD_DIR and DOWNLOAD_TORRENT_DIR are the same, remove the duplicate to prevent us from trying to process the same folder twice. + download_dirs = list(set(download_dirs)) + + logger.info('Checking to see if there are any folders to process in download_dir(s): %s' % str(download_dirs).decode(headphones.SYS_ENCODING, 'replace')) # Get a list of folders in the download_dir folders = [] for download_dir in download_dirs: diff --git a/headphones/webserve.py b/headphones/webserve.py index fa53d183..f8ccfde2 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -976,8 +976,7 @@ class WebInterface(object): "songkick_apikey": headphones.SONGKICK_APIKEY, "cache_sizemb": headphones.CACHE_SIZEMB, "file_permissions": headphones.FILE_PERMISSIONS, - "folder_permissions": headphones.FOLDER_PERMISSIONS, - "post_processing_dir" : headphones.POST_PROCESSING_DIR + "folder_permissions": headphones.FOLDER_PERMISSIONS } # 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 @@ -1013,7 +1012,7 @@ class WebInterface(object): pushover_enabled=0, pushover_onsnatch=0, pushover_keys=None, pushover_priority=0, pushbullet_enabled=0, pushbullet_onsnatch=0, pushbullet_apikey=None, pushbullet_deviceid=None, twitter_enabled=0, twitter_onsnatch=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, enable_https=0, https_cert=None, https_key=None, file_permissions=None, folder_permissions=None, plex_enabled=0, plex_server_host=None, plex_client_host=None, plex_username=None, - plex_password=None, plex_update=0, plex_notify=0, post_processing_dir=None, songkick_apikey=None, **kwargs): + plex_password=None, plex_update=0, plex_notify=0, songkick_apikey=None, **kwargs): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -1167,7 +1166,6 @@ class WebInterface(object): headphones.CACHE_SIZEMB = int(cache_sizemb) headphones.FILE_PERMISSIONS = file_permissions headphones.FOLDER_PERMISSIONS = folder_permissions - headphones.POST_PROCESSING_DIR = post_processing_dir # Handle the variable config options. Note - keys with False values aren't getting passed From aa4bb6b59898990d4318ed9be9690c7022a775c3 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 28 Mar 2014 10:41:29 -0700 Subject: [PATCH 5/7] Readded songkick api from maiis --- headphones/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headphones/__init__.py b/headphones/__init__.py index 69f39fb9..c0a3b274 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -584,7 +584,7 @@ def initialize(): TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'Headphones') SONGKICK_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_enabled', 0)) - SONGKICK_APIKEY = check_setting_str(CFG, 'Songkick', 'songkick_apikey', '') + SONGKICK_APIKEY = check_setting_str(CFG, 'Songkick', 'songkick_apikey', 'nd1We7dFW2RqxPw8') SONGKICK_LOCATION = check_setting_str(CFG, 'Songkick', 'songkick_location', '') SONGKICK_FILTER_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_filter_enabled', 0)) From 84aa80c93ebd643513c0d61bea0fd1cf3bc5e032 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 28 Mar 2014 11:12:59 -0700 Subject: [PATCH 6/7] Couple fixes for the songkick pull request from gitson --- data/interfaces/default/artist.html | 19 +++++++++++++++++-- headphones/__init__.py | 10 +++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index 85676f2d..0e69a740 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -169,6 +169,21 @@ } + <% + if headphones.SONGKICK_FILTER_ENABLED: + songkick_filter_enabled = "true" + else: + songkick_filter_enabled = "false" + + if not headphones.SONGKICK_LOCATION: + headphones.SONGKICK_LOCATION = "none" + + if headphones.SONGKICK_ENABLED: + songkick_enabled = "true" + else: + songkick_enabled = "false" + + %> function getArtistsCalendar() { var template, calendarDomNode; @@ -180,7 +195,7 @@ function(data){ if (data['resultsPage'].totalEntries >= 1) { - if( ${headphones.SONGKICK_FILTER_ENABLED} ) { + if( ${songkick_filter_enabled} ) { data.resultsPage.results.event = $.grep(data.resultsPage.results.event, function(element,index){ return element.venue.metroArea.id == ${headphones.SONGKICK_LOCATION}; }); @@ -269,7 +284,7 @@ initActions(); initThisPage(); getArtistBio(); - if( ${headphones.SONGKICK_ENABLED} ){ + if( ${songkick_enabled} ){ getArtistsCalendar(); } }); diff --git a/headphones/__init__.py b/headphones/__init__.py index c0a3b274..0ec325b6 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -314,7 +314,7 @@ def check_setting_str(config, cfg_name, item_name, def_val, log=True): config[cfg_name][item_name] = my_val if log: - logger.debug(item_name + " -> " + str(my_val)) + logger.debug(item_name + " -> " + my_val) else: logger.debug(item_name + " -> ******") return my_val @@ -583,10 +583,10 @@ def initialize(): TWITTER_PASSWORD = check_setting_str(CFG, 'Twitter', 'twitter_password', '') TWITTER_PREFIX = check_setting_str(CFG, 'Twitter', 'twitter_prefix', 'Headphones') - SONGKICK_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_enabled', 0)) + SONGKICK_ENABLED = bool(check_setting_int(CFG, 'Songkick', 'songkick_enabled', 0)) SONGKICK_APIKEY = check_setting_str(CFG, 'Songkick', 'songkick_apikey', 'nd1We7dFW2RqxPw8') SONGKICK_LOCATION = check_setting_str(CFG, 'Songkick', 'songkick_location', '') - SONGKICK_FILTER_ENABLED = bool(check_setting_str(CFG, 'Songkick', 'songkick_filter_enabled', 0)) + SONGKICK_FILTER_ENABLED = bool(check_setting_int(CFG, 'Songkick', 'songkick_filter_enabled', 0)) MIRROR = check_setting_str(CFG, 'General', 'mirror', 'musicbrainz.org') CUSTOMHOST = check_setting_str(CFG, 'General', 'customhost', 'localhost') @@ -982,10 +982,10 @@ def config_write(): new_config['Twitter']['twitter_prefix'] = TWITTER_PREFIX new_config['Songkick'] = {} - new_config['Songkick']['songkick_enabled'] = SONGKICK_ENABLED + new_config['Songkick']['songkick_enabled'] = int(SONGKICK_ENABLED) new_config['Songkick']['songkick_apikey'] = SONGKICK_APIKEY new_config['Songkick']['songkick_location'] = SONGKICK_LOCATION - new_config['Songkick']['songkick_filter_enabled'] = SONGKICK_FILTER_ENABLED + new_config['Songkick']['songkick_filter_enabled'] = int(SONGKICK_FILTER_ENABLED) new_config['Synoindex'] = {} new_config['Synoindex']['synoindex_enabled'] = int(SYNOINDEX_ENABLED) From e69e391a33de9a3697beee90c6b3ff1e0763f91e Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 28 Mar 2014 11:16:17 -0700 Subject: [PATCH 7/7] Minor fix to handle empty songkick location on artist.html --- data/interfaces/default/artist.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index 0e69a740..33c27a6c 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -176,7 +176,9 @@ songkick_filter_enabled = "false" if not headphones.SONGKICK_LOCATION: - headphones.SONGKICK_LOCATION = "none" + songkick_location = "none" + else: + songkick_location = headphones.SONGKICK_LOCATION if headphones.SONGKICK_ENABLED: songkick_enabled = "true" @@ -197,7 +199,7 @@ if( ${songkick_filter_enabled} ) { data.resultsPage.results.event = $.grep(data.resultsPage.results.event, function(element,index){ - return element.venue.metroArea.id == ${headphones.SONGKICK_LOCATION}; + return element.venue.metroArea.id == ${songkick_location}; }); }