diff --git a/resources/lib/app/connection.py b/resources/lib/app/connection.py index 56ad192c..303ff165 100644 --- a/resources/lib/app/connection.py +++ b/resources/lib/app/connection.py @@ -92,7 +92,7 @@ class Connection(object): LOG.debug('Clearing connection settings') self.machine_identifier = None self.server_name = None - self.http = None + self.https = None self.host = None self.port = None self.server = None diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 4d1dd957..d8a394b9 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -37,7 +37,8 @@ class ImageCachingThread(backgroundthread.KillableThread): def isSuspended(self): return any(getattr(obj, txt) for obj, txt in self.suspend_points) - def _url_generator(self, kind, kodi_type): + @staticmethod + def _url_generator(kind, kodi_type): """ Main goal is to close DB connection between calls """ diff --git a/resources/lib/backgroundthread.py b/resources/lib/backgroundthread.py index 18bb6722..80f099a0 100644 --- a/resources/lib/backgroundthread.py +++ b/resources/lib/backgroundthread.py @@ -225,7 +225,8 @@ class BackgroundWorker(object): self._abort = False self._task = None - def _runTask(self, task): + @staticmethod + def _runTask(task): if task._canceled: return try: diff --git a/resources/lib/initialsetup.py b/resources/lib/initialsetup.py index 16cea0cf..884832c1 100644 --- a/resources/lib/initialsetup.py +++ b/resources/lib/initialsetup.py @@ -69,7 +69,8 @@ class InitialSetup(object): utils.settings('plex_allows_mediaDeletion', value=value) utils.window('plex_allows_mediaDeletion', value=value) - def enter_new_pms_address(self): + @staticmethod + def enter_new_pms_address(): LOG.info('Start getting manual PMS address and port') # "Enter your Plex Media Server's IP or URL. Examples are:" utils.messageDialog(utils.lang(29999), @@ -196,12 +197,12 @@ class InitialSetup(object): LOG.error('Failed to update Plex info from plex.tv') else: utils.settings('plexLogin', value=self.plex_login) - home = 'true' if xml.attrib.get('home') == '1' else 'false' utils.settings('plexAvatar', value=xml.attrib.get('thumb')) LOG.info('Updated Plex info from plex.tv') return answer - def check_existing_pms(self): + @staticmethod + def check_existing_pms(): """ Check the PMS that was set in file settings. Will return False if we need to reconnect, because: diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 1d1b69f2..16d3da98 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -207,7 +207,8 @@ class KodiMonitor(xbmc.Monitor): """ pass - def _playlist_onclear(self, data): + @staticmethod + def _playlist_onclear(data): """ Called if a Kodi playlist is cleared. Example data dict: { @@ -221,7 +222,8 @@ class KodiMonitor(xbmc.Monitor): else: LOG.debug('Detected PKC clear - ignoring') - def _get_ids(self, kodi_id, kodi_type, path): + @staticmethod + def _get_ids(kodi_id, kodi_type, path): """ Returns the tuple (plex_id, plex_type) or (None, None) """ @@ -315,7 +317,7 @@ class KodiMonitor(xbmc.Monitor): return playerid = js.get_playlist_id(playlist_type) if not playerid: - LOG.error('Coud not get playerid for data', data) + LOG.error('Coud not get playerid for data %s', data) return playqueue = PQ.PLAYQUEUES[playerid] info = js.get_player_props(playerid) diff --git a/resources/lib/library_sync/videonodes.py b/resources/lib/library_sync/videonodes.py index 54c1e51f..92ea29f8 100644 --- a/resources/lib/library_sync/videonodes.py +++ b/resources/lib/library_sync/videonodes.py @@ -476,7 +476,7 @@ class VideoNodes(object): "unwatched.content","unwatched.path", "recent.title","recent.content","recent.path", "recentepisodes.title","recentepisodes.content", - "recentepisodes.path","inprogressepisodes.title", + "recentepisodes.path", "inprogressepisodes.title", "inprogressepisodes.content","inprogressepisodes.path" ] diff --git a/resources/lib/playutils.py b/resources/lib/playutils.py index b7143273..e5780051 100644 --- a/resources/lib/playutils.py +++ b/resources/lib/playutils.py @@ -147,7 +147,8 @@ class PlayUtils(): return False return True - def get_max_bitrate(self): + @staticmethod + def get_max_bitrate(): # get the addon video quality videoQuality = utils.settings('maxVideoQualities') bitrate = { @@ -167,7 +168,8 @@ class PlayUtils(): # max bit rate supported by server (max signed 32bit integer) return bitrate.get(videoQuality, 2147483) - def getH265(self): + @staticmethod + def getH265(): """ Returns the user settings for transcoding h265: boundary resolutions of 480, 720 or 1080 as an int @@ -182,7 +184,8 @@ class PlayUtils(): } return H265[utils.settings('transcodeH265')] - def get_bitrate(self): + @staticmethod + def get_bitrate(): """ Get the desired transcoding bitrate from the settings """ @@ -203,7 +206,8 @@ class PlayUtils(): # max bit rate supported by server (max signed 32bit integer) return bitrate.get(videoQuality, 2147483) - def get_resolution(self): + @staticmethod + def get_resolution(): """ Get the desired transcoding resolutions from the settings """ diff --git a/resources/lib/plex_companion.py b/resources/lib/plex_companion.py index 4895a5a7..37fd6e4d 100644 --- a/resources/lib/plex_companion.py +++ b/resources/lib/plex_companion.py @@ -80,7 +80,8 @@ class PlexCompanion(backgroundthread.KillableThread): self.subscription_manager = None super(PlexCompanion, self).__init__() - def _process_alexa(self, data): + @staticmethod + def _process_alexa(data): xml = PF.GetPlexMetadata(data['key']) try: xml[0].attrib @@ -135,7 +136,8 @@ class PlexCompanion(backgroundthread.KillableThread): executebuiltin('RunPlugin(plugin://%s?%s)' % (v.ADDON_ID, urlencode(params))) - def _process_playlist(self, data): + @staticmethod + def _process_playlist(data): # Get the playqueue ID _, container_key, query = PF.ParseContainerKey(data['containerKey']) try: @@ -159,7 +161,8 @@ class PlexCompanion(backgroundthread.KillableThread): offset=data.get('offset'), transient_token=data.get('token')) - def _process_streams(self, data): + @staticmethod + def _process_streams(data): """ Plex Companion client adjusted audio or subtitle stream """ @@ -180,7 +183,8 @@ class PlexCompanion(backgroundthread.KillableThread): else: LOG.error('Unknown setStreams command: %s', data) - def _process_refresh(self, data): + @staticmethod + def _process_refresh(data): """ example data: {'playQueueID': '8475', 'commandID': '11'} """ diff --git a/resources/lib/plexbmchelper/plexgdm.py b/resources/lib/plexbmchelper/plexgdm.py index 077c46c2..e94feaba 100644 --- a/resources/lib/plexbmchelper/plexgdm.py +++ b/resources/lib/plexbmchelper/plexgdm.py @@ -45,6 +45,9 @@ class plexgdm: self.discover_message = 'M-SEARCH * HTTP/1.0' self.client_header = '* HTTP/1.0' self.client_data = None + self.update_sock = None + self.discover_t = None + self.register_t = None self._multicast_address = '239.0.0.250' self.discover_group = (self._multicast_address, 32414) diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index 6f14704d..da7966d8 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -106,12 +106,16 @@ class Service(): self.server_has_been_online = True self.welcome_msg = True self.connection_check_counter = 0 + self.setup = None + self.alexa = None + self.playqueue = None # Flags for other threads self.connection_check_running = False self.auth_running = False self._init_done = True - def isCanceled(self): + @staticmethod + def isCanceled(): return xbmc.abortRequested or app.APP.stop_pkc def on_connection_check(self, result): @@ -169,7 +173,8 @@ class Service(): finally: self.connection_check_running = False - def log_out(self): + @staticmethod + def log_out(): """ Ensures that lib sync threads are suspended; signs out user """ diff --git a/resources/lib/windows/kodigui.py b/resources/lib/windows/kodigui.py index 9bd917e7..7dc455ed 100644 --- a/resources/lib/windows/kodigui.py +++ b/resources/lib/windows/kodigui.py @@ -206,7 +206,7 @@ class ControlledWindow(ControlledBase, BaseWindow): if action in (xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK): self.doClose() return - except: + except Exception: traceback.print_exc() BaseWindow.onAction(self, action) @@ -218,7 +218,7 @@ class ControlledDialog(ControlledBase, BaseDialog): if action in (xbmcgui.ACTION_PREVIOUS_MENU, xbmcgui.ACTION_NAV_BACK): self.doClose() return - except: + except Exception: traceback.print_exc() BaseDialog.onAction(self, action) @@ -228,7 +228,8 @@ DUMMY_LIST_ITEM = xbmcgui.ListItem() class ManagedListItem(object): - def __init__(self, label='', label2='', iconImage='', thumbnailImage='', path='', data_source=None, properties=None): + def __init__(self, label='', label2='', iconImage='', thumbnailImage='', + path='', data_source=None, properties=None): self._listItem = xbmcgui.ListItem(label, label2, iconImage, thumbnailImage, path) self.dataSource = data_source self.properties = {} @@ -608,13 +609,15 @@ class ManagedControlList(object): def getViewPosition(self): try: return int(xbmc.getInfoLabel('Container({0}).Position'.format(self.controlID))) - except: + except Exception: return 0 def getViewRange(self): viewPosition = self.getViewPosition() selected = self.getSelectedPosition() - return range(max(selected - viewPosition, 0), min(selected + (self._maxViewIndex - viewPosition) + 1, self.size() - 1)) + return range(max(selected - viewPosition, 0), + min(selected + (self._maxViewIndex - viewPosition) + 1, + self.size() - 1)) def positionIsValid(self, pos): return 0 <= pos < self.size() @@ -809,7 +812,7 @@ class SafeControlEdit(object): if self.processOffControlAction(action.getButtonCode()): self._win.setFocusId(self.controlID) return - except: + except Exception: traceback.print_exc() self._winOnAction(action)