This commit is contained in:
Croneter 2018-06-15 14:15:39 +02:00
parent b3c0374477
commit 1a58967111

View file

@ -51,10 +51,10 @@ def choose_pms_server():
plex_command('SUSPEND_LIBRARY_THREAD', 'False') plex_command('SUSPEND_LIBRARY_THREAD', 'False')
return return
LOG.info("User chose server %s" % server['name']) LOG.info("User chose server %s", server['name'])
setup.write_pms_to_settings(server) setup.write_pms_to_settings(server)
if not __LogOut(): if not _log_out():
return return
from utils import wipe_database from utils import wipe_database
@ -62,7 +62,7 @@ def choose_pms_server():
wipe_database() wipe_database()
# Log in again # Log in again
__LogIn() _log_in()
LOG.info("Choosing new PMS complete") LOG.info("Choosing new PMS complete")
# '<PMS> connected' # '<PMS> connected'
dialog('notification', dialog('notification',
@ -135,7 +135,7 @@ def show_main_menu(content_type=None):
""" """
Shows the main PKC menu listing with all libraries, Channel, settings, etc. Shows the main PKC menu listing with all libraries, Channel, settings, etc.
""" """
LOG.debug('Do main listing with content_type: %s' % content_type) LOG.debug('Do main listing with content_type: %s', content_type)
xbmcplugin.setContent(HANDLE, 'files') xbmcplugin.setContent(HANDLE, 'files')
# Get emby nodes from the window props # Get emby nodes from the window props
plexprops = window('Plex.nodes.total') plexprops = window('Plex.nodes.total')
@ -190,14 +190,14 @@ def switch_plex_user():
# position = 0 # position = 0
# window('EmbyAdditionalUserImage.%s' % position, clear=True) # window('EmbyAdditionalUserImage.%s' % position, clear=True)
LOG.info("Plex home user switch requested") LOG.info("Plex home user switch requested")
if not __LogOut(): if not _log_out():
return return
# First remove playlists of old user # First remove playlists of old user
from utils import delete_playlists, delete_nodes from utils import delete_playlists, delete_nodes
delete_playlists() delete_playlists()
# Remove video nodes # Remove video nodes
delete_nodes() delete_nodes()
__LogIn() _log_in()
def create_listitem(item, append_show_title=False, append_sxxexx=False): def create_listitem(item, append_show_title=False, append_sxxexx=False):
@ -448,7 +448,7 @@ def get_video_files(plex_id, params):
try: try:
path = item[0][0][0].attrib['file'] path = item[0][0][0].attrib['file']
except (TypeError, IndexError, AttributeError, KeyError): except (TypeError, IndexError, AttributeError, KeyError):
LOG.error('Could not get file path for item %s' % plex_id) LOG.error('Could not get file path for item %s', plex_id)
return xbmcplugin.endOfDirectory(HANDLE) return xbmcplugin.endOfDirectory(HANDLE)
# Assign network protocol # Assign network protocol
if path.startswith('\\\\'): if path.startswith('\\\\'):
@ -476,7 +476,7 @@ def get_video_files(plex_id, params):
listitem=listitem) listitem=listitem)
break break
else: else:
LOG.error('Kodi cannot access folder %s' % path) LOG.error('Kodi cannot access folder %s', path)
xbmcplugin.endOfDirectory(HANDLE) xbmcplugin.endOfDirectory(HANDLE)
@ -558,7 +558,7 @@ def on_deck_episodes(viewid, tagname, limit):
xml = downloadutils.DownloadUtils().downloadUrl( xml = downloadutils.DownloadUtils().downloadUrl(
'{server}/library/sections/%s/onDeck' % viewid) '{server}/library/sections/%s/onDeck' % viewid)
if xml in (None, 401): if xml in (None, 401):
LOG.error('Could not download PMS xml for view %s' % viewid) LOG.error('Could not download PMS xml for view %s', viewid)
xbmcplugin.endOfDirectory(HANDLE, False) xbmcplugin.endOfDirectory(HANDLE, False)
return return
direct_paths = settings('useDirectPaths') == '1' direct_paths = settings('useDirectPaths') == '1'
@ -723,7 +723,7 @@ def browse_plex(key=None, plex_section_id=None):
try: try:
xml[0].attrib xml[0].attrib
except (ValueError, AttributeError, IndexError, TypeError): except (ValueError, AttributeError, IndexError, TypeError):
LOG.error('Could not browse to %s' % key) LOG.error('Could not browse to %s', key)
return xbmcplugin.endOfDirectory(HANDLE, False) return xbmcplugin.endOfDirectory(HANDLE, False)
photos = False photos = False
@ -911,12 +911,12 @@ def create_new_pms():
settings('sslverify', value='false') settings('sslverify', value='false')
# Sign out to trigger new login # Sign out to trigger new login
if __LogOut(): if _log_out():
# Only login again if logout was successful # Only login again if logout was successful
__LogIn() _log_in()
def __LogIn(): def _log_in():
""" """
Resets (clears) window properties to enable (re-)login Resets (clears) window properties to enable (re-)login
@ -928,7 +928,7 @@ def __LogIn():
plex_command('SUSPEND_USER_CLIENT', 'False') plex_command('SUSPEND_USER_CLIENT', 'False')
def __LogOut(): def _log_out():
""" """
Finishes lib scans, logs out user. Finishes lib scans, logs out user.