Force lowercase protocol for plugin playback
This commit is contained in:
parent
128582bf96
commit
ff09ae6457
3 changed files with 28 additions and 15 deletions
|
@ -10,7 +10,8 @@ from xbmc import Monitor, Player, sleep, getCondVisibility, getInfoLabel, \
|
||||||
from xbmcgui import Window
|
from xbmcgui import Window
|
||||||
|
|
||||||
import plexdb_functions as plexdb
|
import plexdb_functions as plexdb
|
||||||
from utils import window, settings, plex_command, thread_methods
|
from utils import window, settings, plex_command, thread_methods, \
|
||||||
|
set_replace_paths
|
||||||
from PlexFunctions import scrobble
|
from PlexFunctions import scrobble
|
||||||
from kodidb_functions import kodiid_from_filename
|
from kodidb_functions import kodiid_from_filename
|
||||||
from plexbmchelper.subscribers import LOCKER
|
from plexbmchelper.subscribers import LOCKER
|
||||||
|
@ -109,6 +110,7 @@ class KodiMonitor(Monitor):
|
||||||
settings_value, getattr(state, state_name), new)
|
settings_value, getattr(state, state_name), new)
|
||||||
setattr(state, state_name, new)
|
setattr(state, state_name, new)
|
||||||
# Special cases, overwrite all internal settings
|
# Special cases, overwrite all internal settings
|
||||||
|
set_replace_paths()
|
||||||
state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval')) * 60
|
state.FULL_SYNC_INTERVALL = int(settings('fullSyncInterval')) * 60
|
||||||
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
|
state.BACKGROUNDSYNC_SAFTYMARGIN = int(
|
||||||
settings('backgroundsync_saftyMargin'))
|
settings('backgroundsync_saftyMargin'))
|
||||||
|
|
|
@ -21,9 +21,7 @@ import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
from xbmcvfs import exists, delete
|
from xbmcvfs import exists, delete
|
||||||
|
import variables as v
|
||||||
from variables import DB_VIDEO_PATH, DB_MUSIC_PATH, DB_TEXTURE_PATH, \
|
|
||||||
DB_PLEX_PATH, KODI_PROFILE, KODIVERSION
|
|
||||||
import state
|
import state
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -105,7 +103,7 @@ def exists_dir(path):
|
||||||
|
|
||||||
Feed with encoded string or unicode
|
Feed with encoded string or unicode
|
||||||
"""
|
"""
|
||||||
if KODIVERSION >= 17:
|
if v.KODIVERSION >= 17:
|
||||||
answ = exists(tryEncode(path))
|
answ = exists(tryEncode(path))
|
||||||
else:
|
else:
|
||||||
dummyfile = join(tryDecode(path), 'dummyfile.txt')
|
dummyfile = join(tryDecode(path), 'dummyfile.txt')
|
||||||
|
@ -336,13 +334,13 @@ def getUnixTimestamp(secondsIntoTheFuture=None):
|
||||||
|
|
||||||
def kodiSQL(media_type="video"):
|
def kodiSQL(media_type="video"):
|
||||||
if media_type == "plex":
|
if media_type == "plex":
|
||||||
dbPath = DB_PLEX_PATH
|
dbPath = v.DB_PLEX_PATH
|
||||||
elif media_type == "music":
|
elif media_type == "music":
|
||||||
dbPath = DB_MUSIC_PATH
|
dbPath = v.DB_MUSIC_PATH
|
||||||
elif media_type == "texture":
|
elif media_type == "texture":
|
||||||
dbPath = DB_TEXTURE_PATH
|
dbPath = v.DB_TEXTURE_PATH
|
||||||
else:
|
else:
|
||||||
dbPath = DB_VIDEO_PATH
|
dbPath = v.DB_VIDEO_PATH
|
||||||
return connect(dbPath, timeout=60.0)
|
return connect(dbPath, timeout=60.0)
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,6 +362,21 @@ def create_actor_db_index():
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
def set_replace_paths():
|
||||||
|
"""
|
||||||
|
Sets our values for direct paths correctly (including using lower-case
|
||||||
|
protocols like smb:// and NOT SMB://)
|
||||||
|
"""
|
||||||
|
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
||||||
|
for arg in ('Org', 'New'):
|
||||||
|
key = 'remapSMB%s%s' % (typus, arg)
|
||||||
|
value = settings(key)
|
||||||
|
if '://' in value:
|
||||||
|
protocol = value.split('://', 1)[0]
|
||||||
|
value = value.replace(protocol, protocol.lower())
|
||||||
|
setattr(state, key, value)
|
||||||
|
|
||||||
|
|
||||||
def reset():
|
def reset():
|
||||||
# Are you sure you want to reset your local Kodi database?
|
# Are you sure you want to reset your local Kodi database?
|
||||||
if not dialog('yesno',
|
if not dialog('yesno',
|
||||||
|
@ -650,7 +663,7 @@ class XmlKodiSetting(object):
|
||||||
top_element=None):
|
top_element=None):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
if path is None:
|
if path is None:
|
||||||
self.path = join(KODI_PROFILE, filename)
|
self.path = join(v.KODI_PROFILE, filename)
|
||||||
else:
|
else:
|
||||||
self.path = join(path, filename)
|
self.path = join(path, filename)
|
||||||
self.force_create = force_create
|
self.force_create = force_create
|
||||||
|
|
|
@ -28,7 +28,8 @@ sys_path.append(_base_resource)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from utils import settings, window, language as lang, dialog, tryDecode
|
from utils import settings, window, language as lang, dialog, tryDecode, \
|
||||||
|
set_replace_paths
|
||||||
from userclient import UserClient
|
from userclient import UserClient
|
||||||
import initialsetup
|
import initialsetup
|
||||||
from kodimonitor import KodiMonitor, SpecialMonitor
|
from kodimonitor import KodiMonitor, SpecialMonitor
|
||||||
|
@ -133,10 +134,7 @@ class Service():
|
||||||
settings('backgroundsync_saftyMargin'))
|
settings('backgroundsync_saftyMargin'))
|
||||||
state.REPLACE_SMB_PATH = settings('replaceSMB') == 'true'
|
state.REPLACE_SMB_PATH = settings('replaceSMB') == 'true'
|
||||||
state.REMAP_PATH = settings('remapSMB') == 'true'
|
state.REMAP_PATH = settings('remapSMB') == 'true'
|
||||||
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
set_replace_paths()
|
||||||
for arg in ('Org', 'New'):
|
|
||||||
key = 'remapSMB%s%s' % (typus, arg)
|
|
||||||
setattr(state, key, settings(key))
|
|
||||||
state.KODI_PLEX_TIME_OFFSET = float(settings('kodiplextimeoffset'))
|
state.KODI_PLEX_TIME_OFFSET = float(settings('kodiplextimeoffset'))
|
||||||
|
|
||||||
window('plex_minDBVersion', value="1.5.10")
|
window('plex_minDBVersion', value="1.5.10")
|
||||||
|
|
Loading…
Reference in a new issue