Code cleanup
This commit is contained in:
parent
3f42e24b7d
commit
b1f04c85a6
7 changed files with 18 additions and 30 deletions
|
@ -24,10 +24,8 @@ class Sync(object):
|
||||||
self.db_scan = False
|
self.db_scan = False
|
||||||
|
|
||||||
def load_settings(self):
|
def load_settings(self):
|
||||||
# Direct Paths (True) or Addon Paths (False)? Along with
|
# Direct Paths (True) or Addon Paths (False)?
|
||||||
# window('useDirectPaths')
|
self.direct_paths = utils.settings('useDirectPaths') == '1'
|
||||||
self.direct_paths = True if utils.settings('useDirectPaths') == '1' \
|
|
||||||
else False
|
|
||||||
# Is synching of Plex music enabled?
|
# Is synching of Plex music enabled?
|
||||||
self.enable_music = utils.settings('enableMusic') == 'true'
|
self.enable_music = utils.settings('enableMusic') == 'true'
|
||||||
# Path remapping mechanism (e.g. smb paths)
|
# Path remapping mechanism (e.g. smb paths)
|
||||||
|
@ -35,6 +33,7 @@ class Sync(object):
|
||||||
self.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
self.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
||||||
# Do we generally remap?
|
# Do we generally remap?
|
||||||
self.remap_path = utils.settings('remapSMB') == 'true'
|
self.remap_path = utils.settings('remapSMB') == 'true'
|
||||||
|
self.force_transcode_pix = utils.settings('force_transcode_pix') == 'true'
|
||||||
# Mappings for REMAP_PATH:
|
# Mappings for REMAP_PATH:
|
||||||
self.remapSMBmovieOrg = utils.settings('remapSMBmovieOrg')
|
self.remapSMBmovieOrg = utils.settings('remapSMBmovieOrg')
|
||||||
self.remapSMBmovieNew = utils.settings('remapSMBmovieNew')
|
self.remapSMBmovieNew = utils.settings('remapSMBmovieNew')
|
||||||
|
|
|
@ -510,12 +510,7 @@ def on_deck_episodes(viewid, tagname, limit):
|
||||||
xbmcplugin.endOfDirectory(int(argv[1]), False)
|
xbmcplugin.endOfDirectory(int(argv[1]), False)
|
||||||
return
|
return
|
||||||
# We're using another python instance - need to load some vars
|
# We're using another python instance - need to load some vars
|
||||||
if utils.settings('useDirectPaths') == '1':
|
app.init()
|
||||||
app.SYNC.direct_paths = True
|
|
||||||
app.SYNC.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
|
||||||
app.SYNC.remap_path = utils.settings('remapSMB') == 'true'
|
|
||||||
if app.SYNC.remap_path:
|
|
||||||
initialsetup.set_replace_paths()
|
|
||||||
# Let's NOT check paths for widgets!
|
# Let's NOT check paths for widgets!
|
||||||
app.SYNC.path_verified = True
|
app.SYNC.path_verified = True
|
||||||
counter = 0
|
counter = 0
|
||||||
|
|
|
@ -544,7 +544,6 @@ class InitialSetup(object):
|
||||||
utils.lang(39081), utils.lang(39082)) == 1:
|
utils.lang(39081), utils.lang(39082)) == 1:
|
||||||
LOG.debug("User opted to use direct paths.")
|
LOG.debug("User opted to use direct paths.")
|
||||||
utils.settings('useDirectPaths', value="1")
|
utils.settings('useDirectPaths', value="1")
|
||||||
state.DIRECT_PATHS = True
|
|
||||||
# Are you on a system where you would like to replace paths
|
# Are you on a system where you would like to replace paths
|
||||||
# \\NAS\mymovie.mkv with smb://NAS/mymovie.mkv? (e.g. Windows)
|
# \\NAS\mymovie.mkv with smb://NAS/mymovie.mkv? (e.g. Windows)
|
||||||
if utils.yesno_dialog(utils.lang(29999), utils.lang(39033)):
|
if utils.yesno_dialog(utils.lang(29999), utils.lang(39033)):
|
||||||
|
@ -596,12 +595,13 @@ class InitialSetup(object):
|
||||||
# Open Settings page now? You will need to restart!
|
# Open Settings page now? You will need to restart!
|
||||||
goto_settings = utils.yesno_dialog(utils.lang(29999),
|
goto_settings = utils.yesno_dialog(utils.lang(29999),
|
||||||
utils.lang(39017))
|
utils.lang(39017))
|
||||||
# Reload relevant settings
|
|
||||||
app.CONN.load()
|
|
||||||
app.ACCOUNT.load()
|
|
||||||
if goto_settings:
|
if goto_settings:
|
||||||
app.APP.suspend = True
|
app.APP.suspend = True
|
||||||
executebuiltin(
|
executebuiltin(
|
||||||
'Addon.OpenSettings(plugin.video.plexkodiconnect)')
|
'Addon.OpenSettings(plugin.video.plexkodiconnect)')
|
||||||
elif reboot is True:
|
elif reboot is True:
|
||||||
utils.reboot_kodi()
|
utils.reboot_kodi()
|
||||||
|
# Reload relevant settings
|
||||||
|
app.CONN.load()
|
||||||
|
app.ACCOUNT.load()
|
||||||
|
app.SYNC.load()
|
||||||
|
|
|
@ -215,8 +215,7 @@ class API(object):
|
||||||
Will always use addon paths, never direct paths
|
Will always use addon paths, never direct paths
|
||||||
"""
|
"""
|
||||||
extension = self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower()
|
extension = self.item[0][0].attrib['key'][self.item[0][0].attrib['key'].rfind('.'):].lower()
|
||||||
if (utils.window('plex_force_transcode_pix') == 'true' or
|
if app.SYNC.force_transcode_pix or extension not in v.KODI_SUPPORTED_IMAGES:
|
||||||
extension not in v.KODI_SUPPORTED_IMAGES):
|
|
||||||
# Let Plex transcode
|
# Let Plex transcode
|
||||||
# max width/height supported by plex image transcoder is 1920x1080
|
# max width/height supported by plex image transcoder is 1920x1080
|
||||||
path = app.CONN.server + PF.transcode_image_path(
|
path = app.CONN.server + PF.transcode_image_path(
|
||||||
|
|
|
@ -192,7 +192,7 @@ class plexgdm:
|
||||||
log.info("Server list is empty. Unable to check")
|
log.info("Server list is empty. Unable to check")
|
||||||
return False
|
return False
|
||||||
for server in self.server_list:
|
for server in self.server_list:
|
||||||
if server['uuid'] == utils.window('plex_machineIdentifier'):
|
if server['uuid'] == app.CONN.machine_identifier:
|
||||||
media_server = server['server']
|
media_server = server['server']
|
||||||
media_port = server['port']
|
media_port = server['port']
|
||||||
scheme = server['protocol']
|
scheme = server['protocol']
|
||||||
|
@ -243,9 +243,9 @@ class plexgdm:
|
||||||
'owned': '1',
|
'owned': '1',
|
||||||
'role': 'master',
|
'role': 'master',
|
||||||
'server': currServerIP,
|
'server': currServerIP,
|
||||||
'serverName': utils.window('plex_servername'),
|
'serverName': app.CONN.server_name,
|
||||||
'updated': int(time.time()),
|
'updated': int(time.time()),
|
||||||
'uuid': utils.window('plex_machineIdentifier'),
|
'uuid': app.CONN.machine_identifier,
|
||||||
'version': 'irrelevant'
|
'version': 'irrelevant'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ class SubscriptionMgr(object):
|
||||||
'protocol': self.protocol,
|
'protocol': self.protocol,
|
||||||
'address': self.server,
|
'address': self.server,
|
||||||
'port': self.port,
|
'port': self.port,
|
||||||
'machineIdentifier': utils.window('plex_machineIdentifier'),
|
'machineIdentifier': app.CONN.machine_identifier,
|
||||||
'state': status,
|
'state': status,
|
||||||
'type': ptype,
|
'type': ptype,
|
||||||
'itemType': ptype,
|
'itemType': ptype,
|
||||||
|
|
|
@ -26,14 +26,9 @@ LOG = logging.getLogger("PLEX.service")
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
WINDOW_PROPERTIES = (
|
WINDOW_PROPERTIES = (
|
||||||
"plex_command_processed", "plex_shouldStop", "plex_dbScan",
|
"plex_dbScan", "pms_token", "plex_token", "pms_server",
|
||||||
"plex_customplayqueue", "plex_playbackProps",
|
"plex_authenticated", "plex_restricteduser", "plex_allows_mediaDeletion",
|
||||||
"pms_token", "plex_token", "pms_server", "plex_machineIdentifier",
|
"plex_command", "plex_result")
|
||||||
"plex_servername", "plex_authenticated", "PlexUserImage", "useDirectPaths",
|
|
||||||
"plex_restricteduser",
|
|
||||||
"plex_allows_mediaDeletion", "plex_command", "plex_result",
|
|
||||||
"plex_force_transcode_pix"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Service():
|
class Service():
|
||||||
|
|
Loading…
Reference in a new issue