Update deprecated isPassword functionality

and dialog line1 to message parameter rename.

The isPassword change likely bumps minimum version up to Kodi 18.
This can be worked around if desirable.
This commit is contained in:
Odd Stråbø 2020-05-29 01:11:25 +02:00
parent e9838a9155
commit a6241d25db
13 changed files with 41 additions and 33 deletions

View file

@ -112,7 +112,7 @@ def reset_device_id():
window('jellyfin_deviceId', clear=True)
get_device_id(True)
dialog("ok", heading="{jellyfin}", line1=translate(33033))
dialog("ok", "{jellyfin}", translate(33033))
xbmc.executebuiltin('RestartApp')

View file

@ -224,7 +224,7 @@ def reset():
from views import Views
views = Views()
if not dialog("yesno", heading="{jellyfin}", line1=translate(33074)):
if not dialog("yesno", "{jellyfin}", translate(33074)):
return
window('jellyfin_should_stop.bool', True)
@ -236,7 +236,7 @@ def reset():
count -= 1
if not count:
dialog("ok", heading="{jellyfin}", line1=translate(33085))
dialog("ok", "{jellyfin}", translate(33085))
return
@ -248,10 +248,10 @@ def reset():
views.delete_playlists()
views.delete_nodes()
if dialog("yesno", heading="{jellyfin}", line1=translate(33086)):
if dialog("yesno", "{jellyfin}", translate(33086)):
reset_artwork()
if dialog("yesno", heading="{jellyfin}", line1=translate(33087)):
if dialog("yesno", "{jellyfin}", translate(33087)):
xbmcvfs.delete(os.path.join(ADDON_DATA, "settings.xml"))
xbmcvfs.delete(os.path.join(ADDON_DATA, "data.json"))
@ -264,7 +264,7 @@ def reset():
settings('MinimumSetup', "")
settings('MusicRescan.bool', False)
settings('SyncInstallRunDone.bool', False)
dialog("ok", heading="{jellyfin}", line1=translate(33088))
dialog("ok", "{jellyfin}", translate(33088))
xbmc.executebuiltin('RestartApp')
@ -279,7 +279,7 @@ def reset_kodi():
if name != 'version':
videodb.cursor.execute("DELETE FROM " + name)
if settings('enableMusic.bool') or dialog("yesno", heading="{jellyfin}", line1=translate(33162)):
if settings('enableMusic.bool') or dialog("yesno", "{jellyfin}", translate(33162)):
with Database('music') as musicdb:
musicdb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'")

View file

@ -51,7 +51,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
self.error_toggle = self.getControl(ERROR_TOGGLE)
self.error_msg = self.getControl(ERROR_MSG)
self.user_field = self._add_editcontrol(755, 433, 40, 415)
self.password_field = self._add_editcontrol(755, 543, 40, 415, password=1)
self.password_field = self._add_editcontrol(755, 543, 40, 415, password=True)
if self.username:
@ -103,14 +103,18 @@ class LoginManual(xbmcgui.WindowXMLDialog):
textColor="FF00A4DC",
disabledColor="FF888888",
focusTexture="-",
noFocusTexture="-",
isPassword=password)
noFocusTexture="-")
control.setPosition(x, y)
control.setHeight(height)
control.setWidth(width)
self.addControl(control)
# setType has no effect before the control is added to a window
if password:
control.setType(xbmcgui.INPUT_TYPE_PASSWORD, "Please enter password")
return control
def _login(self, username, password):

View file

@ -163,7 +163,7 @@ class Context(object):
if not settings('skipContextMenu.bool'):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33015)):
if not dialog("yesno", "{jellyfin}", translate(33015)):
delete = False
if delete:

View file

@ -786,7 +786,7 @@ def get_themes():
tvtunes.setSetting('custom_path', library)
LOG.info("TV Tunes custom path is enabled and set.")
else:
dialog("ok", heading="{jellyfin}", line1=translate(33152))
dialog("ok", "{jellyfin}", translate(33152))
return
@ -862,7 +862,7 @@ def backup():
backup = os.path.join(path, folder_name)
if xbmcvfs.exists(backup + '/'):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33090)):
if not dialog("yesno", "{jellyfin}", translate(33090)):
return backup()
@ -900,4 +900,4 @@ def backup():
LOG.info("copied %s", filename)
LOG.info("backup completed")
dialog("ok", heading="{jellyfin}", line1="%s %s" % (translate(33091), backup))
dialog("ok", "{jellyfin}", "%s %s" % (translate(33091), backup))

View file

@ -375,13 +375,13 @@ class Service(xbmc.Monitor):
if not self.settings.get('mode_warn'):
self.settings['mode_warn'] = True
dialog("yesno", heading="{jellyfin}", line1=translate(33118))
dialog("yesno", "{jellyfin}", translate(33118))
if settings('kodiCompanion.bool') != self.settings['kodi_companion']:
self.settings['kodi_companion'] = settings('kodiCompanion.bool')
if not self.settings['kodi_companion']:
dialog("ok", heading="{jellyfin}", line1=translate(33138))
dialog("ok", "{jellyfin}", translate(33138))
def reload_objects(self):

View file

