Revert "constructor (with Artwork() as art)"
This reverts commit 168014c33b
.
This commit is contained in:
parent
168014c33b
commit
c4de7587bf
5 changed files with 62 additions and 87 deletions
|
@ -173,8 +173,8 @@ class Main():
|
||||||
|
|
||||||
elif mode == "texturecache":
|
elif mode == "texturecache":
|
||||||
import artwork
|
import artwork
|
||||||
with artwork.Artwork('music') as art:
|
artwork.Artwork().fullTextureCacheSync()
|
||||||
art.fullTextureCacheSync()
|
|
||||||
else:
|
else:
|
||||||
entrypoint.doMainListing()
|
entrypoint.doMainListing()
|
||||||
|
|
||||||
|
|
|
@ -120,13 +120,6 @@ 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"
|
||||||
|
@ -143,25 +136,6 @@ 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)
|
||||||
|
@ -317,7 +291,7 @@ class Artwork():
|
||||||
else:
|
else:
|
||||||
self.addWorkerImageCacheThread(url)
|
self.addWorkerImageCacheThread(url)
|
||||||
|
|
||||||
def addArtwork(self, artwork, kodiId, mediaType):
|
def addArtwork(self, artwork, kodiId, mediaType, cursor):
|
||||||
# Kodi conversion table
|
# Kodi conversion table
|
||||||
kodiart = {
|
kodiart = {
|
||||||
|
|
||||||
|
@ -348,8 +322,8 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type LIKE ?"
|
"AND type LIKE ?"
|
||||||
))
|
))
|
||||||
self.cursor.execute(query, (kodiId, mediaType, "fanart%",))
|
cursor.execute(query, (kodiId, mediaType, "fanart%",))
|
||||||
rows = self.cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
|
||||||
if len(rows) > backdropsNumber:
|
if len(rows) > backdropsNumber:
|
||||||
# More backdrops in database. Delete extra fanart.
|
# More backdrops in database. Delete extra fanart.
|
||||||
|
@ -360,7 +334,7 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type LIKE ?"
|
"AND type LIKE ?"
|
||||||
))
|
))
|
||||||
self.cursor.execute(query, (kodiId, mediaType, "fanart_",))
|
cursor.execute(query, (kodiId, mediaType, "fanart_",))
|
||||||
|
|
||||||
# Process backdrops and extra fanart
|
# Process backdrops and extra fanart
|
||||||
index = ""
|
index = ""
|
||||||
|
@ -369,11 +343,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:
|
try: # Will only fail on the first try, str to int.
|
||||||
# Will only fail on the first try, str to int.
|
|
||||||
index += 1
|
index += 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
index = 1
|
index = 1
|
||||||
|
@ -385,16 +359,19 @@ 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):
|
def addOrUpdateArt(self, imageUrl, kodiId, mediaType, imageType, cursor):
|
||||||
if not imageUrl:
|
if not imageUrl:
|
||||||
# Possible that the imageurl is an empty string
|
# Possible that the imageurl is an empty string
|
||||||
return
|
return
|
||||||
|
@ -406,10 +383,10 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type = ?"
|
"AND type = ?"
|
||||||
))
|
))
|
||||||
self.cursor.execute(query, (kodiId, mediaType, imageType,))
|
cursor.execute(query, (kodiId, mediaType, imageType,))
|
||||||
try:
|
try:
|
||||||
# Update the artwork
|
# Update the artwork
|
||||||
url = self.cursor.fetchone()[0]
|
url = 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)"
|
||||||
|
@ -420,8 +397,7 @@ class Artwork():
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
self.cursor.execute(query,
|
cursor.execute(query, (kodiId, mediaType, imageType, imageUrl))
|
||||||
(kodiId, mediaType, imageType, imageUrl))
|
|
||||||
else:
|
else:
|
||||||
if url == imageUrl:
|
if url == imageUrl:
|
||||||
# Only cache artwork if it changed
|
# Only cache artwork if it changed
|
||||||
|
@ -440,21 +416,20 @@ class Artwork():
|
||||||
"AND media_type = ?",
|
"AND media_type = ?",
|
||||||
"AND type = ?"
|
"AND type = ?"
|
||||||
))
|
))
|
||||||
self.cursor.execute(query,
|
cursor.execute(query, (imageUrl, kodiId, mediaType, imageType))
|
||||||
(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):
|
def deleteArtwork(self, kodiId, mediaType, cursor):
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
"SELECT url",
|
"SELECT url",
|
||||||
"FROM art",
|
"FROM art",
|
||||||
"WHERE media_id = ?",
|
"WHERE media_id = ?",
|
||||||
"AND media_type = ?"
|
"AND media_type = ?"
|
||||||
))
|
))
|
||||||
self.cursor.execute(query, (kodiId, mediaType,))
|
cursor.execute(query, (kodiId, mediaType,))
|
||||||
rows = self.cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.deleteCachedArtwork(row[0])
|
self.deleteCachedArtwork(row[0])
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ 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')
|
||||||
|
|
||||||
|
@ -72,19 +73,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()
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.addArtwork(API.getFanartArtwork(allartworks),
|
||||||
art.addArtwork(API.getFanartArtwork(allartworks),
|
kodiId,
|
||||||
kodiId,
|
mediaType,
|
||||||
mediaType)
|
self.kodicursor)
|
||||||
# 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)
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.addArtwork(API.getSetArtwork(),
|
||||||
art.addArtwork(API.getSetArtwork(),
|
setid,
|
||||||
setid,
|
"set",
|
||||||
"set")
|
self.kodicursor)
|
||||||
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):
|
||||||
|
@ -308,6 +309,7 @@ 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
|
||||||
|
@ -494,8 +496,7 @@ 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
|
||||||
with artwork.Artwork('video') as art:
|
artwork.addArtwork(API.getAllArtwork(), movieid, "movie", kodicursor)
|
||||||
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
|
||||||
|
@ -515,6 +516,8 @@ 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]
|
||||||
|
@ -528,8 +531,7 @@ class Movies(Items):
|
||||||
# Remove the emby reference
|
# Remove the emby reference
|
||||||
emby_db.removeItem(itemid)
|
emby_db.removeItem(itemid)
|
||||||
# Remove artwork
|
# Remove artwork
|
||||||
with artwork.Artwork('video') as art:
|
artwork.deleteArtwork(kodiid, mediatype, kodicursor)
|
||||||
art.deleteArtwork(kodiid, mediatype)
|
|
||||||
|
|
||||||
if mediatype == "movie":
|
if mediatype == "movie":
|
||||||
# Delete kodi movie and file
|
# Delete kodi movie and file
|
||||||
|
@ -559,6 +561,7 @@ 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
|
||||||
|
@ -716,8 +719,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
|
||||||
with artwork.Artwork('video') as art:
|
allartworks = API.getAllArtwork()
|
||||||
art.addArtwork(API.getAllArtwork(), showid, "tvshow")
|
artwork.addArtwork(allartworks, showid, "tvshow", kodicursor)
|
||||||
# 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
|
||||||
|
@ -740,6 +743,7 @@ 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')
|
||||||
|
@ -763,8 +767,8 @@ class TVShows(Items):
|
||||||
update_item = False
|
update_item = False
|
||||||
|
|
||||||
# Process artwork
|
# Process artwork
|
||||||
with artwork.Artwork('video') as art:
|
allartworks = API.getAllArtwork()
|
||||||
art.addArtwork(API.getAllArtwork(), seasonid, "season")
|
artwork.addArtwork(allartworks, seasonid, "season", kodicursor)
|
||||||
|
|
||||||
if update_item:
|
if update_item:
|
||||||
# Update a reference: checksum in emby table
|
# Update a reference: checksum in emby table
|
||||||
|
@ -786,6 +790,7 @@ 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
|
||||||
|
@ -1032,8 +1037,8 @@ class TVShows(Items):
|
||||||
if poster:
|
if poster:
|
||||||
poster = API.addPlexCredentialsToUrl(
|
poster = API.addPlexCredentialsToUrl(
|
||||||
"%s%s" % (self.server, poster))
|
"%s%s" % (self.server, poster))
|
||||||
with artwork.Artwork('video') as art:
|
artwork.addOrUpdateArt(
|
||||||
art.addOrUpdateArt(poster, episodeid, "episode", "thumb")
|
poster, episodeid, "episode", "thumb", kodicursor)
|
||||||
# poster of TV show itself
|
# poster of TV show itself
|
||||||
# poster = item.attrib.get('grandparentThumb')
|
# poster = item.attrib.get('grandparentThumb')
|
||||||
# if poster:
|
# if poster:
|
||||||
|
@ -1172,22 +1177,19 @@ class TVShows(Items):
|
||||||
|
|
||||||
def removeShow(self, kodiid):
|
def removeShow(self, kodiid):
|
||||||
kodicursor = self.kodicursor
|
kodicursor = self.kodicursor
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.deleteArtwork(kodiid, "tvshow", kodicursor)
|
||||||
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
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.deleteArtwork(kodiid, "season", kodicursor)
|
||||||
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
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.deleteArtwork(kodiid, "episode", kodicursor)
|
||||||
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)
|
||||||
|
@ -1222,6 +1224,7 @@ 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
|
||||||
|
@ -1296,13 +1299,13 @@ class Music(Items):
|
||||||
dateadded, artistid))
|
dateadded, artistid))
|
||||||
|
|
||||||
# Update artwork
|
# Update artwork
|
||||||
with artwork.Artwork('music') as art:
|
artwork.addArtwork(artworks, artistid, "artist", kodicursor)
|
||||||
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
|
||||||
|
@ -1485,14 +1488,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
|
||||||
with artwork.Artwork('music') as art:
|
artwork.addArtwork(artworks, albumid, "album", kodicursor)
|
||||||
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
|
||||||
|
@ -1818,14 +1821,12 @@ 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 )
|
||||||
with artwork.Artwork('music') as art:
|
artwork.addArtwork(allart, songid, "song", kodicursor)
|
||||||
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
|
||||||
with artwork.Artwork('music') as art:
|
artwork.addArtwork(allart, albumid, "album", kodicursor)
|
||||||
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
|
||||||
|
@ -1905,19 +1906,16 @@ 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):
|
||||||
with artwork.Artwork('music') as art:
|
self.artwork.deleteArtwork(kodiid, "song", self.kodicursor)
|
||||||
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):
|
||||||
with artwork.Artwork('music') as art:
|
self.artwork.deleteArtwork(kodiid, "album", self.kodicursor)
|
||||||
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):
|
||||||
with artwork.Artwork('music') as art:
|
self.artwork.deleteArtwork(kodiid, "artist", self.kodicursor)
|
||||||
art.deleteArtwork(kodiid, "artist")
|
|
||||||
self.kodicursor.execute("DELETE FROM artist WHERE idArtist = ?",
|
self.kodicursor.execute("DELETE FROM artist WHERE idArtist = ?",
|
||||||
(kodiid,))
|
(kodiid,))
|
||||||
|
|
|
@ -50,6 +50,7 @@ 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):
|
||||||
"""
|
"""
|
||||||
|
@ -505,8 +506,7 @@ class Kodidb_Functions():
|
||||||
if "writing" in arttype:
|
if "writing" in arttype:
|
||||||
arttype = "writer"
|
arttype = "writer"
|
||||||
|
|
||||||
with artwork.Artwork('video') as art:
|
self.artwork.addOrUpdateArt(thumb, actorid, arttype, "thumb", self.cursor)
|
||||||
art.addOrUpdateArt(thumb, actorid, arttype, "thumb")
|
|
||||||
|
|
||||||
def existingArt(self, kodiId, mediaType, refresh=False):
|
def existingArt(self, kodiId, mediaType, refresh=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,6 +11,7 @@ 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
|
||||||
|
@ -38,6 +39,7 @@ 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…
Reference in a new issue