Use Plex dialogs for initial PKC set-up

This commit is contained in:
croneter 2018-09-15 16:53:06 +02:00
parent 93fd45a4e1
commit 3110d8c0ee
2 changed files with 43 additions and 45 deletions

View file

@ -1012,6 +1012,22 @@ msgctxt "#39079"
msgid "Plex Companion could not open the GDM port. Please change it in the PKC settings." msgid "Plex Companion could not open the GDM port. Please change it in the PKC settings."
msgstr "" msgstr ""
# Pop-up on initial sync.
# Check that next translations for Add-on Paths and Direct Paths are identical!
msgctxt "#39080"
msgid "Use Add-on Paths (default, easy) or Direct Paths? Choose Add-on Paths if you're unsure. PKC will not work if your Direct Paths setup is wrong!"
msgstr ""
# Button text for choosing PKC mode
msgctxt "#39081"
msgid "Add-on Paths"
msgstr ""
# Button text for choosing PKC mode
msgctxt "#39082"
msgid "Direct Paths"
msgstr ""
msgctxt "#39200" msgctxt "#39200"
msgid "Log-out Plex Home User " msgid "Log-out Plex Home User "
msgstr "" msgstr ""

View file

@ -190,13 +190,13 @@ class InitialSetup(object):
utils.settings('plexToken', value='') utils.settings('plexToken', value='')
utils.settings('plexLogin', value='') utils.settings('plexLogin', value='')
# Could not login, please try again # Could not login, please try again
utils.dialog('ok', utils.lang(29999), utils.lang(39009)) utils.messageDialog(utils.lang(29999), utils.lang(39009))
answer = self.plex_tv_sign_in() answer = self.plex_tv_sign_in()
elif chk is False or chk >= 400: elif chk is False or chk >= 400:
# Problems connecting to plex.tv. Network or internet issue? # Problems connecting to plex.tv. Network or internet issue?
LOG.info('Problems connecting to plex.tv; connection returned ' LOG.info('Problems connecting to plex.tv; connection returned '
'HTTP %s', str(chk)) 'HTTP %s', str(chk))
utils.dialog('ok', utils.lang(29999), utils.lang(39010)) utils.messageDialog(utils.lang(29999), utils.lang(39010))
answer = False answer = False
else: else:
LOG.info('plex.tv connection with token successful') LOG.info('plex.tv connection with token successful')
@ -373,7 +373,7 @@ class InitialSetup(object):
# Exit if no servers found # Exit if no servers found
if not serverlist: if not serverlist:
LOG.warn('No plex media servers found!') LOG.warn('No plex media servers found!')
utils.dialog('ok', utils.lang(29999), utils.lang(39011)) utils.messageDialog(utils.lang(29999), utils.lang(39011))
return return
# Get a nicer list # Get a nicer list
dialoglist = [] dialoglist = []
@ -411,22 +411,20 @@ class InitialSetup(object):
if chk == 401: if chk == 401:
LOG.warn('Not yet authorized for Plex server %s', LOG.warn('Not yet authorized for Plex server %s',
server['name']) server['name'])
# Please sign in to plex.tv # Not yet authorized for Plex server %s
utils.dialog('ok', utils.messageDialog(
utils.lang(29999), utils.lang(29999),
utils.lang(39013) + server['name'], '%s %s\n%s' % (utils.lang(39013),
utils.lang(39014)) server['name'].decode('utf-8'),
utils.lang(39014)))
if self.plex_tv_sign_in() is False: if self.plex_tv_sign_in() is False:
# Exit while loop if user cancels # Exit while loop if user cancels
return return
# Problems connecting # Problems connecting
elif chk >= 400 or chk is False: elif chk >= 400 or chk is False:
# Problems connecting to server. Pick another server? # Problems connecting to server. Pick another server?
answ = utils.dialog('yesno', if not utils.yesno_dialog(utils.lang(29999), utils.lang(39015)):
utils.lang(29999), # Exit while loop if user chooses No
utils.lang(39015))
# Exit while loop if user chooses No
if not answ:
return return
# Otherwise: connection worked! # Otherwise: connection worked!
else: else:
@ -549,7 +547,7 @@ class InitialSetup(object):
value='true') value='true')
# Warning: Kodi setting "Play next video automatically" is # Warning: Kodi setting "Play next video automatically" is
# enabled. This could break PKC. Deactivate? # enabled. This could break PKC. Deactivate?
if utils.dialog('yesno', utils.lang(29999), utils.lang(30003)): if utils.yesno_dialog(utils.lang(29999), utils.lang(30003)):
js.settings_setsettingvalue('videoplayer.autoplaynextitem', js.settings_setsettingvalue('videoplayer.autoplaynextitem',
False) False)
# Set any video library updates to happen in the background in order to # Set any video library updates to happen in the background in order to
@ -587,62 +585,47 @@ class InitialSetup(object):
# Additional settings where the user needs to choose # Additional settings where the user needs to choose
# Direct paths (\\NAS\mymovie.mkv) or addon (http)? # Direct paths (\\NAS\mymovie.mkv) or addon (http)?
goto_settings = False goto_settings = False
if utils.dialog('yesno', from .windows import optionsdialog
utils.lang(29999), # Use Add-on Paths (default, easy) or Direct Paths? PKC will not work
utils.lang(39027), # if your Direct Paths setup is wrong!
utils.lang(39028), # Buttons: Add-on Paths // Direct Paths
nolabel="Addon (Default)", if optionsdialog.show(utils.lang(29999), utils.lang(39080),
yeslabel="Native (Direct Paths)"): 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 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.dialog('yesno', if utils.yesno_dialog(utils.lang(29999), utils.lang(39033)):
heading=utils.lang(29999),
line1=utils.lang(39033)):
LOG.debug("User chose to replace paths with smb") LOG.debug("User chose to replace paths with smb")
else: else:
utils.settings('replaceSMB', value="false") utils.settings('replaceSMB', value="false")
# complete replace all original Plex library paths with custom SMB # complete replace all original Plex library paths with custom SMB
if utils.dialog('yesno', if utils.yesno_dialog(utils.lang(29999), utils.lang(39043)):
heading=utils.lang(29999),
line1=utils.lang(39043)):
LOG.debug("User chose custom smb paths") LOG.debug("User chose custom smb paths")
utils.settings('remapSMB', value="true") utils.settings('remapSMB', value="true")
# Please enter your custom smb paths in the settings under # Please enter your custom smb paths in the settings under
# "Sync Options" and then restart Kodi # "Sync Options" and then restart Kodi
utils.dialog('ok', utils.messageDialog(utils.lang(29999), utils.lang(39044))
heading=utils.lang(29999),
line1=utils.lang(39044))
goto_settings = True goto_settings = True
# Go to network credentials? # Go to network credentials?
if utils.dialog('yesno', if utils.yesno_dialog(utils.lang(39029), utils.lang(39030)):
heading=utils.lang(29999),
line1=utils.lang(39029),
line2=utils.lang(39030)):
LOG.debug("Presenting network credentials dialog.") LOG.debug("Presenting network credentials dialog.")
utils.passwords_xml() utils.passwords_xml()
# Disable Plex music? # Disable Plex music?
if utils.dialog('yesno', if utils.yesno_dialog(utils.lang(29999), utils.lang(39016)):
heading=utils.lang(29999),
line1=utils.lang(39016)):
LOG.debug("User opted to disable Plex music library.") LOG.debug("User opted to disable Plex music library.")
utils.settings('enableMusic', value="false") utils.settings('enableMusic', value="false")
# Download additional art from FanArtTV # Download additional art from FanArtTV
if utils.dialog('yesno', if utils.yesno_dialog(utils.lang(29999), utils.lang(39061)):
heading=utils.lang(29999),
line1=utils.lang(39061)):
LOG.debug("User opted to use FanArtTV") LOG.debug("User opted to use FanArtTV")
utils.settings('FanartTV', value="true") utils.settings('FanartTV', value="true")
# Do you want to replace your custom user ratings with an indicator of # Do you want to replace your custom user ratings with an indicator of
# how many versions of a media item you posses? # how many versions of a media item you posses?
if utils.dialog('yesno', if utils.yesno_dialog(utils.lang(29999), utils.lang(39718)):
heading=utils.lang(29999),
line1=utils.lang(39718)):
LOG.debug("User opted to replace user ratings with version number") LOG.debug("User opted to replace user ratings with version number")
utils.settings('indicate_media_versions', value="true") utils.settings('indicate_media_versions', value="true")
@ -657,9 +640,8 @@ class InitialSetup(object):
if goto_settings is False: if goto_settings is False:
# Open Settings page now? You will need to restart! # Open Settings page now? You will need to restart!
goto_settings = utils.dialog('yesno', goto_settings = utils.yesno_dialog(utils.lang(29999),
heading=utils.lang(29999), utils.lang(39017))
line1=utils.lang(39017))
if goto_settings: if goto_settings:
state.PMS_STATUS = 'Stop' state.PMS_STATUS = 'Stop'
executebuiltin( executebuiltin(