Merge pull request #308 from oddstr13/pr-kodi19-2

Update deprecated isPassword and line1 function parameters
This commit is contained in:
mcarlton00 2020-05-30 14:22:14 -04:00 committed by GitHub
commit 4e34537c5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 41 additions and 33 deletions

View file

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

View file

@ -224,7 +224,7 @@ def reset():
from views import Views from views import Views
views = Views() views = Views()
if not dialog("yesno", heading="{jellyfin}", line1=translate(33074)): if not dialog("yesno", "{jellyfin}", translate(33074)):
return return
window('jellyfin_should_stop.bool', True) window('jellyfin_should_stop.bool', True)
@ -236,7 +236,7 @@ def reset():
count -= 1 count -= 1
if not count: if not count:
dialog("ok", heading="{jellyfin}", line1=translate(33085)) dialog("ok", "{jellyfin}", translate(33085))
return return
@ -248,10 +248,10 @@ def reset():
views.delete_playlists() views.delete_playlists()
views.delete_nodes() views.delete_nodes()
if dialog("yesno", heading="{jellyfin}", line1=translate(33086)): if dialog("yesno", "{jellyfin}", translate(33086)):
reset_artwork() 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, "settings.xml"))
xbmcvfs.delete(os.path.join(ADDON_DATA, "data.json")) xbmcvfs.delete(os.path.join(ADDON_DATA, "data.json"))
@ -264,7 +264,7 @@ def reset():
settings('MinimumSetup', "") settings('MinimumSetup', "")
settings('MusicRescan.bool', False) settings('MusicRescan.bool', False)
settings('SyncInstallRunDone.bool', False) settings('SyncInstallRunDone.bool', False)
dialog("ok", heading="{jellyfin}", line1=translate(33088)) dialog("ok", "{jellyfin}", translate(33088))
xbmc.executebuiltin('RestartApp') xbmc.executebuiltin('RestartApp')
@ -279,7 +279,7 @@ def reset_kodi():
if name != 'version': if name != 'version':
videodb.cursor.execute("DELETE FROM " + name) 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: with Database('music') as musicdb:
musicdb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'") 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_toggle = self.getControl(ERROR_TOGGLE)
self.error_msg = self.getControl(ERROR_MSG) self.error_msg = self.getControl(ERROR_MSG)
self.user_field = self._add_editcontrol(755, 433, 40, 415) 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: if self.username:
@ -103,14 +103,18 @@ class LoginManual(xbmcgui.WindowXMLDialog):
textColor="FF00A4DC", textColor="FF00A4DC",
disabledColor="FF888888", disabledColor="FF888888",
focusTexture="-", focusTexture="-",
noFocusTexture="-", noFocusTexture="-")
isPassword=password)
control.setPosition(x, y) control.setPosition(x, y)
control.setHeight(height) control.setHeight(height)
control.setWidth(width) control.setWidth(width)
self.addControl(control) 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 return control
def _login(self, username, password): def _login(self, username, password):

View file

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

View file

@ -786,7 +786,7 @@ def get_themes():
tvtunes.setSetting('custom_path', library) tvtunes.setSetting('custom_path', library)
LOG.info("TV Tunes custom path is enabled and set.") LOG.info("TV Tunes custom path is enabled and set.")
else: else:
dialog("ok", heading="{jellyfin}", line1=translate(33152)) dialog("ok", "{jellyfin}", translate(33152))
return return
@ -862,7 +862,7 @@ def backup():
backup = os.path.join(path, folder_name) backup = os.path.join(path, folder_name)
if xbmcvfs.exists(backup + '/'): if xbmcvfs.exists(backup + '/'):
if not dialog("yesno", heading="{jellyfin}", line1=translate(33090)): if not dialog("yesno", "{jellyfin}", translate(33090)):
return backup() return backup()
@ -900,4 +900,4 @@ def backup():
LOG.info("copied %s", filename) LOG.info("copied %s", filename)
LOG.info("backup completed") 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'): if not self.settings.get('mode_warn'):
self.settings['mode_warn'] = True 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']: if settings('kodiCompanion.bool') != self.settings['kodi_companion']:
self.settings['kodi_companion'] = settings('kodiCompanion.bool') self.settings['kodi_companion'] = settings('kodiCompanion.bool')
if not self.settings['kodi_companion']: if not self.settings['kodi_companion']:
dialog("ok", heading="{jellyfin}", line1=translate(33138)) dialog("ok", "{jellyfin}", translate(33138))
def reload_objects(self): def reload_objects(self):

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -436,7 +436,7 @@ class Player(xbmc.Player):
if delete: if delete:
LOG.info("Offer delete option") 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']) item['Server'].jellyfin.delete_item(item['Id'])
window('jellyfin.external_check', clear=True) window('jellyfin.external_check', clear=True)