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()
|
||||||
self.artconn = utils.kodi_sql('texture')
|
if app.SYNC.artwork:
|
||||||
self.artcursor = self.artconn.cursor()
|
self.artconn = utils.kodi_sql('texture')
|
||||||
|
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,13 +82,15 @@ 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()
|
||||||
self.artconn.close()
|
if self.artconn:
|
||||||
|
self.artconn.close()
|
||||||
if self.lock:
|
if self.lock:
|
||||||
PLEXDB_LOCK.release()
|
PLEXDB_LOCK.release()
|
||||||
KODIDB_LOCK.release()
|
KODIDB_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,9 +110,10 @@ 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())
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_MOVIE)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_MOVIE)
|
||||||
else:
|
else:
|
||||||
LOG.info("ADD movie plex_id: %s - %s", plex_id, title)
|
LOG.info("ADD movie plex_id: %s - %s", plex_id, title)
|
||||||
file_id = self.kodidb.add_file(filename,
|
file_id = self.kodidb.add_file(filename,
|
||||||
|
@ -137,9 +138,10 @@ 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())
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_MOVIE)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_MOVIE)
|
||||||
|
|
||||||
# Update Kodi's main entry
|
# Update Kodi's main entry
|
||||||
self.kodidb.add_movie(kodi_id,
|
self.kodidb.add_movie(kodi_id,
|
||||||
|
@ -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,8 +24,9 @@ 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()
|
||||||
self.artconn = utils.kodi_sql('texture')
|
if app.SYNC.artwork:
|
||||||
self.artcursor = self.artconn.cursor()
|
self.artconn = utils.kodi_sql('texture')
|
||||||
|
self.artcursor = self.artconn.cursor()
|
||||||
self.plexdb = PlexDB(self.plexcursor)
|
self.plexdb = PlexDB(self.plexcursor)
|
||||||
self.kodidb = KodiMusicDB(texture_db=True,
|
self.kodidb = KodiMusicDB(texture_db=True,
|
||||||
cursor=self.kodicursor,
|
cursor=self.kodicursor,
|
||||||
|
@ -170,16 +171,18 @@ 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']
|
||||||
|
else:
|
||||||
|
thumb = None
|
||||||
|
if 'fanart' in artworks:
|
||||||
|
fanart = "<fanart>%s</fanart>" % artworks['fanart']
|
||||||
|
else:
|
||||||
|
fanart = None
|
||||||
else:
|
else:
|
||||||
thumb = None
|
thumb, fanart = None, None
|
||||||
if 'fanart' in artworks:
|
|
||||||
fanart = "<fanart>%s</fanart>" % artworks['fanart']
|
|
||||||
else:
|
|
||||||
fanart = None
|
|
||||||
|
|
||||||
# UPDATE THE ARTIST #####
|
# UPDATE THE ARTIST #####
|
||||||
if update_item:
|
if update_item:
|
||||||
|
@ -198,10 +201,10 @@ 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)
|
||||||
self.plexdb.add_artist(plex_id,
|
self.plexdb.add_artist(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
@ -265,10 +268,12 @@ 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:
|
||||||
|
thumb = None
|
||||||
else:
|
else:
|
||||||
thumb = None
|
thumb = None
|
||||||
|
|
||||||
|
@ -341,9 +346,10 @@ 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)
|
||||||
self.kodidb.modify_artwork(artworks,
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.modify_artwork(artworks,
|
||||||
v.KODI_TYPE_ALBUM)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_ALBUM)
|
||||||
self.plexdb.add_album(plex_id,
|
self.plexdb.add_album(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
@ -630,15 +636,16 @@ 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)
|
||||||
artworks = api.artwork()
|
if app.SYNC.artwork:
|
||||||
self.kodidb.modify_artwork(artworks,
|
artworks = api.artwork()
|
||||||
kodi_id,
|
|
||||||
v.KODI_TYPE_SONG)
|
|
||||||
if xml.get('parentKey') is None:
|
|
||||||
# Update album artwork
|
|
||||||
self.kodidb.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
parent_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_ALBUM)
|
v.KODI_TYPE_SONG)
|
||||||
|
if xml.get('parentKey') is None:
|
||||||
|
# Update album artwork
|
||||||
|
self.kodidb.modify_artwork(artworks,
|
||||||
|
parent_id,
|
||||||
|
v.KODI_TYPE_ALBUM)
|
||||||
self.plexdb.add_song(plex_id,
|
self.plexdb.add_song(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
|
|
@ -204,9 +204,10 @@ 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())
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_SHOW)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_SHOW)
|
||||||
# Update the tvshow entry
|
# Update the tvshow entry
|
||||||
self.kodidb.update_show(api.title(),
|
self.kodidb.update_show(api.title(),
|
||||||
api.plot(),
|
api.plot(),
|
||||||
|
@ -243,9 +244,10 @@ 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())
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_SHOW)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_SHOW)
|
||||||
# Create the tvshow entry
|
# Create the tvshow entry
|
||||||
self.kodidb.add_show(kodi_id,
|
self.kodidb.add_show(kodi_id,
|
||||||
api.title(),
|
api.title(),
|
||||||
|
@ -310,25 +312,28 @@ 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']
|
||||||
parent_artwork = api.artwork(kodi_id=parent_id,
|
if app.SYNC.artwork:
|
||||||
kodi_type=v.KODI_TYPE_SHOW)
|
parent_artwork = api.artwork(kodi_id=parent_id,
|
||||||
artwork = api.artwork()
|
kodi_type=v.KODI_TYPE_SHOW)
|
||||||
# Remove all artwork that is identical for the season's show
|
artwork = api.artwork()
|
||||||
for key in parent_artwork:
|
# Remove all artwork that is identical for the season's show
|
||||||
if key in artwork and artwork[key] == parent_artwork[key]:
|
for key in parent_artwork:
|
||||||
del artwork[key]
|
if key in artwork and artwork[key] == parent_artwork[key]:
|
||||||
|
del artwork[key]
|
||||||
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']
|
||||||
self.kodidb.modify_artwork(artwork,
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.modify_artwork(artwork,
|
||||||
v.KODI_TYPE_SEASON)
|
kodi_id,
|
||||||
|
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())
|
||||||
self.kodidb.add_artwork(artwork,
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.add_artwork(artwork,
|
||||||
v.KODI_TYPE_SEASON)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_SEASON)
|
||||||
self.plexdb.add_season(plex_id=plex_id,
|
self.plexdb.add_season(plex_id=plex_id,
|
||||||
checksum=api.checksum(),
|
checksum=api.checksum(),
|
||||||
section_id=section_id,
|
section_id=section_id,
|
||||||
|
@ -475,9 +480,10 @@ 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())
|
||||||
self.kodidb.modify_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.modify_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_EPISODE)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_EPISODE)
|
||||||
self.kodidb.update_episode(api.title(),
|
self.kodidb.update_episode(api.title(),
|
||||||
api.plot(),
|
api.plot(),
|
||||||
ratingid,
|
ratingid,
|
||||||
|
@ -537,9 +543,10 @@ 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())
|
||||||
self.kodidb.add_artwork(api.artwork(),
|
if app.SYNC.artwork:
|
||||||
kodi_id,
|
self.kodidb.add_artwork(api.artwork(),
|
||||||
v.KODI_TYPE_EPISODE)
|
kodi_id,
|
||||||
|
v.KODI_TYPE_EPISODE)
|
||||||
self.kodidb.add_episode(kodi_id,
|
self.kodidb.add_episode(kodi_id,
|
||||||
kodi_fileid,
|
kodi_fileid,
|
||||||
api.title(),
|
api.title(),
|
||||||
|
|
|
@ -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,81 +145,159 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
"""
|
"""
|
||||||
strReleaseType: 'album' or 'single'
|
strReleaseType: 'album' or 'single'
|
||||||
"""
|
"""
|
||||||
self.cursor.execute('''
|
if app.SYNC.artwork:
|
||||||
INSERT INTO album(
|
self.cursor.execute('''
|
||||||
idAlbum,
|
INSERT INTO album(
|
||||||
strAlbum,
|
idAlbum,
|
||||||
strMusicBrainzAlbumID,
|
strAlbum,
|
||||||
strArtists,
|
strMusicBrainzAlbumID,
|
||||||
strGenres,
|
strArtists,
|
||||||
iYear,
|
strGenres,
|
||||||
bCompilation,
|
iYear,
|
||||||
strReview,
|
bCompilation,
|
||||||
strImage,
|
strReview,
|
||||||
strLabel,
|
strImage,
|
||||||
iUserrating,
|
strLabel,
|
||||||
lastScraped,
|
iUserrating,
|
||||||
strReleaseType)
|
lastScraped,
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
strReleaseType)
|
||||||
''', (args))
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', (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):
|
||||||
self.cursor.execute('''
|
if app.SYNC.artwork:
|
||||||
UPDATE album
|
self.cursor.execute('''
|
||||||
SET strAlbum = ?,
|
UPDATE album
|
||||||
strMusicBrainzAlbumID = ?,
|
SET strAlbum = ?,
|
||||||
strArtists = ?,
|
strMusicBrainzAlbumID = ?,
|
||||||
strGenres = ?,
|
strArtists = ?,
|
||||||
iYear = ?,
|
strGenres = ?,
|
||||||
bCompilation = ?,
|
iYear = ?,
|
||||||
strReview = ?,
|
bCompilation = ?,
|
||||||
strImage = ?,
|
strReview = ?,
|
||||||
strLabel = ?,
|
strImage = ?,
|
||||||
iUserrating = ?,
|
strLabel = ?,
|
||||||
lastScraped = ?,
|
iUserrating = ?,
|
||||||
strReleaseType = ?
|
lastScraped = ?,
|
||||||
WHERE idAlbum = ?
|
strReleaseType = ?
|
||||||
''', (args))
|
WHERE idAlbum = ?
|
||||||
|
''', (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'
|
||||||
"""
|
"""
|
||||||
self.cursor.execute('''
|
if app.SYNC.artwork:
|
||||||
INSERT INTO album(
|
self.cursor.execute('''
|
||||||
idAlbum,
|
INSERT INTO album(
|
||||||
strAlbum,
|
idAlbum,
|
||||||
strMusicBrainzAlbumID,
|
strAlbum,
|
||||||
strArtistDisp,
|
strMusicBrainzAlbumID,
|
||||||
strGenres,
|
strArtistDisp,
|
||||||
iYear,
|
strGenres,
|
||||||
bCompilation,
|
iYear,
|
||||||
strReview,
|
bCompilation,
|
||||||
strImage,
|
strReview,
|
||||||
strLabel,
|
strImage,
|
||||||
iUserrating,
|
strLabel,
|
||||||
lastScraped,
|
iUserrating,
|
||||||
strReleaseType)
|
lastScraped,
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
strReleaseType)
|
||||||
''', (args))
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
''', (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):
|
||||||
self.cursor.execute('''
|
if app.SYNC.artwork:
|
||||||
UPDATE album
|
self.cursor.execute('''
|
||||||
SET strAlbum = ?,
|
UPDATE album
|
||||||
strMusicBrainzAlbumID = ?,
|
SET strAlbum = ?,
|
||||||
strArtistDisp = ?,
|
strMusicBrainzAlbumID = ?,
|
||||||
strGenres = ?,
|
strArtistDisp = ?,
|
||||||
iYear = ?,
|
strGenres = ?,
|
||||||
bCompilation = ?,
|
iYear = ?,
|
||||||
strReview = ?,
|
bCompilation = ?,
|
||||||
strImage = ?,
|
strReview = ?,
|
||||||
strLabel = ?,
|
strImage = ?,
|
||||||
iUserrating = ?,
|
strLabel = ?,
|
||||||
lastScraped = ?,
|
iUserrating = ?,
|
||||||
strReleaseType = ?
|
lastScraped = ?,
|
||||||
WHERE idAlbum = ?
|
strReleaseType = ?
|
||||||
''', (args))
|
WHERE idAlbum = ?
|
||||||
|
''', (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,15 +502,26 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
return artistid
|
return artistid
|
||||||
|
|
||||||
def update_artist(self, *args):
|
def update_artist(self, *args):
|
||||||
self.cursor.execute('''
|
if app.SYNC.artwork:
|
||||||
UPDATE artist
|
self.cursor.execute('''
|
||||||
SET strGenres = ?,
|
UPDATE artist
|
||||||
strBiography = ?,
|
SET strGenres = ?,
|
||||||
strImage = ?,
|
strBiography = ?,
|
||||||
strFanart = ?,
|
strImage = ?,
|
||||||
lastScraped = ?
|
strFanart = ?,
|
||||||
WHERE idArtist = ?
|
lastScraped = ?
|
||||||
''', (args))
|
WHERE idArtist = ?
|
||||||
|
''', (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…
Reference in a new issue