diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 643af20e..bbe45b0b 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -538,6 +538,10 @@ m<%inherit file="base.html"/> +
+ + +
Interface diff --git a/headphones/__init__.py b/headphones/__init__.py index 0e06ba4c..90218bcd 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -193,6 +193,8 @@ CUSTOMSLEEP = None HPUSER = None HPPASS = None +CACHE_SIZEMB = 32 + def CheckSection(sec): """ Check if INI section exists, if not create it """ try: @@ -256,7 +258,7 @@ def initialize(): ENCODERVBRCBR, ENCODERLOSSLESS, DELETE_LOSSLESS_FILES, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, MIRRORLIST, \ 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_LOW_BUFFER,CACHE_SIZEMB if __INITIALIZED__: return False @@ -412,6 +414,8 @@ def initialize(): CUSTOMSLEEP = check_setting_int(CFG, 'General', 'customsleep', 1) HPUSER = check_setting_str(CFG, 'General', 'hpuser', '') HPPASS = check_setting_str(CFG, 'General', 'hppass', '') + + CACHE_SIZEMB = check_setting_int(CFG,'Advanced','cache_sizemb',32) ALBUM_COMPLETION_PCT = check_setting_int(CFG, 'Advanced', 'album_completion_pct', 80) @@ -708,6 +712,7 @@ def config_write(): new_config['Advanced'] = {} new_config['Advanced']['album_completion_pct'] = ALBUM_COMPLETION_PCT + new_config['Advanced']['cache_sizemb'] = CACHE_SIZEMB new_config.write() diff --git a/headphones/db.py b/headphones/db.py index a1f1d96d..985f6b72 100644 --- a/headphones/db.py +++ b/headphones/db.py @@ -45,7 +45,7 @@ class DBConnection: #journal disabled since we never do rollbacks self.connection.execute("PRAGMA journal_mode = OFF") #64mb of cache memory,probably need to make it user configurable - self.connection.execute("PRAGMA cache_size=-65536") + self.connection.execute("PRAGMA cache_size=-%s" % (headphones.CACHE_SIZEMB*1024)) self.connection.row_factory = sqlite3.Row def action(self, query, args=None): diff --git a/headphones/webserve.py b/headphones/webserve.py index 1d7d9e52..1b652053 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -533,7 +533,8 @@ class WebInterface(object): "customport": headphones.CUSTOMPORT, "customsleep": headphones.CUSTOMSLEEP, "hpuser": headphones.HPUSER, - "hppass": headphones.HPPASS + "hppass": headphones.HPPASS, + "cache_sizemb":headphones.CACHE_SIZEMB, } # 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 @@ -566,7 +567,7 @@ class WebInterface(object): encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0, delete_lossless_files=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, nma_onsnatch=0, synoindex_enabled=False, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None, - preferred_bitrate_high_buffer=None, preferred_bitrate_low_buffer=None, **kwargs): + preferred_bitrate_high_buffer=None, preferred_bitrate_low_buffer=None,cache_sizemb=32, **kwargs): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -662,6 +663,7 @@ class WebInterface(object): headphones.CUSTOMSLEEP = customsleep headphones.HPUSER = hpuser headphones.HPPASS = hppass + headphones.CACHE_SIZEMB = cache_sizemb # Handle the variable config options. Note - keys with False values aren't getting passed