Fix music items getting deleted on startup
This commit is contained in:
parent
1dbeb95e24
commit
8f8ccd1daf
3 changed files with 17 additions and 6 deletions
|
@ -52,12 +52,9 @@ class MusicMixin(object):
|
||||||
db_item['kodi_type'],
|
db_item['kodi_type'],
|
||||||
userdata['UserRating'])
|
userdata['UserRating'])
|
||||||
if plex_type == v.PLEX_TYPE_SONG:
|
if plex_type == v.PLEX_TYPE_SONG:
|
||||||
self.kodidb.set_resume(db_item['kodi_fileid'],
|
self.kodidb.set_playcount(userdata['PlayCount'],
|
||||||
userdata['Resume'],
|
|
||||||
userdata['Runtime'],
|
|
||||||
userdata['PlayCount'],
|
|
||||||
userdata['LastPlayedDate'],
|
userdata['LastPlayedDate'],
|
||||||
plex_type)
|
db_item['kodi_id'],)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def remove(self, plex_id, plex_type=None):
|
def remove(self, plex_id, plex_type=None):
|
||||||
|
|
|
@ -459,6 +459,15 @@ class KodiMusicDB(common.KodiDBBase):
|
||||||
WHERE idSong = ?
|
WHERE idSong = ?
|
||||||
''', (args))
|
''', (args))
|
||||||
|
|
||||||
|
@common.catch_operationalerrors
|
||||||
|
def set_playcount(self, *args):
|
||||||
|
self.cursor.execute('''
|
||||||
|
UPDATE song
|
||||||
|
SET iTimesPlayed = ?,
|
||||||
|
lastplayed = ?
|
||||||
|
WHERE idSong = ?
|
||||||
|
''', (args))
|
||||||
|
|
||||||
@common.catch_operationalerrors
|
@common.catch_operationalerrors
|
||||||
def update_song_17(self, *args):
|
def update_song_17(self, *args):
|
||||||
self.cursor.execute('''
|
self.cursor.execute('''
|
||||||
|
|
|
@ -323,6 +323,11 @@ class FullSync(common.fullsync_mixin):
|
||||||
if self.successful:
|
if self.successful:
|
||||||
# Set timestamp for next sync - neglecting playstates!
|
# Set timestamp for next sync - neglecting playstates!
|
||||||
utils.settings('lastfullsync', value=str(int(self.current_sync)))
|
utils.settings('lastfullsync', value=str(int(self.current_sync)))
|
||||||
|
# In order to not delete all your songs again
|
||||||
|
if app.SYNC.enable_music:
|
||||||
|
kinds.extend([
|
||||||
|
(v.PLEX_TYPE_SONG, v.PLEX_TYPE_ARTIST, itemtypes.Song, True),
|
||||||
|
])
|
||||||
# SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that
|
# SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that
|
||||||
# were set to unwatched). Also mark all items on the PMS to be able
|
# were set to unwatched). Also mark all items on the PMS to be able
|
||||||
# to delete the ones still in Kodi
|
# to delete the ones still in Kodi
|
||||||
|
|
Loading…
Reference in a new issue