mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
commit
aaa7f33a77
19 changed files with 43 additions and 54 deletions
|
@ -46,7 +46,7 @@ class Connect(object):
|
|||
if server['Id'] == server_id:
|
||||
credentials['Servers'] = [server]
|
||||
|
||||
server_select = True if server_id is None and not settings('SyncInstallRunDone.bool') else False
|
||||
server_select = server_id is None and not settings('SyncInstallRunDone.bool')
|
||||
new_credentials = self.register_client(credentials, options, server_id, server_select)
|
||||
|
||||
for server in servers:
|
||||
|
|
|
@ -35,13 +35,12 @@ class ContextMenu(xbmcgui.WindowXMLDialog):
|
|||
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
|
||||
|
||||
def set_options(self, options=None):
|
||||
self._options = options
|
||||
if options is None:
|
||||
self._options = []
|
||||
else:
|
||||
self._options = options
|
||||
|
||||
def is_selected(self):
|
||||
return True if self.selected_option else False
|
||||
return bool(self.selected_option)
|
||||
|
||||
def get_selected(self):
|
||||
return self.selected_option
|
||||
|
|
|
@ -40,7 +40,7 @@ class LoginManual(xbmcgui.WindowXMLDialog):
|
|||
setattr(self, key, value)
|
||||
|
||||
def is_logged_in(self):
|
||||
return True if self._user else False
|
||||
return bool(self._user)
|
||||
|
||||
def get_user(self):
|
||||
return self._user
|
||||
|
|
|
@ -31,7 +31,7 @@ class ResumeDialog(xbmcgui.WindowXMLDialog):
|
|||
self._resume_point = time
|
||||
|
||||
def is_selected(self):
|
||||
return True if self.selected_option is not None else False
|
||||
return self.selected_option is not None
|
||||
|
||||
def get_selected(self):
|
||||
return self.selected_option
|
||||
|
|
|
@ -48,7 +48,7 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
|||
setattr(self, key, value)
|
||||
|
||||
def is_server_selected(self):
|
||||
return True if self._selected_server else False
|
||||
return bool(self._selected_server)
|
||||
|
||||
def get_server(self):
|
||||
return self._selected_server
|
||||
|
|
|
@ -48,7 +48,7 @@ class ServerManual(xbmcgui.WindowXMLDialog):
|
|||
setattr(self, key, value)
|
||||
|
||||
def is_connected(self):
|
||||
return True if self._server else False
|
||||
return bool(self._server)
|
||||
|
||||
def get_server(self):
|
||||
return self._server
|
||||
|
|
|
@ -39,7 +39,7 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
|||
setattr(self, key, value)
|
||||
|
||||
def is_user_selected(self):
|
||||
return True if self._user else False
|
||||
return bool(self._user)
|
||||
|
||||
def get_user(self):
|
||||
return self._user
|
||||
|
|
|
@ -69,7 +69,7 @@ def validate_view(library_id, item_id):
|
|||
LOG.exception(error)
|
||||
return False
|
||||
|
||||
return True if len(result['Items']) else False
|
||||
return bool(len(result['Items']))
|
||||
|
||||
|
||||
def get_single_item(parent_id, media):
|
||||
|
|
|
@ -267,7 +267,7 @@ def browse(media, view_id=None, folder=None, server_id=None, api_client=None):
|
|||
|
||||
monitor = xbmc.Monitor()
|
||||
|
||||
for i in range(300):
|
||||
for _i in range(300):
|
||||
if window('jellyfin_online.bool'):
|
||||
break
|
||||
elif monitor.waitForAbort(0.1):
|
||||
|
|
|
@ -540,11 +540,11 @@ class FullSync(object):
|
|||
settings('MusicRescan.bool', False)
|
||||
|
||||
if items:
|
||||
count = 0
|
||||
|
||||
with self.library.music_database_lock if media == 'music' else self.library.database_lock:
|
||||
with Database(media) as kodidb:
|
||||
|
||||
count = 0
|
||||
|
||||
if library.media_type == 'mixed':
|
||||
|
||||
movies = [x for x in items if x[1] == 'Movie']
|
||||
|
|
|
@ -185,10 +185,7 @@ def should_stop():
|
|||
LOG.info("exiiiiitttinggg")
|
||||
return True
|
||||
|
||||
if not window('jellyfin_online.bool'):
|
||||
return True
|
||||
|
||||
return False
|
||||
return not window('jellyfin_online.bool')
|
||||
|
||||
|
||||
def get_screensaver():
|
||||
|
|
|
@ -452,5 +452,4 @@ class API(object):
|
|||
returns the URL the server prefers to use
|
||||
'''
|
||||
response = self.send_request(server_address, "system/info/public")
|
||||
url = response.url.replace('/system/info/public', '')
|
||||
return url
|
||||
return response.url.replace('/system/info/public', '')
|
||||
|
|
|
@ -340,13 +340,13 @@ class ConnectionManager(object):
|
|||
self.config.data['auth.server=id'] = server['Id']
|
||||
self.config.data['auth.ssl'] = options.get('ssl', self.config.data['auth.ssl'])
|
||||
|
||||
result = {
|
||||
'Servers': [server]
|
||||
}
|
||||
|
||||
result['State'] = CONNECTION_STATE['SignedIn'] if server.get('AccessToken') else CONNECTION_STATE['ServerSignIn']
|
||||
# Connected
|
||||
return result
|
||||
return {
|
||||
'Servers': [server],
|
||||
'State': CONNECTION_STATE['SignedIn']
|
||||
if server.get('AccessToken')
|
||||
else CONNECTION_STATE['ServerSignIn'],
|
||||
}
|
||||
|
||||
def _update_server_info(self, server, system_info):
|
||||
|
||||
|
|
|
@ -341,8 +341,9 @@ class Library(threading.Thread):
|
|||
|
||||
return True
|
||||
|
||||
if settings('SyncInstallRunDone.bool'):
|
||||
if settings('kodiCompanion.bool'):
|
||||
if settings('SyncInstallRunDone.bool') and settings(
|
||||
'kodiCompanion.bool'
|
||||
):
|
||||
|
||||
if self.server.jellyfin.check_companion_installed():
|
||||
|
||||
|
|
|
@ -255,19 +255,17 @@ class Monitor(xbmc.Monitor):
|
|||
if command in ('Mute', 'Unmute', 'SetVolume',
|
||||
'SetSubtitleStreamIndex', 'SetAudioStreamIndex', 'SetRepeatMode'):
|
||||
|
||||
if command == 'Mute':
|
||||
if command in ['Mute', 'Unmute']:
|
||||
xbmc.executebuiltin('Mute')
|
||||
elif command == 'Unmute':
|
||||
xbmc.executebuiltin('Mute')
|
||||
elif command == 'SetVolume':
|
||||
xbmc.executebuiltin('SetVolume(%s[,showvolumebar])' % args['Volume'])
|
||||
elif command == 'SetRepeatMode':
|
||||
xbmc.executebuiltin('xbmc.PlayerControl(%s)' % args['RepeatMode'])
|
||||
elif command == 'SetAudioStreamIndex':
|
||||
self.player.set_audio_subs(args['Index'])
|
||||
elif command == 'SetRepeatMode':
|
||||
xbmc.executebuiltin('xbmc.PlayerControl(%s)' % args['RepeatMode'])
|
||||
elif command == 'SetSubtitleStreamIndex':
|
||||
self.player.set_audio_subs(None, args['Index'])
|
||||
|
||||
elif command == 'SetVolume':
|
||||
xbmc.executebuiltin('SetVolume(%s[,showvolumebar])' % args['Volume'])
|
||||
# Kodi needs a bit of time to update it's current status
|
||||
xbmc.sleep(500)
|
||||
self.player.report_playback()
|
||||
|
|
|
@ -95,7 +95,7 @@ class Actions(object):
|
|||
if choice is None:
|
||||
raise Exception("User backed out of resume dialog.")
|
||||
|
||||
item["resumePlayback"] = False if not choice else True
|
||||
item["resumePlayback"] = bool(choice)
|
||||
|
||||
if settings('enableCinema.bool') and not item["resumePlayback"]:
|
||||
self._set_intros(item)
|
||||
|
@ -314,7 +314,7 @@ class Actions(object):
|
|||
obj['Artwork']['Backdrop'] = obj['Artwork']['Backdrop'] or []
|
||||
obj['Artwork']['Thumb'] = obj['Artwork']['Thumb'] or ""
|
||||
|
||||
if not intro and not obj['Type'] == 'Trailer':
|
||||
if not intro and obj['Type'] != 'Trailer':
|
||||
obj['Artwork']['Primary'] = obj['Artwork']['Primary'] \
|
||||
or "special://home/addons/plugin.video.jellyfin/resources/icon.png"
|
||||
else:
|
||||
|
|
|
@ -101,8 +101,7 @@ class Movies(KodiDb):
|
|||
if obj['Countries']:
|
||||
self.add_countries(*values(obj, QU.update_country_obj))
|
||||
|
||||
tags = []
|
||||
tags.extend(obj['Tags'] or [])
|
||||
tags = list(obj['Tags'] or [])
|
||||
tags.append(obj['LibraryName'])
|
||||
|
||||
if obj['Favorite']:
|
||||
|
|
|
@ -125,11 +125,10 @@ class Objects(object):
|
|||
obj = self.__recursive__(obj, first)
|
||||
|
||||
if obj:
|
||||
if rest:
|
||||
for item in obj:
|
||||
if rest:
|
||||
self.__recursiveloop__(item, rest)
|
||||
else:
|
||||
for item in obj:
|
||||
yield item
|
||||
|
||||
def __recursive__(self, obj, keys):
|
||||
|
|
|
@ -832,13 +832,10 @@ class Views(object):
|
|||
window_prop = "Jellyfin.wnodes.%s" % index
|
||||
window('%s.index' % window_prop, path.replace('all.xml', "")) # dir
|
||||
window('%s.title' % window_prop, view['Name'])
|
||||
window('%s.content' % window_prop, path)
|
||||
|
||||
elif node == 'browse':
|
||||
|
||||
window_prop = "Jellyfin.wnodes.%s" % index
|
||||
window('%s.title' % window_prop, view['Name'])
|
||||
window('%s.content' % window_prop, path)
|
||||
else:
|
||||
window_prop = "Jellyfin.wnodes.%s.%s" % (index, node)
|
||||
window('%s.title' % window_prop, node_label)
|
||||
|
@ -856,7 +853,7 @@ class Views(object):
|
|||
if not self.server.logged_in:
|
||||
window('%s.artwork' % prop, clear=True)
|
||||
|
||||
elif self.server.logged_in and self.media_folders is not None:
|
||||
elif self.media_folders is not None:
|
||||
for library in self.media_folders:
|
||||
|
||||
if library['Id'] == view_id and 'Primary' in library.get('ImageTags', {}):
|
||||
|
|
Loading…
Reference in a new issue