constructor (with Artwork() as art)
- Way too slow
This commit is contained in:
parent
940e41921f
commit
168014c33b
5 changed files with 87 additions and 62 deletions
|
@ -173,8 +173,8 @@ class Main():
|
||||||
|
|
||||||
elif mode == "texturecache":
|
elif mode == "texturecache":
|
||||||
import artwork
|
import artwork
|
||||||
artwork.Artwork().fullTextureCacheSync()
|
with artwork.Artwork('music') as art:
|
||||||
|
art.fullTextureCacheSync()
|
||||||
else:
|
else:
|
||||||
entrypoint.doMainListing()
|
entrypoint.doMainListing()
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,13 @@ def setKodiWebServerDetails():
|
||||||
|
|
||||||
|
|
||||||
class Artwork():
|
class Artwork():
|
||||||
|
"""
|
||||||
|
Use like this:
|
||||||
|
with Artwork(db_type) as art:
|
||||||
|
art.method()
|
||||||
|
|
||||||
|
db_type: the Kodi db to open: 'video' or 'music'
|
||||||
|
"""
|
||||||
lock = Lock()
|
lock = Lock()
|
||||||
|
|
||||||
enableTextureCache = settings('enableTextureCache') == "true"
|
enableTextureCache = settings('enableTextureCache') == "true"
|
||||||
|
@ -136,6 +143,25 @@ class Artwork():
|
||||||
|
|
||||||
imageCacheThreads = []
|
imageCacheThreads = []
|
||||||
|
|
||||||
|
def __init__(self, db_type):
|
||||||
|
self.db_type = db_type
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
"""
|
||||||
|
Open DB connections and cursors
|
||||||
|
"""
|
||||||
|
self.connection = kodiSQL(self.db_type)
|
||||||
|
self.cursor = self.connection.cursor()
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
|
"""
|
||||||
|
Make sure DB changes are committed and connection to DB is closed.
|
||||||
|
"""
|
||||||
|
self.connection.commit()
|
||||||
|
self.connection.close()
|
||||||
|
return self
|
||||||
|
|
||||||
def double_urlencode(self, text):
|
def double_urlencode(self, text):
|
||||||
text = self.single_urlencode(text)
|
text = self.single_urlencode(text)
|
||||||
text = self.single_urlencode(text)
|
text = self.single_urlencode(text)
|
||||||
|
@ -291,7 +317,7 @@ class Artwork():
|
||||||
else:
|
else:
|
||||||
self.addWorkerImageCacheThread(url)
|
self.addWorkerImageCacheThread(url)
|
||||||
|
|
||||||
def addArtwork(self, artwork, kodiId, mediaType, cursor):
|
def addArtwork(self, artwork, kodiId, mediaType):
|
||||||
# Kodi conversion table
|
# Kodi conversion table
|
||||||
kodiart = {
|
kodiart = {
|
||||||
|
|
||||||
|
@ -322,8 +348,8 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type LIKE ?"
|
"AND type LIKE ?"
|
||||||
))
|
))
|
||||||
cursor.execute(query, (kodiId, mediaType, "fanart%",))
|
self.cursor.execute(query, (kodiId, mediaType, "fanart%",))
|
||||||
rows = cursor.fetchall()
|
rows = self.cursor.fetchall()
|
||||||
|
|
||||||
if len(rows) > backdropsNumber:
|
if len(rows) > backdropsNumber:
|
||||||
# More backdrops in database. Delete extra fanart.
|
# More backdrops in database. Delete extra fanart.
|
||||||
|
@ -334,7 +360,7 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type LIKE ?"
|
"AND type LIKE ?"
|
||||||
))
|
))
|
||||||
cursor.execute(query, (kodiId, mediaType, "fanart_",))
|
self.cursor.execute(query, (kodiId, mediaType, "fanart_",))
|
||||||
|
|
||||||
# Process backdrops and extra fanart
|
# Process backdrops and extra fanart
|
||||||
index = ""
|
index = ""
|
||||||
|
@ -343,11 +369,11 @@ class Artwork():
|
||||||
imageUrl=backdrop,
|
imageUrl=backdrop,
|
||||||
kodiId=kodiId,
|
kodiId=kodiId,
|
||||||
mediaType=mediaType,
|
mediaType=mediaType,
|
||||||
imageType="%s%s" % ("fanart", index),
|
imageType="%s%s" % ("fanart", index))
|
||||||
cursor=cursor)
|
|
||||||
|
|
||||||
if backdropsNumber > 1:
|
if backdropsNumber > 1:
|
||||||
try: # Will only fail on the first try, str to int.
|
try:
|
||||||
|
# Will only fail on the first try, str to int.
|
||||||
index += 1
|
index += 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
index = 1
|
index = 1
|
||||||
|
@ -359,19 +385,16 @@ class Artwork():
|
||||||
imageUrl=artwork[art],
|
imageUrl=artwork[art],
|
||||||
kodiId=kodiId,
|
kodiId=kodiId,
|
||||||
mediaType=mediaType,
|
mediaType=mediaType,
|
||||||
imageType=artType,
|
imageType=artType)
|
||||||
cursor=cursor)
|
|
||||||
|
|
||||||
elif kodiart.get(art):
|
elif kodiart.get(art):
|
||||||
# Process the rest artwork type that Kodi can use
|
# Process the rest artwork type that Kodi can use
|
||||||
self.addOrUpdateArt(
|
self.addOrUpdateArt(
|
||||||
imageUrl=artwork[art],
|
imageUrl=artwork[art],
|
||||||
kodiId=kodiId,
|
kodiId=kodiId,
|
||||||
mediaType=mediaType,
|
mediaType=mediaType,
|
||||||
imageType=kodiart[art],
|
imageType=kodiart[art])
|
||||||
cursor=cursor)
|
|
||||||
|
|
||||||
def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType, cursor):
|
def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType):
|
||||||
if not imageUrl:
|
if not imageUrl:
|
||||||
# Possible that the imageurl is an empty string
|
# Possible that the imageurl is an empty string
|
||||||
return
|
return
|
||||||
|
@ -383,10 +406,10 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type = ?"
|
"AND type = ?"
|
||||||
))
|
))
|
||||||
cursor.execute(query, (kodiId, mediaType, imageType,))
|
self.cursor.execute(query, (kodiId, mediaType, imageType,))
|
||||||
try:
|
try:
|
||||||
# Update the artwork
|
# Update the artwork
|
||||||
url = cursor.fetchone()[0]
|
url = self.cursor.fetchone()[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Add the artwork
|
# Add the artwork
|
||||||
log.debug("Adding Art Link for kodiId: %s (%s)"
|
log.debug("Adding Art Link for kodiId: %s (%s)"
|
||||||
|
@ -397,7 +420,8 @@ class Artwork():
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
cursor.execute(query, (kodiId, mediaType, imageType, imageUrl))
|
self.cursor.execute(query,
|
||||||
|
(kodiId, mediaType, imageType, imageUrl))
|
||||||
else:
|
else:
|
||||||
if url == imageUrl:
|
if url == imageUrl:
|
||||||
# Only cache artwork if it changed
|
# Only cache artwork if it changed
|
||||||
|
@ -416,20 +440,21 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type = ?"
|
"AND type = ?"
|
||||||
))
|
))
|
||||||
cursor.execute(query, (imageUrl, kodiId, mediaType, imageType))
|
self.cursor.execute(query,
|
||||||
|
(imageUrl, kodiId, mediaType, imageType))
|
||||||
|
|
||||||
# Cache fanart and poster in Kodi texture cache
|
# Cache fanart and poster in Kodi texture cache
|
||||||
self.cacheTexture(imageUrl)
|
self.cacheTexture(imageUrl)
|
||||||
|
|
||||||
def deleteArtwork(self, kodiId, mediaType, cursor):
|
def deleteArtwork(self, kodiId, mediaType):
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
"SELECT url",
|
"SELECT url",
|
||||||
"FROM art",
|
"FROM art",
|
||||||
"WHERE media_id = ?",
|
"WHERE media_id = ?",
|
||||||
"AND media_type = ?"
|
"AND media_type = ?"
|
||||||
))
|
))
|
||||||
cursor.execute(query, (kodiId, mediaType,))
|
self.cursor.execute(query, (kodiId, mediaType,))
|
||||||
rows = cursor.fetchall()
|
rows = self.cursor.fetchall()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.deleteCachedArtwork(row[0])
|
self.deleteCachedArtwork(row[0])
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ class Items(object):
|
||||||
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
self.kodiversion = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
|
||||||
self.directpath = window('useDirectPaths') == 'true'
|
self.directpath = window('useDirectPaths') == 'true'
|
||||||
|
|
||||||
self.artwork = artwork.Artwork()
|
|
||||||
self.userid = window('currUserId')
|
self.userid = window('currUserId')
|
||||||
self.server = window('pms_server')
|
self.server = window('pms_server')
|
||||||
|
|
||||||
|
@ -73,19 +72,19 @@ class Items(object):
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
if allartworks is None:
|
if allartworks is None:
|
||||||
allartworks = API.getAllArtwork()
|
allartworks = API.getAllArtwork()
|
||||||
self.artwork.addArtwork(API.getFanartArtwork(allartworks),
|
with artwork.Artwork('video') as art:
|
||||||
kodiId,
|
art.addArtwork(API.getFanartArtwork(allartworks),
|
||||||
mediaType,
|
kodiId,
|
||||||
self.kodicursor)
|
mediaType)
|
||||||
# Also get artwork for collections/movie sets
|
# Also get artwork for collections/movie sets
|
||||||
if mediaType == 'movie':
|
if mediaType == 'movie':
|
||||||
for setname in API.getCollections():
|
for setname in API.getCollections():
|
||||||
log.debug('Getting artwork for movie set %s' % setname)
|
log.debug('Getting artwork for movie set %s' % setname)
|
||||||
setid = self.kodi_db.createBoxset(setname)
|
setid = self.kodi_db.createBoxset(setname)
|
||||||
self.artwork.addArtwork(API.getSetArtwork(),
|
with artwork.Artwork('video') as art:
|
||||||
setid,
|
art.addArtwork(API.getSetArtwork(),
|
||||||
"set",
|
setid,
|
||||||
self.kodicursor)
|
"set")
|
||||||
self.kodi_db.assignBoxset(setid, kodiId)
|
self.kodi_db.assignBoxset(setid, kodiId)
|
||||||
|
|
||||||
def itemsbyId(self, items, process, pdialog=None):
|
def itemsbyId(self, items, process, pdialog=None):
|
||||||
|
@ -309,7 +308,6 @@ class Movies(Items):
|
||||||
# Process single movie
|
# Process single movie
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
# If the item already exist in the local Kodi DB we'll perform a full
|
# If the item already exist in the local Kodi DB we'll perform a full
|
||||||
|
@ -496,7 +494,8 @@ class Movies(Items):
|
||||||
# Process genres
|
# Process genres
|
||||||
self.kodi_db.addGenres(movieid, genres, "movie")
|
self.kodi_db.addGenres(movieid, genres, "movie")
|
||||||
# Process artwork
|
# Process artwork
|
||||||
artwork.addArtwork(API.getAllArtwork(), movieid, "movie", kodicursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.addArtwork(API.getAllArtwork(), movieid, "movie")
|
||||||
# Process stream details
|
# Process stream details
|
||||||
self.kodi_db.addStreams(fileid, API.getMediaStreams(), runtime)
|
self.kodi_db.addStreams(fileid, API.getMediaStreams(), runtime)
|
||||||
# Process studios
|
# Process studios
|
||||||
|
@ -516,8 +515,6 @@ class Movies(Items):
|
||||||
# Remove movieid, fileid, emby reference
|
# Remove movieid, fileid, emby reference
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
artwork = self.artwork
|
|
||||||
|
|
||||||
emby_dbitem = emby_db.getItem_byId(itemid)
|
emby_dbitem = emby_db.getItem_byId(itemid)
|
||||||
try:
|
try:
|
||||||
kodiid = emby_dbitem[0]
|
kodiid = emby_dbitem[0]
|
||||||
|
@ -531,7 +528,8 @@ class Movies(Items):
|
||||||
# Remove the emby reference
|
# Remove the emby reference
|
||||||
emby_db.removeItem(itemid)
|
emby_db.removeItem(itemid)
|
||||||
# Remove artwork
|
# Remove artwork
|
||||||
artwork.deleteArtwork(kodiid, mediatype, kodicursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.deleteArtwork(kodiid, mediatype)
|
||||||
|
|
||||||
if mediatype == "movie":
|
if mediatype == "movie":
|
||||||
# Delete kodi movie and file
|
# Delete kodi movie and file
|
||||||
|
@ -561,7 +559,6 @@ class TVShows(Items):
|
||||||
# Process single tvshow
|
# Process single tvshow
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
update_item = True
|
update_item = True
|
||||||
|
@ -719,8 +716,8 @@ class TVShows(Items):
|
||||||
# Process genres
|
# Process genres
|
||||||
self.kodi_db.addGenres(showid, genres, "tvshow")
|
self.kodi_db.addGenres(showid, genres, "tvshow")
|
||||||
# Process artwork
|
# Process artwork
|
||||||
allartworks = API.getAllArtwork()
|
with artwork.Artwork('video') as art:
|
||||||
artwork.addArtwork(allartworks, showid, "tvshow", kodicursor)
|
art.addArtwork(API.getAllArtwork(), showid, "tvshow")
|
||||||
# Process studios
|
# Process studios
|
||||||
self.kodi_db.addStudios(showid, studios, "tvshow")
|
self.kodi_db.addStudios(showid, studios, "tvshow")
|
||||||
# Process tags: view, PMS collection tags
|
# Process tags: view, PMS collection tags
|
||||||
|
@ -743,7 +740,6 @@ class TVShows(Items):
|
||||||
return
|
return
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
seasonnum = API.getIndex()
|
seasonnum = API.getIndex()
|
||||||
# Get parent tv show Plex id
|
# Get parent tv show Plex id
|
||||||
plexshowid = item.attrib.get('parentRatingKey')
|
plexshowid = item.attrib.get('parentRatingKey')
|
||||||
|
@ -767,8 +763,8 @@ class TVShows(Items):
|
||||||
update_item = False
|
update_item = False
|
||||||
|
|
||||||
# Process artwork
|
# Process artwork
|
||||||
allartworks = API.getAllArtwork()
|
with artwork.Artwork('video') as art:
|
||||||
artwork.addArtwork(allartworks, seasonid, "season", kodicursor)
|
art.addArtwork(API.getAllArtwork(), seasonid, "season")
|
||||||
|
|
||||||
if update_item:
|
if update_item:
|
||||||
# Update a reference: checksum in emby table
|
# Update a reference: checksum in emby table
|
||||||
|
@ -790,7 +786,6 @@ class TVShows(Items):
|
||||||
# Process single episode
|
# Process single episode
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
# If the item already exist in the local Kodi DB we'll perform a full
|
# If the item already exist in the local Kodi DB we'll perform a full
|
||||||
|
@ -1037,8 +1032,8 @@ class TVShows(Items):
|
||||||
if poster:
|
if poster:
|
||||||
poster = API.addPlexCredentialsToUrl(
|
poster = API.addPlexCredentialsToUrl(
|
||||||
"%s%s" % (self.server, poster))
|
"%s%s" % (self.server, poster))
|
||||||
artwork.addOrUpdateArt(
|
with artwork.Artwork('video') as art:
|
||||||
poster, episodeid, "episode", "thumb", kodicursor)
|
art.addOrUpdateArt(poster, episodeid, "episode", "thumb")
|
||||||
# poster of TV show itself
|
# poster of TV show itself
|
||||||
# poster = item.attrib.get('grandparentThumb')
|
# poster = item.attrib.get('grandparentThumb')
|
||||||
# if poster:
|
# if poster:
|
||||||
|
@ -1177,19 +1172,22 @@ class TVShows(Items):
|
||||||
|
|
||||||
def removeShow(self, kodiid):
|
def removeShow(self, kodiid):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
self.artwork.deleteArtwork(kodiid, "tvshow", kodicursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.deleteArtwork(kodiid, "tvshow")
|
||||||
kodicursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodiid,))
|
kodicursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodiid,))
|
||||||
log.info("Removed tvshow: %s." % kodiid)
|
log.info("Removed tvshow: %s." % kodiid)
|
||||||
|
|
||||||
def removeSeason(self, kodiid):
|
def removeSeason(self, kodiid):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
self.artwork.deleteArtwork(kodiid, "season", kodicursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.deleteArtwork(kodiid, "season")
|
||||||
kodicursor.execute("DELETE FROM seasons WHERE idSeason = ?", (kodiid,))
|
kodicursor.execute("DELETE FROM seasons WHERE idSeason = ?", (kodiid,))
|
||||||
log.info("Removed season: %s." % kodiid)
|
log.info("Removed season: %s." % kodiid)
|
||||||
|
|
||||||
def removeEpisode(self, kodiid, fileid):
|
def removeEpisode(self, kodiid, fileid):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
self.artwork.deleteArtwork(kodiid, "episode", kodicursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.deleteArtwork(kodiid, "episode")
|
||||||
kodicursor.execute("DELETE FROM episode WHERE idEpisode = ?", (kodiid,))
|
kodicursor.execute("DELETE FROM episode WHERE idEpisode = ?", (kodiid,))
|
||||||
kodicursor.execute("DELETE FROM files WHERE idFile = ?", (fileid,))
|
kodicursor.execute("DELETE FROM files WHERE idFile = ?", (fileid,))
|
||||||
log.info("Removed episode: %s." % kodiid)
|
log.info("Removed episode: %s." % kodiid)
|
||||||
|
@ -1224,7 +1222,6 @@ class Music(Items):
|
||||||
artisttype="MusicArtist"):
|
artisttype="MusicArtist"):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
update_item = True
|
update_item = True
|
||||||
|
@ -1299,13 +1296,13 @@ class Music(Items):
|
||||||
dateadded, artistid))
|
dateadded, artistid))
|
||||||
|
|
||||||
# Update artwork
|
# Update artwork
|
||||||
artwork.addArtwork(artworks, artistid, "artist", kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.addArtwork(artworks, artistid, "artist")
|
||||||
|
|
||||||
@CatchExceptions(warnuser=True)
|
@CatchExceptions(warnuser=True)
|
||||||
def add_updateAlbum(self, item, viewtag=None, viewid=None):
|
def add_updateAlbum(self, item, viewtag=None, viewid=None):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
update_item = True
|
update_item = True
|
||||||
|
@ -1488,14 +1485,14 @@ class Music(Items):
|
||||||
# Add genres
|
# Add genres
|
||||||
self.kodi_db.addMusicGenres(albumid, genres, "album")
|
self.kodi_db.addMusicGenres(albumid, genres, "album")
|
||||||
# Update artwork
|
# Update artwork
|
||||||
artwork.addArtwork(artworks, albumid, "album", kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.addArtwork(artworks, albumid, "album")
|
||||||
|
|
||||||
@CatchExceptions(warnuser=True)
|
@CatchExceptions(warnuser=True)
|
||||||
def add_updateSong(self, item, viewtag=None, viewid=None):
|
def add_updateSong(self, item, viewtag=None, viewid=None):
|
||||||
# Process single song
|
# Process single song
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
emby_db = self.emby_db
|
emby_db = self.emby_db
|
||||||
artwork = self.artwork
|
|
||||||
API = PlexAPI.API(item)
|
API = PlexAPI.API(item)
|
||||||
|
|
||||||
update_item = True
|
update_item = True
|
||||||
|
@ -1821,12 +1818,14 @@ class Music(Items):
|
||||||
allart = API.getAllArtwork(parentInfo=True)
|
allart = API.getAllArtwork(parentInfo=True)
|
||||||
if hasEmbeddedCover:
|
if hasEmbeddedCover:
|
||||||
allart["Primary"] = "image://music@" + artwork.single_urlencode( playurl )
|
allart["Primary"] = "image://music@" + artwork.single_urlencode( playurl )
|
||||||
artwork.addArtwork(allart, songid, "song", kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.addArtwork(allart, songid, "song")
|
||||||
|
|
||||||
# if item.get('AlbumId') is None:
|
# if item.get('AlbumId') is None:
|
||||||
if item.get('parentKey') is None:
|
if item.get('parentKey') is None:
|
||||||
# Update album artwork
|
# Update album artwork
|
||||||
artwork.addArtwork(allart, albumid, "album", kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.addArtwork(allart, albumid, "album")
|
||||||
|
|
||||||
def remove(self, itemid):
|
def remove(self, itemid):
|
||||||
# Remove kodiid, fileid, pathid, emby reference
|
# Remove kodiid, fileid, pathid, emby reference
|
||||||
|
@ -1906,16 +1905,19 @@ class Music(Items):
|
||||||
log.info("Deleted %s: %s from kodi database" % (mediatype, itemid))
|
log.info("Deleted %s: %s from kodi database" % (mediatype, itemid))
|
||||||
|
|
||||||
def removeSong(self, kodiid):
|
def removeSong(self, kodiid):
|
||||||
self.artwork.deleteArtwork(kodiid, "song", self.kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.deleteArtwork(kodiid, "song")
|
||||||
self.kodicursor.execute("DELETE FROM song WHERE idSong = ?",
|
self.kodicursor.execute("DELETE FROM song WHERE idSong = ?",
|
||||||
(kodiid,))
|
(kodiid,))
|
||||||
|
|
||||||
def removeAlbum(self, kodiid):
|
def removeAlbum(self, kodiid):
|
||||||
self.artwork.deleteArtwork(kodiid, "album", self.kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.deleteArtwork(kodiid, "album")
|
||||||
self.kodicursor.execute("DELETE FROM album WHERE idAlbum = ?",
|
self.kodicursor.execute("DELETE FROM album WHERE idAlbum = ?",
|
||||||
(kodiid,))
|
(kodiid,))
|
||||||
|
|
||||||
def removeArtist(self, kodiid):
|
def removeArtist(self, kodiid):
|
||||||
self.artwork.deleteArtwork(kodiid, "artist", self.kodicursor)
|
with artwork.Artwork('music') as art:
|
||||||
|
art.deleteArtwork(kodiid, "artist")
|
||||||
self.kodicursor.execute("DELETE FROM artist WHERE idArtist = ?",
|
self.kodicursor.execute("DELETE FROM artist WHERE idArtist = ?",
|
||||||
(kodiid,))
|
(kodiid,))
|
||||||
|
|
|
@ -50,7 +50,6 @@ class Kodidb_Functions():
|
||||||
self.cursor = cursor
|
self.cursor = cursor
|
||||||
|
|
||||||
self.clientInfo = clientinfo.ClientInfo()
|
self.clientInfo = clientinfo.ClientInfo()
|
||||||
self.artwork = artwork.Artwork()
|
|
||||||
|
|
||||||
def pathHack(self):
|
def pathHack(self):
|
||||||
"""
|
"""
|
||||||
|
@ -506,7 +505,8 @@ class Kodidb_Functions():
|
||||||
if "writing" in arttype:
|
if "writing" in arttype:
|
||||||
arttype = "writer"
|
arttype = "writer"
|
||||||
|
|
||||||
self.artwork.addOrUpdateArt(thumb, actorid, arttype, "thumb", self.cursor)
|
with artwork.Artwork('video') as art:
|
||||||
|
art.addOrUpdateArt(thumb, actorid, arttype, "thumb")
|
||||||
|
|
||||||
def existingArt(self, kodiId, mediaType, refresh=False):
|
def existingArt(self, kodiId, mediaType, refresh=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,7 +11,6 @@ import xbmc
|
||||||
import xbmcgui
|
import xbmcgui
|
||||||
import xbmcplugin
|
import xbmcplugin
|
||||||
|
|
||||||
import artwork
|
|
||||||
import playutils as putils
|
import playutils as putils
|
||||||
import playlist
|
import playlist
|
||||||
from utils import window, settings, tryEncode, tryDecode
|
from utils import window, settings, tryEncode, tryDecode
|
||||||
|
@ -39,7 +38,6 @@ class PlaybackUtils():
|
||||||
self.userid = window('currUserId')
|
self.userid = window('currUserId')
|
||||||
self.server = window('pms_server')
|
self.server = window('pms_server')
|
||||||
|
|
||||||
self.artwork = artwork.Artwork()
|
|
||||||
if self.API.getType() == 'track':
|
if self.API.getType() == 'track':
|
||||||
self.pl = playlist.Playlist(typus='music')
|
self.pl = playlist.Playlist(typus='music')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue