New option to not use Plex artwork
This commit is contained in:
parent
3d4ba1e165
commit
262a2dda21
10 changed files with 285 additions and 155 deletions
|
@ -429,6 +429,11 @@ msgctxt "#30501"
|
||||||
msgid "Client SSL certificate"
|
msgid "Client SSL certificate"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
# PKC Settings - Artwork
|
||||||
|
msgctxt "#30502"
|
||||||
|
msgid "Sync Plex artwork from the PMS (recommended)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
# PKC Settings - Connection
|
# PKC Settings - Connection
|
||||||
msgctxt "#30505"
|
msgctxt "#30505"
|
||||||
msgid "[COLOR yellow]Reset login attempts[/COLOR]"
|
msgid "[COLOR yellow]Reset login attempts[/COLOR]"
|
||||||
|
|
|
@ -38,6 +38,8 @@ class Sync(object):
|
||||||
self.direct_paths = utils.settings('useDirectPaths') == '1'
|
self.direct_paths = utils.settings('useDirectPaths') == '1'
|
||||||
# Is synching of Plex music enabled?
|
# Is synching of Plex music enabled?
|
||||||
self.enable_music = utils.settings('enableMusic') == 'true'
|
self.enable_music = utils.settings('enableMusic') == 'true'
|
||||||
|
# Do we sync artwork from the PMS to Kodi?
|
||||||
|
self.artwork = utils.settings('usePlexArtwork') == 'true'
|
||||||
# Path remapping mechanism (e.g. smb paths)
|
# Path remapping mechanism (e.g. smb paths)
|
||||||
# Do we replace \\myserver\path to smb://myserver/path?
|
# Do we replace \\myserver\path to smb://myserver/path?
|
||||||
self.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
self.replace_smb_path = utils.settings('replaceSMB') == 'true'
|
||||||
|
|
|
@ -6,7 +6,7 @@ from ntpath import dirname
|
||||||
|
|
||||||
from ..plex_db import PlexDB, PLEXDB_LOCK
|
from ..plex_db import PlexDB, PLEXDB_LOCK
|
||||||
from ..kodi_db import KodiVideoDB, KODIDB_LOCK
|
from ..kodi_db import KodiVideoDB, KODIDB_LOCK
|
||||||
from .. import utils, timing
|
from .. import utils, timing, app
|
||||||
|
|
||||||
LOG = getLogger('PLEX.itemtypes.common')
|
LOG = getLogger('PLEX.itemtypes.common')
|
||||||
|
|
||||||
|
@ -61,8 +61,12 @@ class ItemBase(object):
|
||||||
self.plexcursor = self.plexconn.cursor()
|
self.plexcursor = self.plexconn.cursor()
|
||||||
self.kodiconn = utils.kodi_sql('video')
|
self.kodiconn = utils.kodi_sql('video')
|
||||||
self.kodicursor = self.kodiconn.cursor()
|
self.kodicursor = self.kodiconn.cursor()
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.artconn = utils.kodi_sql('texture')
|
self.artconn = utils.kodi_sql('texture')
|
||||||
self.artcursor = self.artconn.cursor()
|
self.artcursor = self.artconn.cursor()
|
||||||
|
else:
|
||||||
|
self.artconn = None
|
||||||
|
self.artcursor = None
|
||||||
self.plexdb = PlexDB(cursor=self.plexcursor)
|
self.plexdb = PlexDB(cursor=self.plexcursor)
|
||||||
self.kodidb = KodiVideoDB(texture_db=True,
|
self.kodidb = KodiVideoDB(texture_db=True,
|
||||||
cursor=self.kodicursor,
|
cursor=self.kodicursor,
|
||||||
|
@ -78,12 +82,14 @@ class ItemBase(object):
|
||||||
# re-raise any exception
|
# re-raise any exception
|
||||||
return False
|
return False
|
||||||
self.plexconn.commit()
|
self.plexconn.commit()
|
||||||
self.artconn.commit()
|
|
||||||
self.kodiconn.commit()
|
self.kodiconn.commit()
|
||||||
|
if self.artconn:
|
||||||
|
self.artconn.commit()
|
||||||
return self
|
return self
|
||||||
finally:
|
finally:
|
||||||
self.plexconn.close()
|
self.plexconn.close()
|
||||||
self.kodiconn.close()
|
self.kodiconn.close()
|
||||||
|
if self.artconn:
|
||||||
self.artconn.close()
|
self.artconn.close()
|
||||||
if self.lock:
|
if self.lock:
|
||||||
PLEXDB_LOCK.release()
|
PLEXDB_LOCK.release()
|
||||||
|
@ -92,10 +98,11 @@ class ItemBase(object):
|
||||||
def commit(self):
|
def commit(self):
|
||||||
self.plexconn.commit()
|
self.plexconn.commit()
|
||||||
self.plexconn.execute('BEGIN')
|
self.plexconn.execute('BEGIN')
|
||||||
self.artconn.commit()
|
|
||||||
self.artconn.execute('BEGIN')
|
|
||||||
self.kodiconn.commit()
|
self.kodiconn.commit()
|
||||||
self.kodiconn.execute('BEGIN')
|
self.kodiconn.execute('BEGIN')
|
||||||
|
if self.artconn:
|
||||||
|
self.artconn.commit()
|
||||||
|
self.artconn.execute('BEGIN')
|
||||||
|
|
||||||
def set_fanart(self, artworks, kodi_id, kodi_type):
|
def set_fanart(self, artworks, kodi_id, kodi_type):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -110,6 +110,7 @@ class Movie(ItemBase):
|
||||||
self.kodidb.modify_people(kodi_id,
|
self.kodidb.modify_people(kodi_id,
|
||||||
v.KODI_TYPE_MOVIE,
|
v.KODI_TYPE_MOVIE,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_MOVIE)
|
v.KODI_TYPE_MOVIE)
|
||||||
|
@ -137,6 +138,7 @@ class Movie(ItemBase):
|
||||||
self.kodidb.add_people(kodi_id,
|
self.kodidb.add_people(kodi_id,
|
||||||
v.KODI_TYPE_MOVIE,
|
v.KODI_TYPE_MOVIE,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_MOVIE)
|
v.KODI_TYPE_MOVIE)
|
||||||
|
@ -179,6 +181,9 @@ class Movie(ItemBase):
|
||||||
# Add any sets from Plex collection tags
|
# Add any sets from Plex collection tags
|
||||||
kodi_set_id = self.kodidb.create_collection(set_name)
|
kodi_set_id = self.kodidb.create_collection(set_name)
|
||||||
self.kodidb.assign_collection(kodi_set_id, kodi_id)
|
self.kodidb.assign_collection(kodi_set_id, kodi_id)
|
||||||
|
if not app.SYNC.artwork:
|
||||||
|
# Rest below is to get collection artwork
|
||||||
|
continue
|
||||||
if children is None:
|
if children is None:
|
||||||
# e.g. when added via websocket
|
# e.g. when added via websocket
|
||||||
LOG.debug('Costly looking up Plex collection %s: %s',
|
LOG.debug('Costly looking up Plex collection %s: %s',
|
||||||
|
|
|
@ -24,6 +24,7 @@ class MusicMixin(object):
|
||||||
self.plexcursor = self.plexconn.cursor()
|
self.plexcursor = self.plexconn.cursor()
|
||||||
self.kodiconn = utils.kodi_sql('music')
|
self.kodiconn = utils.kodi_sql('music')
|
||||||
self.kodicursor = self.kodiconn.cursor()
|
self.kodicursor = self.kodiconn.cursor()
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.artconn = utils.kodi_sql('texture')
|
self.artconn = utils.kodi_sql('texture')
|
||||||
self.artcursor = self.artconn.cursor()
|
self.artcursor = self.artconn.cursor()
|
||||||
self.plexdb = PlexDB(self.plexcursor)
|
self.plexdb = PlexDB(self.plexcursor)
|
||||||
|
@ -170,7 +171,7 @@ class Artist(MusicMixin, ItemBase):
|
||||||
# Not yet implemented by Plex
|
# Not yet implemented by Plex
|
||||||
musicBrainzId = None
|
musicBrainzId = None
|
||||||
|
|
||||||
# Associate artwork
|
if app.SYNC.artwork:
|
||||||
artworks = api.artwork()
|
artworks = api.artwork()
|
||||||
if 'poster' in artworks:
|
if 'poster' in artworks:
|
||||||
thumb = "<thumb>%s</thumb>" % artworks['poster']
|
thumb = "<thumb>%s</thumb>" % artworks['poster']
|
||||||
|
@ -180,6 +181,8 @@ class Artist(MusicMixin, ItemBase):
|
||||||
fanart = "<fanart>%s</fanart>" % artworks['fanart']
|
fanart = "<fanart>%s</fanart>" % artworks['fanart']
|
||||||
else:
|
else:
|
||||||
fanart = None
|
fanart = None
|
||||||
|
else:
|
||||||
|
thumb, fanart = None, None
|
||||||
|
|
||||||
# UPDATE THE ARTIST #####
|
# UPDATE THE ARTIST #####
|
||||||
if update_item:
|
if update_item:
|
||||||
|
@ -198,7 +201,7 @@ class Artist(MusicMixin, ItemBase):
|
||||||
fanart,
|
fanart,
|
||||||
timing.unix_date_to_kodi(self.last_sync),
|
timing.unix_date_to_kodi(self.last_sync),
|
||||||
kodi_id)
|
kodi_id)
|
||||||
# Update artwork
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_ARTIST)
|
v.KODI_TYPE_ARTIST)
|
||||||
|
@ -265,12 +268,14 @@ class Album(MusicMixin, ItemBase):
|
||||||
musicBrainzId = None
|
musicBrainzId = None
|
||||||
genres = api.genre_list()
|
genres = api.genre_list()
|
||||||
genre = api.list_to_string(genres)
|
genre = api.list_to_string(genres)
|
||||||
# Associate artwork
|
if app.SYNC.artwork:
|
||||||
artworks = api.artwork()
|
artworks = api.artwork()
|
||||||
if 'poster' in artworks:
|
if 'poster' in artworks:
|
||||||
thumb = "<thumb>%s</thumb>" % artworks['poster']
|
thumb = "<thumb>%s</thumb>" % artworks['poster']
|
||||||
else:
|
else:
|
||||||
thumb = None
|
thumb = None
|
||||||
|
else:
|
||||||
|
thumb = None
|
||||||
|
|
||||||
# UPDATE THE ALBUM #####
|
# UPDATE THE ALBUM #####
|
||||||
if update_item:
|
if update_item:
|
||||||
|
@ -341,6 +346,7 @@ class Album(MusicMixin, ItemBase):
|
||||||
self.kodidb.add_music_genres(kodi_id,
|
self.kodidb.add_music_genres(kodi_id,
|
||||||
genres,
|
genres,
|
||||||
v.KODI_TYPE_ALBUM)
|
v.KODI_TYPE_ALBUM)
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_ALBUM)
|
v.KODI_TYPE_ALBUM)
|
||||||
|
@ -630,6 +636,7 @@ class Song(MusicMixin, ItemBase):
|
||||||
# Add genres
|
# Add genres
|
||||||
if genres:
|
if genres:
|
||||||
self.kodidb.add_music_genres(kodi_id, genres, v.KODI_TYPE_SONG)
|
self.kodidb.add_music_genres(kodi_id, genres, v.KODI_TYPE_SONG)
|
||||||
|
if app.SYNC.artwork:
|
||||||
artworks = api.artwork()
|
artworks = api.artwork()
|
||||||
self.kodidb.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
|
|
|
@ -204,6 +204,7 @@ class Show(TvShowMixin, ItemBase):
|
||||||
self.kodidb.modify_people(kodi_id,
|
self.kodidb.modify_people(kodi_id,
|
||||||
v.KODI_TYPE_SHOW,
|
v.KODI_TYPE_SHOW,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_SHOW)
|
v.KODI_TYPE_SHOW)
|
||||||
|
@ -243,6 +244,7 @@ class Show(TvShowMixin, ItemBase):
|
||||||
self.kodidb.add_people(kodi_id,
|
self.kodidb.add_people(kodi_id,
|
||||||
v.KODI_TYPE_SHOW,
|
v.KODI_TYPE_SHOW,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_SHOW)
|
v.KODI_TYPE_SHOW)
|
||||||
|
@ -310,6 +312,7 @@ class Season(TvShowMixin, ItemBase):
|
||||||
LOG.error('Still could not find parent tv show %s', show_id)
|
LOG.error('Still could not find parent tv show %s', show_id)
|
||||||
return
|
return
|
||||||
parent_id = show['kodi_id']
|
parent_id = show['kodi_id']
|
||||||
|
if app.SYNC.artwork:
|
||||||
parent_artwork = api.artwork(kodi_id=parent_id,
|
parent_artwork = api.artwork(kodi_id=parent_id,
|
||||||
kodi_type=v.KODI_TYPE_SHOW)
|
kodi_type=v.KODI_TYPE_SHOW)
|
||||||
artwork = api.artwork()
|
artwork = api.artwork()
|
||||||
|
@ -320,12 +323,14 @@ class Season(TvShowMixin, ItemBase):
|
||||||
if update_item:
|
if update_item:
|
||||||
LOG.info('UPDATE season plex_id %s - %s', plex_id, api.title())
|
LOG.info('UPDATE season plex_id %s - %s', plex_id, api.title())
|
||||||
kodi_id = season['kodi_id']
|
kodi_id = season['kodi_id']
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(artwork,
|
self.kodidb.modify_artwork(artwork,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_SEASON)
|
v.KODI_TYPE_SEASON)
|
||||||
else:
|
else:
|
||||||
LOG.info('ADD season plex_id %s - %s', plex_id, api.title())
|
LOG.info('ADD season plex_id %s - %s', plex_id, api.title())
|
||||||
kodi_id = self.kodidb.add_season(parent_id, api.season_number())
|
kodi_id = self.kodidb.add_season(parent_id, api.season_number())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.add_artwork(artwork,
|
self.kodidb.add_artwork(artwork,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_SEASON)
|
v.KODI_TYPE_SEASON)
|
||||||
|
@ -475,6 +480,7 @@ class Episode(TvShowMixin, ItemBase):
|
||||||
self.kodidb.modify_people(kodi_id,
|
self.kodidb.modify_people(kodi_id,
|
||||||
v.KODI_TYPE_EPISODE,
|
v.KODI_TYPE_EPISODE,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_EPISODE)
|
v.KODI_TYPE_EPISODE)
|
||||||
|
@ -537,6 +543,7 @@ class Episode(TvShowMixin, ItemBase):
|
||||||
self.kodidb.add_people(kodi_id,
|
self.kodidb.add_people(kodi_id,
|
||||||
v.KODI_TYPE_EPISODE,
|
v.KODI_TYPE_EPISODE,
|
||||||
api.people_list())
|
api.people_list())
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_EPISODE)
|
v.KODI_TYPE_EPISODE)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import absolute_import, division, unicode_literals
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
from . import common
|
from . import common
|
||||||
from .. import variables as v
|
from .. import variables as v, app
|
||||||
|
|
||||||
LOG = getLogger('PLEX.kodi_db.music')
|
LOG = getLogger('PLEX.kodi_db.music')
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
"""
|
"""
|
||||||
strReleaseType: 'album' or 'single'
|
strReleaseType: 'album' or 'single'
|
||||||
"""
|
"""
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
INSERT INTO album(
|
INSERT INTO album(
|
||||||
idAlbum,
|
idAlbum,
|
||||||
|
@ -162,8 +163,28 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
strReleaseType)
|
strReleaseType)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
''', (args))
|
''', (args))
|
||||||
|
else:
|
||||||
|
args = list(args)
|
||||||
|
del args[8]
|
||||||
|
self.cursor.execute('''
|
||||||
|
INSERT INTO album(
|
||||||
|
idAlbum,
|
||||||
|
strAlbum,
|
||||||
|
strMusicBrainzAlbumID,
|
||||||
|
strArtists,
|
||||||
|
strGenres,
|
||||||
|
iYear,
|
||||||
|
bCompilation,
|
||||||
|
strReview,
|
||||||
|
strLabel,
|
||||||
|
iUserrating,
|
||||||
|
lastScraped,
|
||||||
|
strReleaseType)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', (args))
|
||||||
|
|
||||||
def update_album_17(self, *args):
|
def update_album_17(self, *args):
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
UPDATE album
|
UPDATE album
|
||||||
SET strAlbum = ?,
|
SET strAlbum = ?,
|
||||||
|
@ -180,11 +201,30 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
strReleaseType = ?
|
strReleaseType = ?
|
||||||
WHERE idAlbum = ?
|
WHERE idAlbum = ?
|
||||||
''', (args))
|
''', (args))
|
||||||
|
else:
|
||||||
|
args = list(args)
|
||||||
|
del args[7]
|
||||||
|
self.cursor.execute('''
|
||||||
|
UPDATE album
|
||||||
|
SET strAlbum = ?,
|
||||||
|
strMusicBrainzAlbumID = ?,
|
||||||
|
strArtists = ?,
|
||||||
|
strGenres = ?,
|
||||||
|
iYear = ?,
|
||||||
|
bCompilation = ?,
|
||||||
|
strReview = ?,
|
||||||
|
strLabel = ?,
|
||||||
|
iUserrating = ?,
|
||||||
|
lastScraped = ?,
|
||||||
|
strReleaseType = ?
|
||||||
|
WHERE idAlbum = ?
|
||||||
|
''', (args))
|
||||||
|
|
||||||
def add_album(self, *args):
|
def add_album(self, *args):
|
||||||
"""
|
"""
|
||||||
strReleaseType: 'album' or 'single'
|
strReleaseType: 'album' or 'single'
|
||||||
"""
|
"""
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
INSERT INTO album(
|
INSERT INTO album(
|
||||||
idAlbum,
|
idAlbum,
|
||||||
|
@ -202,8 +242,28 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
strReleaseType)
|
strReleaseType)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
''', (args))
|
''', (args))
|
||||||
|
else:
|
||||||
|
args = list(args)
|
||||||
|
del args[8]
|
||||||
|
self.cursor.execute('''
|
||||||
|
INSERT INTO album(
|
||||||
|
idAlbum,
|
||||||
|
strAlbum,
|
||||||
|
strMusicBrainzAlbumID,
|
||||||
|
strArtistDisp,
|
||||||
|
strGenres,
|
||||||
|
iYear,
|
||||||
|
bCompilation,
|
||||||
|
strReview,
|
||||||
|
strLabel,
|
||||||
|
iUserrating,
|
||||||
|
lastScraped,
|
||||||
|
strReleaseType)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', (args))
|
||||||
|
|
||||||
def update_album(self, *args):
|
def update_album(self, *args):
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
UPDATE album
|
UPDATE album
|
||||||
SET strAlbum = ?,
|
SET strAlbum = ?,
|
||||||
|
@ -220,6 +280,24 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
strReleaseType = ?
|
strReleaseType = ?
|
||||||
WHERE idAlbum = ?
|
WHERE idAlbum = ?
|
||||||
''', (args))
|
''', (args))
|
||||||
|
else:
|
||||||
|
args = list(args)
|
||||||
|
del args[7]
|
||||||
|
self.cursor.execute('''
|
||||||
|
UPDATE album
|
||||||
|
SET strAlbum = ?,
|
||||||
|
strMusicBrainzAlbumID = ?,
|
||||||
|
strArtistDisp = ?,
|
||||||
|
strGenres = ?,
|
||||||
|
iYear = ?,
|
||||||
|
bCompilation = ?,
|
||||||
|
strReview = ?,
|
||||||
|
strLabel = ?,
|
||||||
|
iUserrating = ?,
|
||||||
|
lastScraped = ?,
|
||||||
|
strReleaseType = ?
|
||||||
|
WHERE idAlbum = ?
|
||||||
|
''', (args))
|
||||||
|
|
||||||
def add_albumartist(self, artist_id, kodi_id, artistname):
|
def add_albumartist(self, artist_id, kodi_id, artistname):
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
|
@ -424,6 +502,7 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
return artistid
|
return artistid
|
||||||
|
|
||||||
def update_artist(self, *args):
|
def update_artist(self, *args):
|
||||||
|
if app.SYNC.artwork:
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
UPDATE artist
|
UPDATE artist
|
||||||
SET strGenres = ?,
|
SET strGenres = ?,
|
||||||
|
@ -433,6 +512,16 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
lastScraped = ?
|
lastScraped = ?
|
||||||
WHERE idArtist = ?
|
WHERE idArtist = ?
|
||||||
''', (args))
|
''', (args))
|
||||||
|
else:
|
||||||
|
args = list(args)
|
||||||
|
del args[3], args[2]
|
||||||
|
self.cursor.execute('''
|
||||||
|
UPDATE artist
|
||||||
|
SET strGenres = ?,
|
||||||
|
strBiography = ?,
|
||||||
|
lastScraped = ?
|
||||||
|
WHERE idArtist = ?
|
||||||
|
''', (args))
|
||||||
|
|
||||||
def remove_song(self, kodi_id):
|
def remove_song(self, kodi_id):
|
||||||
self.cursor.execute('DELETE FROM song WHERE idSong = ?', (kodi_id, ))
|
self.cursor.execute('DELETE FROM song WHERE idSong = ?', (kodi_id, ))
|
||||||
|
|
|
@ -13,7 +13,8 @@ from .. import itemtypes, plex_functions as PF, variables as v, app
|
||||||
LOG = getLogger('PLEX.sync.fanart')
|
LOG = getLogger('PLEX.sync.fanart')
|
||||||
|
|
||||||
SUPPORTED_TYPES = (v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW)
|
SUPPORTED_TYPES = (v.PLEX_TYPE_MOVIE, v.PLEX_TYPE_SHOW)
|
||||||
SYNC_FANART = utils.settings('FanartTV') == 'true'
|
SYNC_FANART = (utils.settings('FanartTV') == 'true' and
|
||||||
|
utils.settings('usePlexArtwork') == 'true')
|
||||||
PREFER_KODI_COLLECTION_ART = utils.settings('PreferKodiCollectionArt') == 'false'
|
PREFER_KODI_COLLECTION_ART = utils.settings('PreferKodiCollectionArt') == 'false'
|
||||||
BATCH_SIZE = 500
|
BATCH_SIZE = 500
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,9 @@ class Sync(backgroundthread.KillableThread):
|
||||||
if not utils.settings('FanartTV') == 'true':
|
if not utils.settings('FanartTV') == 'true':
|
||||||
LOG.info('Additional fanart download is deactivated')
|
LOG.info('Additional fanart download is deactivated')
|
||||||
return False
|
return False
|
||||||
|
if not app.SYNC.artwork:
|
||||||
|
LOG.info('Not synching Plex PMS artwork, not getting artwork')
|
||||||
|
return False
|
||||||
elif self.fanart is None or not self.fanart.is_alive():
|
elif self.fanart is None or not self.fanart.is_alive():
|
||||||
LOG.info('Start downloading additional fanart with refresh %s',
|
LOG.info('Start downloading additional fanart with refresh %s',
|
||||||
refresh)
|
refresh)
|
||||||
|
@ -156,6 +159,9 @@ class Sync(backgroundthread.KillableThread):
|
||||||
if not utils.settings('enableTextureCache') == "true":
|
if not utils.settings('enableTextureCache') == "true":
|
||||||
LOG.info('Image caching has been deactivated')
|
LOG.info('Image caching has been deactivated')
|
||||||
return
|
return
|
||||||
|
if not app.SYNC.artwork:
|
||||||
|
LOG.info('Not synching Plex artwork - not caching')
|
||||||
|
return
|
||||||
if self.image_cache_thread and self.image_cache_thread.is_alive():
|
if self.image_cache_thread and self.image_cache_thread.is_alive():
|
||||||
self.image_cache_thread.cancel()
|
self.image_cache_thread.cancel()
|
||||||
self.image_cache_thread.join()
|
self.image_cache_thread.join()
|
||||||
|
|
|
@ -132,16 +132,17 @@
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="30544"><!-- artwork -->
|
<category label="30544"><!-- artwork -->
|
||||||
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Cache all artwork for a smooth Kodi experience -->
|
<setting id="usePlexArtwork" label="30502" type="bool" default="true" /> <!-- Sync Plex artwork from the PMS -->
|
||||||
<setting id="FanartTV" label="30539" type="bool" default="false" /><!-- Download additional art from FanArtTV -->
|
<setting id="enableTextureCache" label="30512" type="bool" default="true" visible="eq(-1,true)"/> <!-- Cache all artwork for a smooth Kodi experience -->
|
||||||
<setting id="PreferKodiCollectionArt" label="30543" type="bool" default="true" visible="eq(-1,true)" subsetting="true" /><!-- Prefer Kodi artwork for collections -->
|
<setting id="FanartTV" label="30539" type="bool" default="false" visible="eq(-2,true)"/><!-- Download additional art from FanArtTV -->
|
||||||
<setting label="39222" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=fanart)" option="close" visible="eq(-2,true)" subsetting="true" /> <!-- Look for missing fanart on FanartTV now -->
|
<setting id="PreferKodiCollectionArt" label="30543" type="bool" default="true" visible="eq(-1,true) + eq(-3,true)" subsetting="true" /><!-- Prefer Kodi artwork for collections -->
|
||||||
<setting id="imageSyncNotifications" label="30008" type="bool" default="true" /><!-- Enable notifications for image caching -->
|
<setting label="39222" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=fanart)" option="close" visible="eq(-2,true) + eq(-4,true)" subsetting="true" /> <!-- Look for missing fanart on FanartTV now -->
|
||||||
<setting id="imageSyncDuringPlayback" label="30009" type="bool" default="true" /><!-- Enable image caching during Kodi playback (restart Kodi!) -->
|
<setting id="imageSyncNotifications" label="30008" type="bool" default="true" visible="eq(-5,true)"/><!-- Enable notifications for image caching -->
|
||||||
<setting label="39020" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=texturecache)" option="close" /> <!-- Cache all images to Kodi texture cache now -->
|
<setting id="imageSyncDuringPlayback" label="30009" type="bool" default="true" visible="eq(-6,true)"/><!-- Enable image caching during Kodi playback (restart Kodi!) -->
|
||||||
<setting type="lsep" label="$LOCALIZE[126]" /><!-- Status -->
|
<setting label="39020" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=texturecache)" option="close" visible="eq(-7,true)"/> <!-- Cache all images to Kodi texture cache now -->
|
||||||
<setting id="plex_status_fanarttv_lookup" label="30019" type="text" default="" enable="false" /><!-- FanartTV lookup completed -->
|
<setting type="lsep" label="$LOCALIZE[126]" visible="eq(-8,true)"/><!-- Status -->
|
||||||
<setting id="plex_status_image_caching" label="30028" type="text" default="" enable="false" /><!-- Image caching completed -->
|
<setting id="plex_status_fanarttv_lookup" label="30019" type="text" default="" enable="false" visible="eq(-9,true)"/><!-- FanartTV lookup completed -->
|
||||||
|
<setting id="plex_status_image_caching" label="30028" type="text" default="" enable="false" visible="eq(-10,true)"/><!-- Image caching completed -->
|
||||||
</category>
|
</category>
|
||||||
<!--
|
<!--
|
||||||
<category label="30235" visible="false">
|
<category label="30235" visible="false">
|
||||||
|
|
Loading…
Add table
Reference in a new issue