mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-19 18:15:31 +01:00
SQL Cache size is now user configurable (best performance when its at least as large as the database itself)
This commit is contained in:
@@ -538,6 +538,10 @@ m<%inherit file="base.html"/>
|
||||
<input type="checkbox" name="autowant_all" value="1" ${config['autowant_all']} /><label>Automatically Mark All Albums as Wanted</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label>Cache Size (in MB):</label>
|
||||
<input type="text" name="cache_sizemb" value="${config['cache_sizemb']}" size="7">
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Interface</legend>
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user