New setting to reloade Plex video nodes
This commit is contained in:
parent
25c2b5e782
commit
eb1214f0c7
5 changed files with 57 additions and 0 deletions
|
@ -138,6 +138,10 @@ class Main():
|
|||
LOG.info('User requested to select Plex libraries')
|
||||
transfer.plex_command('select-libraries')
|
||||
|
||||
elif mode == 'refreshplaylist':
|
||||
LOG.info('User requested to refresh Kodi playlists and nodes')
|
||||
transfer.plex_command('refreshplaylist')
|
||||
|
||||
else:
|
||||
entrypoint.show_main_menu(content_type=params.get('content_type'))
|
||||
|
||||
|
|
|
@ -1102,6 +1102,11 @@ msgctxt "#39084"
|
|||
msgid "Enter PMS port"
|
||||
msgstr ""
|
||||
|
||||
# PKC settings - Appearance Tweaks
|
||||
msgctxt "#39085"
|
||||
msgid "Reload Kodi node files to apply all the settings below"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#39200"
|
||||
msgid "Log-out Plex Home User "
|
||||
msgstr ""
|
||||
|
|
|
@ -644,7 +644,22 @@ def clear_window_vars():
|
|||
"""
|
||||
Removes all references to sections stored in window vars 'Plex.nodes...'
|
||||
"""
|
||||
LOG.info('Clearing all the Plex video node variables')
|
||||
number_of_nodes = int(utils.window('Plex.nodes.total') or 0)
|
||||
utils.window('Plex.nodes.total', clear=True)
|
||||
for index in range(number_of_nodes):
|
||||
_clear_window_vars(index)
|
||||
|
||||
|
||||
def delete_videonode_files():
|
||||
"""
|
||||
Removes all the PKC video node files under userdata/library/video that
|
||||
start with 'Plex-'
|
||||
"""
|
||||
for root, dirs, _ in path_ops.walk(LIBRARY_PATH):
|
||||
for directory in dirs:
|
||||
if directory.startswith('Plex-'):
|
||||
abs_path = path_ops.path.join(root, directory)
|
||||
LOG.info('Removing video node directory %s', abs_path)
|
||||
path_ops.rmtree(abs_path, ignore_errors=True)
|
||||
break
|
||||
|
|
|
@ -302,6 +302,35 @@ class Service(object):
|
|||
finally:
|
||||
app.APP.resume_threads()
|
||||
|
||||
def reset_playlists_and_nodes(self):
|
||||
"""
|
||||
Resets the Kodi playlists and nodes for all the PKC libraries by
|
||||
deleting all of them first, then rewriting everything
|
||||
"""
|
||||
app.APP.suspend_threads()
|
||||
from .library_sync import sections
|
||||
try:
|
||||
sections.clear_window_vars()
|
||||
sections.delete_videonode_files()
|
||||
# Get newest sections from the PMS
|
||||
if not sections.sync_from_pms(self, pick_libraries=False):
|
||||
LOG.warn('We could not successfully reset the playlists!')
|
||||
# "Plex playlists/nodes refresh failed"
|
||||
utils.dialog('notification',
|
||||
utils.lang(29999),
|
||||
utils.lang(39406),
|
||||
icon='{plex}',
|
||||
sound=False)
|
||||
return
|
||||
# "Plex playlists/nodes refreshed"
|
||||
utils.dialog('notification',
|
||||
utils.lang(29999),
|
||||
utils.lang(39405),
|
||||
icon='{plex}',
|
||||
sound=False)
|
||||
finally:
|
||||
app.APP.resume_threads()
|
||||
|
||||
def _do_auth(self):
|
||||
LOG.info('Authenticating user')
|
||||
if app.ACCOUNT.plex_username and not app.ACCOUNT.force_login: # Found a user in the settings, try to authenticate
|
||||
|
@ -449,6 +478,8 @@ class Service(object):
|
|||
app.SYNC.run_lib_scan = 'textures'
|
||||
elif plex_command == 'select-libraries':
|
||||
self.choose_plex_libraries()
|
||||
elif plex_command == 'refreshplaylist':
|
||||
self.reset_playlists_and_nodes()
|
||||
elif plex_command == 'RESET-PKC':
|
||||
utils.reset()
|
||||
elif plex_command == 'EXIT-PKC':
|
||||
|
|
|
@ -157,6 +157,8 @@
|
|||
-->
|
||||
|
||||
<category label="39073"><!-- Appearance Tweaks -->
|
||||
<setting label="[COLOR yellow]$ADDON[plugin.video.plexkodiconnect 39085][/COLOR]" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=refreshplaylist)" option="close" /><!-- Reload Kodi node files to apply all the settings below -->
|
||||
<setting type="lsep" />
|
||||
<setting id="fetch_pms_item_number" label="39077" type="number" default="50" option="int" />
|
||||
<setting type="sep" />
|
||||
<setting type="lsep" label="39074" /><!-- TV Shows -->
|
||||
|
|
Loading…
Reference in a new issue