mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Removed sonarqube issues tagged clumsy
This commit is contained in:
parent
da21f49928
commit
98c86304fe
9 changed files with 42 additions and 65 deletions
|
@ -64,14 +64,13 @@ class ContextMenu(xbmcgui.WindowXMLDialog):
|
||||||
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
if action in (ACTION_BACK, ACTION_PARENT_DIR, ACTION_PREVIOUS_MENU):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK):
|
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK) and self.getFocusId() == LIST:
|
||||||
|
|
||||||
if self.getFocusId() == LIST:
|
option = self.list_.getSelectedItem()
|
||||||
option = self.list_.getSelectedItem()
|
self.selected_option = ensure_text(option.getLabel())
|
||||||
self.selected_option = ensure_text(option.getLabel())
|
LOG.info('option selected: %s', self.selected_option)
|
||||||
LOG.info('option selected: %s', self.selected_option)
|
|
||||||
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def _add_editcontrol(self, x, y, height, width, password=0):
|
def _add_editcontrol(self, x, y, height, width, password=0):
|
||||||
|
|
||||||
|
|
|
@ -87,16 +87,15 @@ class ServerConnect(xbmcgui.WindowXMLDialog):
|
||||||
if action in (ACTION_BACK, ACTION_PREVIOUS_MENU, ACTION_PARENT_DIR):
|
if action in (ACTION_BACK, ACTION_PREVIOUS_MENU, ACTION_PARENT_DIR):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK):
|
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK) and self.getFocusId() == LIST:
|
||||||
|
|
||||||
if self.getFocusId() == LIST:
|
server = self.list_.getSelectedItem()
|
||||||
server = self.list_.getSelectedItem()
|
selected_id = server.getProperty('id')
|
||||||
selected_id = server.getProperty('id')
|
LOG.info('Server Id selected: %s', selected_id)
|
||||||
LOG.info('Server Id selected: %s', selected_id)
|
|
||||||
|
|
||||||
if self._connect_server(selected_id):
|
if self._connect_server(selected_id):
|
||||||
self.message_box.setVisibleCondition('false')
|
self.message_box.setVisibleCondition('false')
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def onClick(self, control):
|
def onClick(self, control):
|
||||||
|
|
||||||
|
|
|
@ -70,19 +70,18 @@ class UsersConnect(xbmcgui.WindowXMLDialog):
|
||||||
if action in (ACTION_BACK, ACTION_PREVIOUS_MENU, ACTION_PARENT_DIR):
|
if action in (ACTION_BACK, ACTION_PREVIOUS_MENU, ACTION_PARENT_DIR):
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK):
|
if action in (ACTION_SELECT_ITEM, ACTION_MOUSE_LEFT_CLICK) and self.getFocusId() == LIST:
|
||||||
|
|
||||||
if self.getFocusId() == LIST:
|
user = self.list_.getSelectedItem()
|
||||||
user = self.list_.getSelectedItem()
|
selected_id = user.getProperty('id')
|
||||||
selected_id = user.getProperty('id')
|
LOG.info('User Id selected: %s', selected_id)
|
||||||
LOG.info('User Id selected: %s', selected_id)
|
|
||||||
|
|
||||||
for user in self.users:
|
for user in self.users:
|
||||||
if user['Id'] == selected_id:
|
if user['Id'] == selected_id:
|
||||||
self._user = user
|
self._user = user
|
||||||
break
|
break
|
||||||
|
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def onClick(self, control):
|
def onClick(self, control):
|
||||||
|
|
||||||
|
|
|
@ -158,15 +158,7 @@ class Context(object):
|
||||||
self.delete_item()
|
self.delete_item()
|
||||||
|
|
||||||
def delete_item(self):
|
def delete_item(self):
|
||||||
|
if settings('skipContextMenu.bool') and dialog("yesno", "{jellyfin}", translate(33015)):
|
||||||
delete = True
|
|
||||||
|
|
||||||
if not settings('skipContextMenu.bool'):
|
|
||||||
|
|
||||||
if not dialog("yesno", "{jellyfin}", translate(33015)):
|
|
||||||
delete = False
|
|
||||||
|
|
||||||
if delete:
|
|
||||||
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
|
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
|
||||||
|
|
||||||
def transcode(self):
|
def transcode(self):
|
||||||
|
|
|
@ -337,10 +337,8 @@ class Service(xbmc.Monitor):
|
||||||
if self.library_thread is not None:
|
if self.library_thread is not None:
|
||||||
self.library_thread.fast_sync()
|
self.library_thread.fast_sync()
|
||||||
|
|
||||||
elif method == 'UserConfigurationUpdated':
|
elif method == 'UserConfigurationUpdated' and data.get('ServerId') is None:
|
||||||
|
Views().get_views()
|
||||||
if data.get('ServerId') is None:
|
|
||||||
Views().get_views()
|
|
||||||
|
|
||||||
def onSettingsChanged(self):
|
def onSettingsChanged(self):
|
||||||
|
|
||||||
|
|
|
@ -32,20 +32,14 @@ class API(object):
|
||||||
|
|
||||||
def get_naming(self):
|
def get_naming(self):
|
||||||
|
|
||||||
if self.item['Type'] == 'Episode':
|
if self.item['Type'] == 'Episode'and 'SeriesName' in self.item:
|
||||||
|
return "%s: %s" % (self.item['SeriesName'], self.item['Name'])
|
||||||
|
|
||||||
if 'SeriesName' in self.item:
|
elif self.item['Type'] == 'MusicAlbum' and 'AlbumArtist' in self.item:
|
||||||
return "%s: %s" % (self.item['SeriesName'], self.item['Name'])
|
return "%s: %s" % (self.item['AlbumArtist'], self.item['Name'])
|
||||||
|
|
||||||
elif self.item['Type'] == 'MusicAlbum':
|
elif self.item['Type'] == 'Audio' and self.item.get('Artists'):
|
||||||
|
return "%s: %s" % (self.item['Artists'][0], self.item['Name'])
|
||||||
if 'AlbumArtist' in self.item:
|
|
||||||
return "%s: %s" % (self.item['AlbumArtist'], self.item['Name'])
|
|
||||||
|
|
||||||
elif self.item['Type'] == 'Audio':
|
|
||||||
|
|
||||||
if self.item.get('Artists'):
|
|
||||||
return "%s: %s" % (self.item['Artists'][0], self.item['Name'])
|
|
||||||
|
|
||||||
return self.item['Name']
|
return self.item['Name']
|
||||||
|
|
||||||
|
@ -93,13 +87,11 @@ class API(object):
|
||||||
if "msmpeg4" in track['codec']:
|
if "msmpeg4" in track['codec']:
|
||||||
track['codec'] = "divx"
|
track['codec'] = "divx"
|
||||||
|
|
||||||
elif "mpeg4" in track['codec']:
|
elif "mpeg4" in track['codec'] and ("simple profile" in track['profile'] or not track['profile']):
|
||||||
if "simple profile" in track['profile'] or not track['profile']:
|
track['codec'] = "xvid"
|
||||||
track['codec'] = "xvid"
|
|
||||||
|
|
||||||
elif "h264" in track['codec']:
|
elif "h264" in track['codec'] and container in ('mp4', 'mov', 'm4v'):
|
||||||
if container in ('mp4', 'mov', 'm4v'):
|
track['codec'] = "avc1"
|
||||||
track['codec'] = "avc1"
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
width, height = self.item.get('AspectRatio', track.get('AspectRatio', "0")).split(':')
|
width, height = self.item.get('AspectRatio', track.get('AspectRatio', "0")).split(':')
|
||||||
|
|
|
@ -214,8 +214,8 @@ def set_screensaver(value):
|
||||||
|
|
||||||
class JSONRPC(object):
|
class JSONRPC(object):
|
||||||
|
|
||||||
version = 1
|
id = 1
|
||||||
jsonrpc = "2.0"
|
jsonrpc_version = "2.0"
|
||||||
|
|
||||||
def __init__(self, method, **kwargs):
|
def __init__(self, method, **kwargs):
|
||||||
|
|
||||||
|
@ -227,8 +227,8 @@ class JSONRPC(object):
|
||||||
def _query(self):
|
def _query(self):
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
'jsonrpc': self.jsonrpc,
|
'jsonrpc': self.jsonrpc_version,
|
||||||
'id': self.version,
|
'id': self.id,
|
||||||
'method': self.method,
|
'method': self.method,
|
||||||
}
|
}
|
||||||
if self.params is not None:
|
if self.params is not None:
|
||||||
|
|
|
@ -82,9 +82,8 @@ class Credentials(object):
|
||||||
if existing['Id'] == server['Id']:
|
if existing['Id'] == server['Id']:
|
||||||
|
|
||||||
# Merge the data
|
# Merge the data
|
||||||
if server.get('DateLastAccessed'):
|
if server.get('DateLastAccessed') and self._date_object(server['DateLastAccessed']) > self._date_object(existing['DateLastAccessed']):
|
||||||
if self._date_object(server['DateLastAccessed']) > self._date_object(existing['DateLastAccessed']):
|
existing['DateLastAccessed'] = server['DateLastAccessed']
|
||||||
existing['DateLastAccessed'] = server['DateLastAccessed']
|
|
||||||
|
|
||||||
if server.get('UserLinkType'):
|
if server.get('UserLinkType'):
|
||||||
existing['UserLinkType'] = server['UserLinkType']
|
existing['UserLinkType'] = server['UserLinkType']
|
||||||
|
|
|
@ -100,9 +100,8 @@ class Objects(object):
|
||||||
elif obj is item and obj is not None:
|
elif obj is item and obj is not None:
|
||||||
obj = item.get(obj_param)
|
obj = item.get(obj_param)
|
||||||
|
|
||||||
if obj_filters and obj:
|
if obj_filters and obj and not self.__filters__(obj, obj_filters):
|
||||||
if not self.__filters__(obj, obj_filters):
|
obj = None
|
||||||
obj = None
|
|
||||||
|
|
||||||
if obj is None and len(params) != params.index(param):
|
if obj is None and len(params) != params.index(param):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue