Fix linting, flake8 and sonarcloud issues

This commit is contained in:
Odd Stråbø 2020-04-19 12:07:55 +02:00
parent 87af711c94
commit 3f63e7c213
27 changed files with 162 additions and 169 deletions

View file

@ -11,11 +11,12 @@ from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon
import database
from downloader import TheVoid
from .obj import Objects
from helper import translate, playutils, api, window, settings, dialog
from dialogs import resume
from helper import LazyLogger
from .obj import Objects
#################################################################################################
LOG = LazyLogger(__name__)
@ -133,7 +134,7 @@ class Actions(object):
LOG.info("[ intro/%s ] %s", intro['Id'], intro['Name'])
play = playutils.PlayUtils(intro, False, self.server_id, self.server)
source = play.select_source(play.get_sources())
play.select_source(play.get_sources())
self.set_listitem(intro, listitem, intro=True)
listitem.setPath(intro['PlaybackInfo']['Path'])
playutils.set_properties(intro, intro['PlaybackInfo']['Method'], self.server_id)
@ -797,10 +798,10 @@ def special_listener():
This is run in a loop within monitor.py
'''
player = xbmc.Player()
isPlaying = player.isPlaying()
is_playing = player.isPlaying()
count = int(window('jellyfin.external_count') or 0)
if (not isPlaying and xbmc.getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and xbmc.getInfoLabel('Control.GetLabel(1002)') == xbmc.getLocalizedString(12021)):
if (not is_playing and xbmc.getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and xbmc.getInfoLabel('Control.GetLabel(1002)') == xbmc.getLocalizedString(12021)):
control = int(xbmcgui.Window(10106).getFocusId())
@ -812,7 +813,7 @@ def special_listener():
LOG.info("Resume dialog: Resume selected.")
window('jellyfin.resume.bool', True)
elif isPlaying and not window('jellyfin.external_check'):
elif is_playing and not window('jellyfin.external_check'):
time = player.getTime()
if time > 1: # Not external player.

View file

@ -3,18 +3,9 @@ from __future__ import division, absolute_import, print_function, unicode_litera
#################################################################################################
import threading
from six.moves import queue as Queue
from six.moves.urllib.parse import urlencode
from kodi_six import xbmc, xbmcvfs
from helper import LazyLogger
from . import queries as QU
from . import queries_texture as QUTEX
from helper import settings
import requests
from helper import LazyLogger
##################################################################################################

View file

@ -3,11 +3,13 @@ from __future__ import division, absolute_import, print_function, unicode_litera
##################################################################################################
from sqlite3 import IntegrityError
from helper import values
from helper import LazyLogger
from . import artwork
from . import queries as QU
from helper import values
from sqlite3 import IntegrityError
from helper import LazyLogger
##################################################################################################
@ -23,7 +25,7 @@ class Kodi(object):
try:
self.cursor.execute(QU.get_all_people)
except:
except Exception:
# Failed to load the table. Has the table been created?
self._people_cache = {}
else:
@ -276,7 +278,7 @@ class Kodi(object):
self.cursor.execute(QU.delete_tags, args)
for tag in tags:
tag_id = self.get_tag(tag, *args)
self.get_tag(tag, *args)
def add_tag(self, *args):

View file

@ -61,15 +61,15 @@ class Music(Kodi):
try:
self.cursor.execute(QU.get_artist, (musicbrainz,))
result = self.cursor.fetchone()
artist_id = result[0]
artist_id_res = result[0]
artist_name = result[1]
except TypeError:
artist_id = self.add_artist(artist_id, name, musicbrainz)
artist_id_res = self.add_artist(artist_id, name, musicbrainz)
else:
if artist_name != name:
self.update_artist_name(artist_id, name)
return artist_id
return artist_id_res
def add_artist(self, artist_id, name, *args):
@ -77,12 +77,12 @@ class Music(Kodi):
'''
try:
self.cursor.execute(QU.get_artist_by_name, (name,))
artist_id = self.cursor.fetchone()[0]
artist_id_res = self.cursor.fetchone()[0]
except TypeError:
artist_id = artist_id or self.create_entry()
artist_id_res = artist_id or self.create_entry()
self.cursor.execute(QU.add_artist, (artist_id, name,) + args)
return artist_id
return artist_id_res
def update_artist_name(self, *args):
self.cursor.execute(QU.update_artist_name, args)

View file

@ -7,11 +7,12 @@ from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, library_check, values, Local
from helper import LazyLogger
from .obj import Objects
from .kodi import Movies as KodiDb, queries as QU
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, library_check, values, settings, Local
from helper import LazyLogger
##################################################################################################

View file

@ -5,12 +5,12 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import datetime
from .obj import Objects
from .kodi import Music as KodiDb, queries_music as QU
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, values, library_check, Local
from helper import LazyLogger
from .obj import Objects
from .kodi import Music as KodiDb, queries_music as QU
##################################################################################################
LOG = LazyLogger(__name__)

View file

@ -5,15 +5,17 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import datetime
import re
from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
from .obj import Objects
from .kodi import MusicVideos as KodiDb, queries as QU
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, library_check, jellyfin_item, values, Local
from helper import LazyLogger
from .obj import Objects
from .kodi import MusicVideos as KodiDb, queries as QU
##################################################################################################
LOG = LazyLogger(__name__)

View file

@ -86,9 +86,7 @@ class Objects(object):
for d in self.__recursiveloop__(obj, obj_param):
if obj_filters and self.__filters__(d, obj_filters):
result.append(d)
elif not obj_filters:
if not obj_filters or self.__filters__(d, obj_filters):
result.append(d)
obj = result

View file

@ -286,7 +286,6 @@
"DatePlayed": "UserData/LastPlayedDate",
"Artists": "Artists",
"Album": "Album",
"Votes": "VoteCount",
"Path": "Path",
"LocalTrailer": "LocalTrailerCount",
"Trailer": "RemoteTrailers/0/Url",

View file

@ -9,13 +9,14 @@ from ntpath import dirname
from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
from .obj import Objects
from .kodi import TVShows as KodiDb, queries as QU
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, library_check, settings, values, Local
from helper import api, stop, validate, jellyfin_item, library_check, values, Local
from helper import LazyLogger
from .obj import Objects
from .kodi import TVShows as KodiDb, queries as QU
##################################################################################################
LOG = LazyLogger(__name__)