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