From 84aa80c93ebd643513c0d61bea0fd1cf3bc5e032 Mon Sep 17 00:00:00 2001 From: rembo10 Date: Fri, 28 Mar 2014 11:12:59 -0700 Subject: [PATCH] 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)