@ -43,7 +43,7 @@ class FullSync(object):
self.__dict__ = self._shared_state
if self.running:
dialog("ok", heading="{jellyfin}", line1=translate(33197))
dialog("ok", "{jellyfin}", translate(33197))
raise Exception("Sync is already running.")
@ -114,10 +114,10 @@ class FullSync(object):
'''
if self.sync['Libraries']:
if not dialog("yesno", heading="{jellyfin}", line1=translate(33102)):
if not dialog("yesno", "{jellyfin}", translate(33102)):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33173)):
dialog("ok", heading="{jellyfin}", line1=translate(33122))
if not dialog("yesno", "{jellyfin}", translate(33173)):
dialog("ok", "{jellyfin}", translate(33122))
raise LibraryException("ProgressStopped")
else:
@ -244,7 +244,7 @@ class FullSync(object):
if 'Failed to validate path' not in error:
dialog("ok", heading="{jellyfin}", line1=translate(33119))
dialog("ok", "{jellyfin}", translate(33119))
LOG.error("full sync exited unexpectedly")
save_sync(self.sync)

View file

@ -156,6 +156,10 @@ def dialog(dialog_type, *args, **kwargs):
if "heading" in kwargs:
kwargs['heading'] = kwargs['heading'].replace("{jellyfin}", translate('addon_name'))
if args:
args = list(args)
args[0] = args[0].replace("{jellyfin}", translate('addon_name'))
types = {
'yesno': d.yesno,
'ok': d.ok,
@ -248,7 +252,7 @@ def validate(path):
if not xbmcvfs.exists(path):
LOG.info("Could not find %s", path)
if dialog("yesno", heading="{jellyfin}", line1="%s %s. %s" % (translate(33047), path, translate(33048))):
if dialog("yesno", "{jellyfin}", "%s %s. %s" % (translate(33047), path, translate(33048))):
return False
@ -465,15 +469,15 @@ def set_addon_mode():
''' Setup playback mode. If native mode selected, check network credentials.
'''
value = dialog("yesno",
heading=translate('playback_mode'),
line1=translate(33035),
translate('playback_mode'),
translate(33035),
nolabel=translate('addon_mode'),
yeslabel=translate('native_mode'))
settings('useDirectPaths', value="1" if value else "0")
if value:
dialog("ok", heading="{jellyfin}", line1=translate(33145))
dialog("ok", "{jellyfin}", translate(33145))
LOG.info("Add-on playback: %s", settings('useDirectPaths') == "0")

View file

@ -129,7 +129,7 @@ def advanced_settings():
tree = etree.ElementTree(xml)
tree.write(path)
dialog("ok", heading="{jellyfin}", line1=translate(33097))
dialog("ok", "{jellyfin}", translate(33097))
xbmc.executebuiltin('RestartApp')
return True

View file

@ -332,7 +332,7 @@ class Library(threading.Thread):
if self.server.jellyfin.check_companion_installed():
if not self.fast_sync():
dialog("ok", heading="{jellyfin}", line1=translate(33128))
dialog("ok", "{jellyfin}", translate(33128))
raise Exception("Failed to retrieve latest updates")
@ -347,7 +347,7 @@ class Library(threading.Thread):
if error.status in 'SyncLibraryLater':
dialog("ok", heading="{jellyfin}", line1=translate(33129))
dialog("ok", "{jellyfin}", translate(33129))
settings('SyncInstallRunDone.bool', True)
sync = get_sync()
sync['Libraries'] = []
@ -357,7 +357,7 @@ class Library(threading.Thread):
elif error.status == 'CompanionMissing':
dialog("ok", heading="{jellyfin}", line1=translate(33099))
dialog("ok", "{jellyfin}", translate(33099))
settings('kodiCompanion.bool', False)
return True
@ -409,7 +409,7 @@ class Library(threading.Thread):
''' Inverse yes no, in case the dialog is forced closed by Kodi.
'''
if dialog("yesno", heading="{jellyfin}", line1=translate(33172).replace('{number}', str(total)), nolabel=translate(107), yeslabel=translate(106)):
if dialog("yesno", "{jellyfin}", translate(33172).replace('{number}', str(total)), nolabel=translate(107), yeslabel=translate(106)):
LOG.warning("Large updates skipped.")
return True

View file

@ -116,7 +116,7 @@ class Monitor(xbmc.Monitor):
except Exception as error:
LOG.exception(error)
dialog("ok", heading="{jellyfin}", line1=translate(33142))
dialog("ok", "{jellyfin}", translate(33142))
return

View file

@ -121,7 +121,7 @@ class Actions(object):
if settings('askCinema') == "true":
resp = dialog("yesno", heading="{jellyfin}", line1=translate(33016))
resp = dialog("yesno", "{jellyfin}", translate(33016))
if not resp:
enabled = False

View file

@ -436,7 +436,7 @@ class Player(xbmc.Player):
if delete:
LOG.info("Offer delete option")
if dialog("yesno", heading=translate(30091), line1=translate(33015), autoclose=120000):
if dialog("yesno", translate(30091), translate(33015), autoclose=120000):
item['Server'].jellyfin.delete_item(item['Id'])
window('jellyfin.external_check', clear=True)