Merge branch 'hotfixes' into translations
This commit is contained in:
commit
0fd65b7ee6
5 changed files with 259 additions and 1000 deletions
File diff suppressed because it is too large
Load diff
|
@ -1290,7 +1290,20 @@ class Music(Items):
|
|||
checksum=checksum)
|
||||
|
||||
# Process the album info
|
||||
if v.KODIVERSION >= 17:
|
||||
if v.KODIVERSION >= 18:
|
||||
# Kodi Leia
|
||||
query = '''
|
||||
UPDATE album
|
||||
SET strArtistDisp = ?, iYear = ?, strGenres = ?, strReview = ?,
|
||||
strImage = ?, iUserrating = ?, lastScraped = ?,
|
||||
strReleaseType = ?, strLabel = ?, bCompilation = ?
|
||||
WHERE idAlbum = ?
|
||||
'''
|
||||
kodicursor.execute(query, (artistname, year, self.genre, bio,
|
||||
thumb, rating, lastScraped,
|
||||
v.KODI_TYPE_ALBUM, studio,
|
||||
self.compilation, albumid))
|
||||
elif v.KODIVERSION == 17:
|
||||
# Kodi Krypton
|
||||
query = '''
|
||||
UPDATE album
|
||||
|
@ -1316,30 +1329,6 @@ class Music(Items):
|
|||
thumb, rating, lastScraped,
|
||||
v.KODI_TYPE_ALBUM, studio,
|
||||
self.compilation, albumid))
|
||||
elif v.KODIVERSION == 15:
|
||||
# Kodi Isengard
|
||||
query = '''
|
||||
UPDATE album
|
||||
SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?,
|
||||
strImage = ?, iRating = ?, lastScraped = ?, dateAdded = ?,
|
||||
strReleaseType = ?, strLabel = ?
|
||||
WHERE idAlbum = ?
|
||||
'''
|
||||
kodicursor.execute(query, (artistname, year, self.genre, bio,
|
||||
thumb, rating, lastScraped, dateadded,
|
||||
v.KODI_TYPE_ALBUM, studio, albumid))
|
||||
else:
|
||||
# Kodi Helix
|
||||
query = '''
|
||||
UPDATE album
|
||||
SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?,
|
||||
strImage = ?, iRating = ?, lastScraped = ?, dateAdded = ?,
|
||||
strLabel = ?
|
||||
WHERE idAlbum = ?
|
||||
'''
|
||||
kodicursor.execute(query, (artistname, year, self.genre, bio,
|
||||
thumb, rating, lastScraped, dateadded,
|
||||
studio, albumid))
|
||||
|
||||
# Associate the parentid for plex reference
|
||||
parent_id = api.parent_plex_id()
|
||||
|
@ -1400,7 +1389,7 @@ class Music(Items):
|
|||
kodicursor.execute(query, (artistid, name, year))
|
||||
# Update plex reference with parentid
|
||||
plex_db.updateParentId(artist_id, albumid)
|
||||
# Add genres
|
||||
if v.KODIVERSION < 18:
|
||||
self.kodi_db.addMusicGenres(albumid, self.genres, v.KODI_TYPE_ALBUM)
|
||||
# Update artwork
|
||||
artwork.modify_artwork(artworks, albumid, v.KODI_TYPE_ALBUM, kodicursor)
|
||||
|
@ -1517,18 +1506,33 @@ class Music(Items):
|
|||
kodicursor.execute(query, (path, '123', pathid))
|
||||
|
||||
# Update the song entry
|
||||
if v.KODIVERSION >= 18:
|
||||
# Kodi Leia
|
||||
query = '''
|
||||
UPDATE song
|
||||
SET idAlbum = ?, strArtists = ?, strGenres = ?, strTitle = ?,
|
||||
iTrack = ?, iDuration = ?, iYear = ?, strFilename = ?,
|
||||
iTimesPlayed = ?, lastplayed = ?, rating = ?, comment = ?,
|
||||
mood = ?
|
||||
SET idAlbum = ?, strArtistDisp = ?, strGenres = ?,
|
||||
strTitle = ?, iTrack = ?, iDuration = ?, iYear = ?,
|
||||
strFilename = ?, iTimesPlayed = ?, lastplayed = ?,
|
||||
rating = ?, comment = ?, mood = ?
|
||||
WHERE idSong = ?
|
||||
'''
|
||||
kodicursor.execute(query, (albumid, artists, genre, title, track,
|
||||
duration, year, filename, playcount,
|
||||
dateplayed, rating, comment, mood,
|
||||
songid))
|
||||
kodicursor.execute(query, (albumid, artists, genre, title,
|
||||
track, duration, year, filename,
|
||||
playcount, dateplayed, rating,
|
||||
comment, mood, songid))
|
||||
else:
|
||||
query = '''
|
||||
UPDATE song
|
||||
SET idAlbum = ?, strArtists = ?, strGenres = ?,
|
||||
strTitle = ?, iTrack = ?, iDuration = ?, iYear = ?,
|
||||
strFilename = ?, iTimesPlayed = ?, lastplayed = ?,
|
||||
rating = ?, comment = ?, mood = ?
|
||||
WHERE idSong = ?
|
||||
'''
|
||||
kodicursor.execute(query, (albumid, artists, genre, title,
|
||||
track, duration, year, filename,
|
||||
playcount, dateplayed, rating,
|
||||
comment, mood, songid))
|
||||
|
||||
# Update the checksum in plex table
|
||||
plex_db.updateReference(itemid, checksum)
|
||||
|
@ -1615,18 +1619,33 @@ class Music(Items):
|
|||
dateadded))
|
||||
|
||||
# Create the song entry
|
||||
if v.KODIVERSION >= 18:
|
||||
# Kodi Leia
|
||||
query = '''
|
||||
INSERT INTO song(
|
||||
idSong, idAlbum, idPath, strArtists, strGenres, strTitle,
|
||||
iTrack, iDuration, iYear, strFileName,
|
||||
idSong, idAlbum, idPath, strArtistDisp, strGenres,
|
||||
strTitle, iTrack, iDuration, iYear, strFileName,
|
||||
strMusicBrainzTrackID, iTimesPlayed, lastplayed,
|
||||
rating, iStartOffset, iEndOffset, mood)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
kodicursor.execute(
|
||||
query, (songid, albumid, pathid, artists, genre, title, track,
|
||||
duration, year, filename, musicBrainzId, playcount,
|
||||
dateplayed, rating, 0, 0, mood))
|
||||
query, (songid, albumid, pathid, artists, genre, title,
|
||||
track, duration, year, filename, musicBrainzId,
|
||||
playcount, dateplayed, rating, 0, 0, mood))
|
||||
else:
|
||||
query = '''
|
||||
INSERT INTO song(
|
||||
idSong, idAlbum, idPath, strArtists, strGenres,
|
||||
strTitle, iTrack, iDuration, iYear, strFileName,
|
||||
strMusicBrainzTrackID, iTimesPlayed, lastplayed,
|
||||
rating, iStartOffset, iEndOffset, mood)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
kodicursor.execute(
|
||||
query, (songid, albumid, pathid, artists, genre, title,
|
||||
track, duration, year, filename, musicBrainzId,
|
||||
playcount, dateplayed, rating, 0, 0, mood))
|
||||
|
||||
# Create the reference in plex table
|
||||
plex_db.addReference(itemid,
|
||||
|
@ -1637,7 +1656,7 @@ class Music(Items):
|
|||
parent_id=albumid,
|
||||
checksum=checksum,
|
||||
view_id=viewid)
|
||||
|
||||
if v.KODIVERSION < 18:
|
||||
# Link song to album
|
||||
query = '''
|
||||
INSERT OR REPLACE INTO albuminfosong(
|
||||
|
@ -1645,7 +1664,6 @@ class Music(Items):
|
|||
VALUES (?, ?, ?, ?, ?)
|
||||
'''
|
||||
kodicursor.execute(query, (songid, albumid, track, title, duration))
|
||||
|
||||
# Link song to artists
|
||||
artist_loop = [{
|
||||
'Name': api.grandparent_title(),
|
||||
|
|
|
@ -869,28 +869,20 @@ class KodiDBMethods(object):
|
|||
return seasonid
|
||||
|
||||
def addArtist(self, name, musicbrainz):
|
||||
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idArtist, strArtist",
|
||||
"FROM artist",
|
||||
"WHERE strMusicBrainzArtistID = ?"
|
||||
))
|
||||
query = '''
|
||||
SELECT idArtist, strArtist
|
||||
FROM artist
|
||||
WHERE strMusicBrainzArtistID = ?
|
||||
'''
|
||||
self.cursor.execute(query, (musicbrainz,))
|
||||
try:
|
||||
result = self.cursor.fetchone()
|
||||
artistid = result[0]
|
||||
artistname = result[1]
|
||||
|
||||
except TypeError:
|
||||
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idArtist",
|
||||
"FROM artist",
|
||||
"WHERE strArtist = ?",
|
||||
"COLLATE NOCASE"
|
||||
))
|
||||
query = '''
|
||||
SELECT idArtist FROM artist WHERE strArtist = ? COLLATE NOCASE
|
||||
'''
|
||||
self.cursor.execute(query, (name,))
|
||||
try:
|
||||
artistid = self.cursor.fetchone()[0]
|
||||
|
@ -899,113 +891,87 @@ class KodiDBMethods(object):
|
|||
# [Missing Tag] strMusicBrainzArtistID: Artist Tag Missing
|
||||
if v.KODIVERSION >= 17:
|
||||
self.cursor.execute(
|
||||
"select coalesce(max(idArtist),1) from artist")
|
||||
"SELECT COALESCE(MAX(idArtist),1) FROM artist")
|
||||
else:
|
||||
self.cursor.execute(
|
||||
"select coalesce(max(idArtist),0) from artist")
|
||||
"SELECT COALESCE(MAX(idArtist),0) FROM artist")
|
||||
artistid = self.cursor.fetchone()[0] + 1
|
||||
query = (
|
||||
'''
|
||||
INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID)
|
||||
|
||||
query = '''
|
||||
INSERT INTO artist(idArtist, strArtist,
|
||||
strMusicBrainzArtistID)
|
||||
VALUES (?, ?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (artistid, name, musicbrainz))
|
||||
else:
|
||||
if artistname != name:
|
||||
query = "UPDATE artist SET strArtist = ? WHERE idArtist = ?"
|
||||
self.cursor.execute(query, (name, artistid,))
|
||||
|
||||
return artistid
|
||||
|
||||
def addAlbum(self, name, musicbrainz):
|
||||
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idAlbum",
|
||||
"FROM album",
|
||||
"WHERE strMusicBrainzAlbumID = ?"
|
||||
))
|
||||
query = 'SELECT idAlbum FROM album WHERE strMusicBrainzAlbumID = ?'
|
||||
self.cursor.execute(query, (musicbrainz,))
|
||||
try:
|
||||
albumid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
# Create the album
|
||||
self.cursor.execute("select coalesce(max(idAlbum),0) from album")
|
||||
self.cursor.execute('SELECT COALESCE(MAX(idAlbum),0) FROM album')
|
||||
albumid = self.cursor.fetchone()[0] + 1
|
||||
query = (
|
||||
'''
|
||||
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType)
|
||||
|
||||
query = '''
|
||||
INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID,
|
||||
strReleaseType)
|
||||
VALUES (?, ?, ?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (albumid, name, musicbrainz, "album"))
|
||||
self.cursor.execute(query, (albumid, name, musicbrainz, 'album'))
|
||||
return albumid
|
||||
|
||||
def addMusicGenres(self, kodiid, genres, mediatype):
|
||||
|
||||
if mediatype == "album":
|
||||
|
||||
# Delete current genres for clean slate
|
||||
query = ' '.join((
|
||||
|
||||
"DELETE FROM album_genre",
|
||||
"WHERE idAlbum = ?"
|
||||
))
|
||||
query = 'DELETE FROM album_genre WHERE idAlbum = ?'
|
||||
self.cursor.execute(query, (kodiid,))
|
||||
|
||||
for genre in genres:
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idGenre",
|
||||
"FROM genre",
|
||||
"WHERE strGenre = ?",
|
||||
"COLLATE NOCASE"
|
||||
))
|
||||
query = '''
|
||||
SELECT idGenre FROM genre WHERE strGenre = ? COLLATE NOCASE
|
||||
'''
|
||||
self.cursor.execute(query, (genre,))
|
||||
try:
|
||||
genreid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
# Create the genre
|
||||
self.cursor.execute("select coalesce(max(idGenre),0) from genre")
|
||||
query = 'SELECT COALESCE(MAX(idGenre),0) FROM genre'
|
||||
self.cursor.execute(query)
|
||||
genreid = self.cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO genre(idGenre, strGenre) values(?, ?)"
|
||||
query = 'INSERT INTO genre(idGenre, strGenre) VALUES(?, ?)'
|
||||
self.cursor.execute(query, (genreid, genre))
|
||||
|
||||
query = "INSERT OR REPLACE INTO album_genre(idGenre, idAlbum) values(?, ?)"
|
||||
query = '''
|
||||
INSERT OR REPLACE INTO album_genre(idGenre, idAlbum)
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (genreid, kodiid))
|
||||
|
||||
elif mediatype == "song":
|
||||
|
||||
# Delete current genres for clean slate
|
||||
query = ' '.join((
|
||||
|
||||
"DELETE FROM song_genre",
|
||||
"WHERE idSong = ?"
|
||||
))
|
||||
query = 'DELETE FROM song_genre WHERE idSong = ?'
|
||||
self.cursor.execute(query, (kodiid,))
|
||||
|
||||
for genre in genres:
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idGenre",
|
||||
"FROM genre",
|
||||
"WHERE strGenre = ?",
|
||||
"COLLATE NOCASE"
|
||||
))
|
||||
query = '''
|
||||
SELECT idGenre FROM genre WHERE strGenre = ?
|
||||
COLLATE NOCASE
|
||||
'''
|
||||
self.cursor.execute(query, (genre,))
|
||||
try:
|
||||
genreid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
# Create the genre
|
||||
self.cursor.execute("select coalesce(max(idGenre),0) from genre")
|
||||
query = 'SELECT COALESCE(MAX(idGenre),0) FROM genre'
|
||||
self.cursor.execute(query)
|
||||
genreid = self.cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO genre(idGenre, strGenre) values(?, ?)"
|
||||
query = 'INSERT INTO genre(idGenre, strGenre) values(?, ?)'
|
||||
self.cursor.execute(query, (genreid, genre))
|
||||
|
||||
query = "INSERT OR REPLACE INTO song_genre(idGenre, idSong) values(?, ?)"
|
||||
query = '''
|
||||
INSERT OR REPLACE INTO song_genre(idGenre, idSong)
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (genreid, kodiid))
|
||||
|
||||
# Krypton only stuff ##############################
|
||||
|
|
|
@ -85,7 +85,7 @@ _DB_VIDEO_VERSION = {
|
|||
15: 93, # Isengard
|
||||
16: 99, # Jarvis
|
||||
17: 107, # Krypton
|
||||
18: 108 # Leia
|
||||
18: 109 # Leia
|
||||
}
|
||||
DB_VIDEO_PATH = try_decode(xbmc.translatePath(
|
||||
"special://database/MyVideos%s.db" % _DB_VIDEO_VERSION[KODIVERSION]))
|
||||
|
@ -96,7 +96,7 @@ _DB_MUSIC_VERSION = {
|
|||
15: 52, # Isengard
|
||||
16: 56, # Jarvis
|
||||
17: 60, # Krypton
|
||||
18: 62 # Leia
|
||||
18: 70 # Leia
|
||||
}
|
||||
DB_MUSIC_PATH = try_decode(xbmc.translatePath(
|
||||
"special://database/MyMusic%s.db" % _DB_MUSIC_VERSION[KODIVERSION]))
|
||||
|
|
|
@ -74,11 +74,7 @@
|
|||
<setting id="useDirectPaths" type="enum" label="30511" values="Addon(Default)|Native(Direct paths)" default="0" visible="true"/> <!-- Playback mode -->
|
||||
|
||||
<setting id="streamMusic" type="bool" label="30510" default="false" visible="false" subsetting="true"/> <!-- Direct stream Music library -->
|
||||
<setting type="lsep" label="30523" visible="false"/> <!-- Music metadata options -->
|
||||
<setting id="enableImportSongRating" type="bool" label="30524" default="true" visible="false"/>
|
||||
<setting id="enableExportSongRating" type="bool" label="30525" default="false" visible="false" />
|
||||
<setting id="kodiplextimeoffset" type="number" label="Time difference in seconds (Koditime - Plextime)" default="0" visible="false" option="int" />
|
||||
<setting id="enableUpdateSongRating" type="bool" label="30526" default="false" visible="false" />
|
||||
<setting id="themoviedbAPIKey" type="text" default="19c90103adb9e98f2172c6a6a3d85dc4" visible="false"/>
|
||||
<setting id="FanArtTVAPIKey" type="text" default="639191cb0774661597f28a47e7e2bad5" visible="false"/>
|
||||
</category>
|
||||
|
@ -136,7 +132,6 @@
|
|||
<setting id="enableCoverArt" type="bool" label="30157" default="true" visible="false"/>
|
||||
<setting id="additionalUsers" type="text" label="30528" default="" visible="false"/>
|
||||
<setting type="lsep" label="30534" visible="false" />
|
||||
<setting id="restartMsg" type="bool" label="30530" default="false" visible="false" />
|
||||
<setting id="newContent" type="bool" label="30531" default="false" visible="false" />
|
||||
<setting id="newvideotime" type="number" label="30532" visible="false" default="5" option="int" subsetting="true" />
|
||||
<setting id="newmusictime" type="number" label="30533" visible="false" default="2" option="int" subsetting="true" />
|
||||
|
@ -161,7 +156,6 @@
|
|||
<setting id="startupDelay" type="number" label="30529" default="0" option="int" />
|
||||
<setting label="39018" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=repair)" option="close" /> <!-- Repair local database (force update all content) -->
|
||||
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect?mode=deviceid)" /><!-- Reset device id uuid -->
|
||||
<setting label="39021" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=thememedia)" option="close" visible="false" /> <!-- Sync Plex Theme Media to Kodi -->
|
||||
<setting type="lsep" label="39049" /><!-- Nothing works? Try a full reset -->
|
||||
<setting label="39019" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=reset)" option="close" /> <!-- Partial or full reset of Database and PKC -->
|
||||
</category>
|
||||
|
|
Loading…
Reference in a new issue