added playcount to the sync

This commit is contained in:
Marcel van der Veldt 2015-05-02 14:02:31 +02:00
parent fc2f158ad0
commit 6e9983edba

View file

@ -112,7 +112,7 @@ class WriteKodiDB():
else: else:
dateadded = None dateadded = None
playcount = None playcount = 0
if userData.get("PlayCount") == "1": if userData.get("PlayCount") == "1":
playcount = 1 playcount = 1
@ -144,7 +144,9 @@ class WriteKodiDB():
fileid = fileid + 1 fileid = fileid + 1
pathsql="insert into files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)" pathsql="insert into files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)"
cursor.execute(pathsql, (fileid,pathid,filename,playcount,userData.get("LastPlayedDate"),dateadded)) cursor.execute(pathsql, (fileid,pathid,filename,playcount,userData.get("LastPlayedDate"),dateadded))
else:
pathsql="update files SET playCount = ?, lastPlayed = ? WHERE idFile = ?"
cursor.execute(pathsql, (playcount,userData.get("LastPlayedDate"), fileid))
##### ADD THE MOVIE ############ ##### ADD THE MOVIE ############
if movieid == None: if movieid == None:
@ -487,6 +489,9 @@ class WriteKodiDB():
fileid = fileid + 1 fileid = fileid + 1
sql="INSERT OR REPLACE into files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)" sql="INSERT OR REPLACE into files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)"
cursor.execute(sql, (fileid,pathid,filename,playcount,lastplayed,dateadded)) cursor.execute(sql, (fileid,pathid,filename,playcount,lastplayed,dateadded))
else:
pathsql="update files SET playCount = ?, lastPlayed = ? WHERE idFile = ?"
cursor.execute(pathsql, (playcount,userData.get("LastPlayedDate"), fileid))
# safety check: check season first # safety check: check season first
season = 0 season = 0