Tool black: auto-format Python code

This commit is contained in:
Odd Stråbø 2024-06-10 09:19:47 +00:00
commit 7763762212
54 changed files with 6545 additions and 4723 deletions

View file

@ -21,15 +21,21 @@ class Artwork(object):
self.cursor = cursor
def update(self, image_url, kodi_id, media, image):
''' Update artwork in the video database.
Delete current entry before updating with the new one.
'''
if not image_url or image == 'poster' and media in ('song', 'artist', 'album'):
"""Update artwork in the video database.
Delete current entry before updating with the new one.
"""
if not image_url or image == "poster" and media in ("song", "artist", "album"):
return
try:
self.cursor.execute(QU.get_art, (kodi_id, media, image,))
self.cursor.execute(
QU.get_art,
(
kodi_id,
media,
image,
),
)
url = self.cursor.fetchone()[0]
except TypeError:
@ -41,43 +47,39 @@ class Artwork(object):
self.cursor.execute(QU.update_art, (image_url, kodi_id, media, image))
def add(self, artwork, *args):
''' Add all artworks.
'''
"""Add all artworks."""
KODI = {
'Primary': ['thumb', 'poster'],
'Banner': "banner",
'Logo': "clearlogo",
'Art': "clearart",
'Thumb': "landscape",
'Disc': "discart",
'Backdrop': "fanart"
"Primary": ["thumb", "poster"],
"Banner": "banner",
"Logo": "clearlogo",
"Art": "clearart",
"Thumb": "landscape",
"Disc": "discart",
"Backdrop": "fanart",
}
for art in KODI:
if art == 'Backdrop':
if art == "Backdrop":
self.cursor.execute(QU.get_backdrops, args + ("fanart%",))
if len(self.cursor.fetchall()) > len(artwork['Backdrop']):
if len(self.cursor.fetchall()) > len(artwork["Backdrop"]):
self.cursor.execute(QU.delete_backdrops, args + ("fanart_",))
for index, backdrop in enumerate(artwork['Backdrop']):
for index, backdrop in enumerate(artwork["Backdrop"]):
if index:
self.update(*(backdrop,) + args + ("%s%s" % ("fanart", index),))
else:
self.update(*(backdrop,) + args + ("fanart",))
elif art == 'Primary':
for kodi_image in KODI['Primary']:
self.update(*(artwork['Primary'],) + args + (kodi_image,))
elif art == "Primary":
for kodi_image in KODI["Primary"]:
self.update(*(artwork["Primary"],) + args + (kodi_image,))
elif artwork.get(art):
self.update(*(artwork[art],) + args + (KODI[art],))
def delete(self, *args):
''' Delete artwork from kodi database
'''
"""Delete artwork from kodi database"""
self.cursor.execute(QU.delete_art, args)