Merge pull request #831 from croneter/fix-customization

Fix some appearance tweak settings
This commit is contained in:
croneter 2019-04-14 14:56:14 +02:00 committed by GitHub
commit e554195228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 9 deletions

View file

@ -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'))

View file

@ -971,11 +971,6 @@ msgctxt "#39057"
msgid "Customize Paths"
msgstr ""
# PKC Settings - Appearance Tweaks
msgctxt "#39058"
msgid "Extend Plex TV Series \"On Deck\" view to all shows"
msgstr ""
# PKC Settings - Appearance Tweaks
msgctxt "#39059"
msgid "Recently Added: Append show title to episode"
@ -1013,7 +1008,7 @@ msgstr ""
# PKC Settings - Appearance Tweaks
msgctxt "#39066"
msgid "Recently Added: Also show already watched movies (Refresh Plex playlist/nodes!)"
msgid "Recently Added: Also show already watched movies"
msgstr ""
# PKC Settings - Connection
@ -1102,6 +1097,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 ""

View file

@ -252,6 +252,17 @@ def node_recent(section, node_name):
rule = etree.SubElement(xml, 'rule', attrib={'field': 'tag',
'operator': 'is'})
etree.SubElement(rule, 'value').text = section.name
if ((section.section_type == v.PLEX_TYPE_SHOW and
utils.settings('TVShowWatched') == 'false') or
(section.section_type == v.PLEX_TYPE_MOVIE and
utils.settings('MovieShowWatched') == 'false')):
# Adds an additional rule if user deactivated the PKC setting
# "Recently Added: Also show already watched episodes"
# or
# "Recently Added: Also show already watched episodes"
rule = etree.SubElement(xml, 'rule', attrib={'field': 'playcount',
'operator': 'is'})
etree.SubElement(rule, 'value').text = '0'
etree.SubElement(xml, 'label').text = node_name
etree.SubElement(xml, 'icon').text = ICON_PATH
etree.SubElement(xml, 'content').text = section.content

View file

@ -653,7 +653,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

View file

@ -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':

View file

@ -157,10 +157,10 @@
-->
<category label="39073"><!-- Appearance Tweaks -->
<setting id="fetch_pms_item_number" label="39077" type="number" default="50" option="int" />
<setting type="sep" />
<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" visible="false" />
<setting type="lsep" label="39074" /><!-- TV Shows -->
<setting id="OnDeckTVextended" type="bool" label="39058" default="true" /><!-- Extend Plex TV Series "On Deck" view to all shows -->
<setting id="OnDeckTvAppendShow" type="bool" label="39047" default="false" /><!--On Deck view: Append show title to episode-->
<setting id="OnDeckTvAppendSeason" type="bool" label="39048" default="false" /><!--On Deck view: Append season number to episode-->
<setting id="TVShowWatched" type="bool" label="39064" default="true" /><!--Recently Added: Also show already watched episodes-->