mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-21 04:19:30 +01:00
Fix extras form data; change bool cast to int(bool( cast for some data
This commit is contained in:
@@ -172,12 +172,12 @@
|
||||
songkick_location = "none"
|
||||
else:
|
||||
songkick_location = headphones.CFG.SONGKICK_LOCATION
|
||||
|
||||
|
||||
if headphones.CFG.SONGKICK_ENABLED:
|
||||
songkick_enabled = "true"
|
||||
else:
|
||||
songkick_enabled = "false"
|
||||
|
||||
|
||||
%>
|
||||
function getArtistsCalendar() {
|
||||
var template, calendarDomNode;
|
||||
@@ -188,14 +188,14 @@
|
||||
|
||||
$.getJSON("https://api.songkick.com/api/3.0/artists/mbid:${artist['ArtistID']}/calendar.json?apikey=${headphones.CFG.SONGKICK_APIKEY}&jsoncallback=?",
|
||||
function(data){
|
||||
if (data['resultsPage'].totalEntries >= 1) {
|
||||
|
||||
if (data['resultsPage'].totalEntries >= 1) {
|
||||
|
||||
if( ${songkick_filter_enabled} ) {
|
||||
data.resultsPage.results.event = $.grep(data.resultsPage.results.event, function(element,index){
|
||||
return element.venue.metroArea.id == ${songkick_location};
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var tourDate;
|
||||
|
||||
calendarDomNode.show();
|
||||
@@ -211,7 +211,7 @@
|
||||
});
|
||||
|
||||
calendarDomNode.append('<li><img src="interfaces/default/images/songkick.png" alt="concerts by songkick" class="sk-logo" /></li>');
|
||||
|
||||
|
||||
$(function() {
|
||||
$("#artistCalendar").each(function() {
|
||||
$("li:gt(4)", this).hide(); /* :gt() is zero-indexed */
|
||||
@@ -269,7 +269,7 @@
|
||||
$('#dialog').dialog();
|
||||
event.preventDefault();
|
||||
});
|
||||
$('#menu_link_modifyextra').click(function() {
|
||||
$('#menu_link_modifyextra').click(function(event) {
|
||||
$('#dialog').dialog();
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
@@ -4,6 +4,15 @@ import os
|
||||
import re
|
||||
from configobj import ConfigObj
|
||||
|
||||
def bool_int(value):
|
||||
"""
|
||||
Casts a config value into a 0 or 1
|
||||
"""
|
||||
if isinstance(value, basestring):
|
||||
if value.lower() in ('', '0', 'false', 'f', 'no', 'n', 'off'):
|
||||
value = 0
|
||||
return int(bool(value))
|
||||
|
||||
_config_definitions = {
|
||||
'ADD_ALBUM_ART': (int, 'General', 0),
|
||||
'ADVANCEDENCODER': (str, 'General', ''),
|
||||
@@ -66,7 +75,7 @@ _config_definitions = {
|
||||
'GROWL_HOST': (str, 'Growl', ''),
|
||||
'GROWL_ONSNATCH': (int, 'Growl', 0),
|
||||
'GROWL_PASSWORD': (str, 'Growl', ''),
|
||||
'HEADPHONES_INDEXER': (bool, 'General', False),
|
||||
'HEADPHONES_INDEXER': (bool_int, 'General', False),
|
||||
'HPPASS': (str, 'General', ''),
|
||||
'HPUSER': (str, 'General', ''),
|
||||
'HTTPS_CERT': (str, 'General', ''),
|
||||
@@ -101,7 +110,7 @@ _config_definitions = {
|
||||
'MININOVA_RATIO': (str, 'Mininova', ''),
|
||||
'MIRROR': (str, 'General', 'musicbrainz.org'),
|
||||
'MOVE_FILES': (int, 'General', 0),
|
||||
'MPC_ENABLED': (bool, 'MPC', False),
|
||||
'MPC_ENABLED': (bool_int, 'MPC', False),
|
||||
'MUSIC_DIR': (str, 'General', ''),
|
||||
'MUSIC_ENCODER': (int, 'General', 0),
|
||||
'NEWZNAB': (int, 'Newznab', 0),
|
||||
@@ -203,7 +212,7 @@ _config_definitions = {
|
||||
'UTORRENT_LABEL': (str, 'uTorrent', ''),
|
||||
'UTORRENT_PASSWORD': (str, 'uTorrent', ''),
|
||||
'UTORRENT_USERNAME': (str, 'uTorrent', ''),
|
||||
'VERIFY_SSL_CERT': (bool, 'Advanced', 1),
|
||||
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
|
||||
'WAFFLES': (int, 'Waffles', 0),
|
||||
'WAFFLES_PASSKEY': (str, 'Waffles', ''),
|
||||
'WAFFLES_RATIO': (str, 'Waffles', ''),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# NZBGet support added by CurlyMo <curlymoo1@gmail.com> as a part of XBian - XBMC on the Raspberry Pi
|
||||
|
||||
from headphones import logger, searcher, db, importer, mb, lastfm, librarysync, helpers, notifiers
|
||||
from headphones.helpers import checked, radio,today, cleanName
|
||||
from headphones.helpers import checked, radio, today, cleanName
|
||||
|
||||
from mako.lookup import TemplateLookup
|
||||
from mako import exceptions
|
||||
@@ -1034,8 +1034,8 @@ class WebInterface(object):
|
||||
"whatcd_ratio": headphones.CFG.WHATCD_RATIO,
|
||||
"pref_qual_0" : radio(headphones.CFG.PREFERRED_QUALITY, 0),
|
||||
"pref_qual_1" : radio(headphones.CFG.PREFERRED_QUALITY, 1),
|
||||
"pref_qual_3" : radio(headphones.CFG.PREFERRED_QUALITY, 3),
|
||||
"pref_qual_2" : radio(headphones.CFG.PREFERRED_QUALITY, 2),
|
||||
"pref_qual_3" : radio(headphones.CFG.PREFERRED_QUALITY, 3),
|
||||
"pref_bitrate" : headphones.CFG.PREFERRED_BITRATE,
|
||||
"pref_bitrate_high" : headphones.CFG.PREFERRED_BITRATE_HIGH_BUFFER,
|
||||
"pref_bitrate_low" : headphones.CFG.PREFERRED_BITRATE_LOW_BUFFER,
|
||||
@@ -1067,7 +1067,9 @@ class WebInterface(object):
|
||||
"prefer_torrents_0" : radio(headphones.CFG.PREFER_TORRENTS, 0),
|
||||
"prefer_torrents_1" : radio(headphones.CFG.PREFER_TORRENTS, 1),
|
||||
"prefer_torrents_2" : radio(headphones.CFG.PREFER_TORRENTS, 2),
|
||||
"magnet_links" : checked(headphones.CFG.MAGNET_LINKS),
|
||||
"magnet_links_0" : radio(headphones.CFG.MAGNET_LINKS, 0),
|
||||
"magnet_links_1" : radio(headphones.CFG.MAGNET_LINKS, 1),
|
||||
"magnet_links_2" : radio(headphones.CFG.MAGNET_LINKS, 2),
|
||||
"log_dir" : headphones.CFG.LOG_DIR,
|
||||
"cache_dir" : headphones.CFG.CACHE_DIR,
|
||||
"interface_list" : interface_list,
|
||||
@@ -1155,7 +1157,12 @@ class WebInterface(object):
|
||||
}
|
||||
|
||||
# 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 (append new extras to the end)
|
||||
extras_list = headphones.POSSIBLE_EXTRAS
|
||||
extra_munges = {
|
||||
"dj-mix": "dj_mix",
|
||||
"mixtape/street": "mixtape_street"
|
||||
}
|
||||
|
||||
extras_list = [extra_munges.get(x, x) for x in headphones.POSSIBLE_EXTRAS]
|
||||
if headphones.CFG.EXTRAS:
|
||||
extras = map(int, headphones.CFG.EXTRAS.split(','))
|
||||
else:
|
||||
@@ -1193,7 +1200,13 @@ class WebInterface(object):
|
||||
|
||||
# Convert the extras to list then string. Coming in as 0 or 1 (append new extras to the end)
|
||||
temp_extras_list = []
|
||||
expected_extras = headphones.POSSIBLE_EXTRAS
|
||||
|
||||
extra_munges = {
|
||||
"dj-mix": "dj_mix",
|
||||
"mixtape/street": "mixtape_street"
|
||||
}
|
||||
|
||||
expected_extras = [extra_munges.get(x, x) for x in headphones.POSSIBLE_EXTRAS]
|
||||
extras_list = [kwargs.get(x, 0) for x in expected_extras]
|
||||
|
||||
i = 1
|
||||
|
||||
Reference in New Issue
Block a user