Use Kodi video cache setting for transcoding
This commit is contained in:
parent
72ed20e47f
commit
65c31b1eaa
5 changed files with 50 additions and 5 deletions
|
@ -2281,7 +2281,6 @@ class API():
|
|||
'partIndex': self.part,
|
||||
'hasMDE': 1,
|
||||
'location': 'lan',
|
||||
'mediaBufferSize': '16384',
|
||||
'subtitleSize': settings('subtitleSize')
|
||||
# 'copyts': 1,
|
||||
# 'offset': 0, # Resume point
|
||||
|
|
|
@ -6,7 +6,8 @@ import logging
|
|||
import xbmc
|
||||
import xbmcgui
|
||||
|
||||
from utils import settings, window, language as lang, tryEncode
|
||||
from utils import settings, window, language as lang, tryEncode, \
|
||||
get_advancessettings_xml_setting
|
||||
import downloadutils
|
||||
from userclient import UserClient
|
||||
|
||||
|
@ -399,6 +400,16 @@ class InitialSetup():
|
|||
log.info("Initial setup called.")
|
||||
dialog = self.dialog
|
||||
|
||||
# Get current Kodi video cache setting
|
||||
cache = get_advancessettings_xml_setting(['cache', 'memorysize'])
|
||||
if cache is not None:
|
||||
cache = str(cache.text)
|
||||
else:
|
||||
# Kodi default cache
|
||||
cache = '20971520'
|
||||
log.info('Current Kodi video memory cache in bytes: %s' % cache)
|
||||
settings('kodi_video_cache', value=cache)
|
||||
|
||||
# Optionally sign into plex.tv. Will not be called on very first run
|
||||
# as plexToken will be ''
|
||||
settings('plex_status', value='Not logged in to plex.tv')
|
||||
|
|
|
@ -59,7 +59,8 @@ class PlayUtils():
|
|||
quality={
|
||||
'maxVideoBitrate': self.get_bitrate(),
|
||||
'videoResolution': self.get_resolution(),
|
||||
'videoQuality': '100'
|
||||
'videoQuality': '100',
|
||||
'mediaBufferSize': int(settings('kodi_video_cache'))/1024,
|
||||
}))
|
||||
# Set playmethod property
|
||||
window('plex_%s.playmethod' % playurl, value="Transcode")
|
||||
|
|
|
@ -548,6 +548,40 @@ def __setSubElement(element, subelement):
|
|||
return answ
|
||||
|
||||
|
||||
def get_advancessettings_xml_setting(node_list):
|
||||
"""
|
||||
Returns the etree element for nodelist (if it exists) and None if not set
|
||||
|
||||
node_list is a list of node names starting from the outside, ignoring the
|
||||
outter advancedsettings. Example nodelist=['video', 'busydialogdelayms']
|
||||
for the following xml would return the etree Element:
|
||||
|
||||
<busydialogdelayms>750</busydialogdelayms>
|
||||
|
||||
Example xml:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<advancedsettings>
|
||||
<video>
|
||||
<busydialogdelayms>750</busydialogdelayms>
|
||||
</video>
|
||||
</advancedsettings>
|
||||
"""
|
||||
path = tryDecode(xbmc.translatePath("special://profile/"))
|
||||
try:
|
||||
xmlparse = etree.parse("%sadvancedsettings.xml" % path)
|
||||
except:
|
||||
log.debug('Could not parse advancedsettings.xml, returning None')
|
||||
return
|
||||
root = xmlparse.getroot()
|
||||
|
||||
for node in node_list:
|
||||
root = root.find(node)
|
||||
if root is None:
|
||||
break
|
||||
return root
|
||||
|
||||
|
||||
def advancedSettingsXML():
|
||||
"""
|
||||
Kodi tweaks
|
||||
|
@ -595,12 +629,11 @@ def sourcesXML():
|
|||
|
||||
try:
|
||||
xmlparse = etree.parse(xmlpath)
|
||||
except: # Document is blank or missing
|
||||
except: # Document is blank or missing
|
||||
root = etree.Element('sources')
|
||||
else:
|
||||
root = xmlparse.getroot()
|
||||
|
||||
|
||||
video = root.find('video')
|
||||
if video is None:
|
||||
video = etree.SubElement(root, 'video')
|
||||
|
|
|
@ -110,6 +110,7 @@
|
|||
<setting id="bestQuality" type="bool" label="30541" default="false" />
|
||||
<setting id="bestTrailer" type="bool" label="30542" default="true" />
|
||||
<setting id="force_transcode_pix" type="bool" label="30545" default="false" />
|
||||
<setting id="kodi_video_cache" type="number" visible="false" default="20971520" />
|
||||
</category>
|
||||
|
||||
<category label="30544"><!-- artwork -->
|
||||
|
|
Loading…
Reference in a new issue