Change artwork for music items
This commit is contained in:
parent
da7d871af8
commit
48f5d67d63
3 changed files with 21 additions and 38 deletions
|
@ -7,7 +7,7 @@ from .common import ItemBase
|
||||||
from ..plex_api import API
|
from ..plex_api import API
|
||||||
from ..plex_db import PlexDB
|
from ..plex_db import PlexDB
|
||||||
from ..kodi_db import KodiMusicDB
|
from ..kodi_db import KodiMusicDB
|
||||||
from .. import artwork, plex_functions as PF, utils, state, variables as v
|
from .. import plex_functions as PF, utils, state, variables as v
|
||||||
|
|
||||||
LOG = getLogger('PLEX.music')
|
LOG = getLogger('PLEX.music')
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class MusicMixin(object):
|
||||||
self.kodidb.delete_song_from_song_genre(kodi_id)
|
self.kodidb.delete_song_from_song_genre(kodi_id)
|
||||||
query = 'DELETE FROM albuminfosong WHERE idAlbumInfoSong = ?'
|
query = 'DELETE FROM albuminfosong WHERE idAlbumInfoSong = ?'
|
||||||
self.kodicursor.execute(query, (kodi_id, ))
|
self.kodicursor.execute(query, (kodi_id, ))
|
||||||
artwork.delete_artwork(kodi_id, v.KODI_TYPE_SONG, self.kodicursor)
|
self.kodidb.delete_artwork(kodi_id, v.KODI_TYPE_SONG)
|
||||||
|
|
||||||
def remove_album(self, kodi_id):
|
def remove_album(self, kodi_id):
|
||||||
'''
|
'''
|
||||||
|
@ -125,7 +125,7 @@ class MusicMixin(object):
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
self.kodicursor.execute('DELETE FROM album WHERE idAlbum = ?',
|
self.kodicursor.execute('DELETE FROM album WHERE idAlbum = ?',
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
artwork.delete_artwork(kodi_id, v.KODI_TYPE_ALBUM, self.kodicursor)
|
self.kodidb.delete_artwork(kodi_id, v.KODI_TYPE_ALBUM)
|
||||||
|
|
||||||
def remove_artist(self, kodi_id):
|
def remove_artist(self, kodi_id):
|
||||||
'''
|
'''
|
||||||
|
@ -139,7 +139,7 @@ class MusicMixin(object):
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
self.kodicursor.execute('DELETE FROM discography WHERE idArtist = ?',
|
self.kodicursor.execute('DELETE FROM discography WHERE idArtist = ?',
|
||||||
(kodi_id, ))
|
(kodi_id, ))
|
||||||
artwork.delete_artwork(kodi_id, v.KODI_TYPE_ARTIST, self.kodicursor)
|
self.kodidb.delete_artwork(kodi_id, v.KODI_TYPE_ARTIST)
|
||||||
|
|
||||||
|
|
||||||
class Artist(MusicMixin, ItemBase):
|
class Artist(MusicMixin, ItemBase):
|
||||||
|
@ -207,10 +207,9 @@ class Artist(MusicMixin, ItemBase):
|
||||||
utils.unix_date_to_kodi(self.last_sync),
|
utils.unix_date_to_kodi(self.last_sync),
|
||||||
kodi_id))
|
kodi_id))
|
||||||
# Update artwork
|
# Update artwork
|
||||||
artwork.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_ARTIST,
|
v.KODI_TYPE_ARTIST)
|
||||||
self.kodicursor)
|
|
||||||
self.plexdb.add_artist(plex_id,
|
self.plexdb.add_artist(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
@ -365,13 +364,11 @@ class Album(MusicMixin, ItemBase):
|
||||||
(artist_id, name, api.year()))
|
(artist_id, name, api.year()))
|
||||||
if v.KODIVERSION < 18:
|
if v.KODIVERSION < 18:
|
||||||
self.kodidb.add_music_genres(kodi_id,
|
self.kodidb.add_music_genres(kodi_id,
|
||||||
genres,
|
genres,
|
||||||
v.KODI_TYPE_ALBUM)
|
v.KODI_TYPE_ALBUM)
|
||||||
# Update artwork
|
self.kodidb.modify_artwork(artworks,
|
||||||
artwork.modify_artwork(artworks,
|
kodi_id,
|
||||||
kodi_id,
|
v.KODI_TYPE_ALBUM)
|
||||||
v.KODI_TYPE_ALBUM,
|
|
||||||
self.kodicursor)
|
|
||||||
self.plexdb.add_album(plex_id,
|
self.plexdb.add_album(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
@ -619,7 +616,7 @@ class Song(MusicMixin, ItemBase):
|
||||||
else:
|
else:
|
||||||
LOG.info("ADD song plex_id: %s - %s", plex_id, title)
|
LOG.info("ADD song plex_id: %s - %s", plex_id, title)
|
||||||
# Add path
|
# Add path
|
||||||
kodi_pathid = self.kodidb.add_music_path(path, hash_string="123")
|
kodi_pathid = self.kodidb.add_path(path, hash_string="123")
|
||||||
# Create the song entry
|
# Create the song entry
|
||||||
if v.KODIVERSION >= 18:
|
if v.KODIVERSION >= 18:
|
||||||
# Kodi Leia
|
# Kodi Leia
|
||||||
|
@ -736,17 +733,14 @@ class Song(MusicMixin, ItemBase):
|
||||||
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()
|
artworks = api.artwork()
|
||||||
artwork.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
kodi_id,
|
kodi_id,
|
||||||
v.KODI_TYPE_SONG,
|
v.KODI_TYPE_SONG)
|
||||||
self.kodicursor)
|
|
||||||
if xml.get('parentKey') is None:
|
if xml.get('parentKey') is None:
|
||||||
# Update album artwork
|
# Update album artwork
|
||||||
artwork.modify_artwork(artworks,
|
self.kodidb.modify_artwork(artworks,
|
||||||
parent_id,
|
parent_id,
|
||||||
v.KODI_TYPE_ALBUM,
|
v.KODI_TYPE_ALBUM)
|
||||||
self.kodicursor)
|
|
||||||
# Create the reference in plex table
|
|
||||||
self.plexdb.add_song(plex_id,
|
self.plexdb.add_song(plex_id,
|
||||||
api.checksum(),
|
api.checksum(),
|
||||||
section_id,
|
section_id,
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import absolute_import, division, unicode_literals
|
|
||||||
from logging import getLogger
|
|
||||||
|
|
||||||
from .video import KodiVideoDB
|
|
||||||
|
|
||||||
LOG = getLogger('PLEX.kodi_db.movies')
|
|
||||||
|
|
||||||
|
|
||||||
class KodiMovieDB(KodiVideoDB):
|
|
|
@ -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 utils, variables as v
|
from .. import utils
|
||||||
|
|
||||||
LOG = getLogger('PLEX.kodi_db.music')
|
LOG = getLogger('PLEX.kodi_db.music')
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
self.cursor = self.kodiconn.cursor()
|
self.cursor = self.kodiconn.cursor()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def add_music_path(self, path, hash_string=None):
|
def add_path(self, path, hash_string=None):
|
||||||
"""
|
"""
|
||||||
Add the path (unicode) to the music DB, if it does not exist already.
|
Add the path (unicode) to the music DB, if it does not exist already.
|
||||||
Returns the path id
|
Returns the path id
|
||||||
|
|
Loading…
Reference in a new issue