Adjust Kodi bookmarks DB entries to resemble Kodi entries
This commit is contained in:
parent
b62a7a1a1d
commit
eeeb3efb7e
1 changed files with 27 additions and 29 deletions
|
@ -807,16 +807,11 @@ class Kodidb_Functions():
|
||||||
Returns all Kodi idFile that have a resume point set (not unwatched
|
Returns all Kodi idFile that have a resume point set (not unwatched
|
||||||
ones or items that have already been completely watched)
|
ones or items that have already been completely watched)
|
||||||
"""
|
"""
|
||||||
cursor = self.cursor
|
query = '''
|
||||||
|
SELECT idFile
|
||||||
query = ' '.join((
|
FROM bookmark
|
||||||
"SELECT idFile",
|
'''
|
||||||
"FROM bookmark"
|
rows = self.cursor.execute(query)
|
||||||
))
|
|
||||||
try:
|
|
||||||
rows = cursor.execute(query)
|
|
||||||
except:
|
|
||||||
return []
|
|
||||||
ids = []
|
ids = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
ids.append(row[0])
|
ids.append(row[0])
|
||||||
|
@ -1010,37 +1005,40 @@ class Kodidb_Functions():
|
||||||
"""
|
"""
|
||||||
self.cursor.execute("DELETE FROM bookmark")
|
self.cursor.execute("DELETE FROM bookmark")
|
||||||
|
|
||||||
def addPlaystate(self, fileid, resume_seconds, total_seconds, playcount, dateplayed):
|
def addPlaystate(self, fileid, resume_seconds, total_seconds, playcount,
|
||||||
|
dateplayed):
|
||||||
# Delete existing resume point
|
# Delete existing resume point
|
||||||
query = ' '.join((
|
query = '''
|
||||||
|
DELETE FROM bookmark
|
||||||
"DELETE FROM bookmark",
|
WHERE idFile = ?
|
||||||
"WHERE idFile = ?"
|
'''
|
||||||
))
|
|
||||||
self.cursor.execute(query, (fileid,))
|
self.cursor.execute(query, (fileid,))
|
||||||
|
|
||||||
# Set watched count
|
# Set watched count
|
||||||
query = ' '.join((
|
query = '''
|
||||||
|
UPDATE files
|
||||||
"UPDATE files",
|
SET playCount = ?, lastPlayed = ?
|
||||||
"SET playCount = ?, lastPlayed = ?",
|
WHERE idFile = ?
|
||||||
"WHERE idFile = ?"
|
'''
|
||||||
))
|
|
||||||
self.cursor.execute(query, (playcount, dateplayed, fileid))
|
self.cursor.execute(query, (playcount, dateplayed, fileid))
|
||||||
|
|
||||||
# Set the resume bookmark
|
# Set the resume bookmark
|
||||||
if resume_seconds:
|
if resume_seconds:
|
||||||
self.cursor.execute("select coalesce(max(idBookmark),0) from bookmark")
|
self.cursor.execute(
|
||||||
bookmarkId = self.cursor.fetchone()[0] + 1
|
'select coalesce(max(idBookmark),0) from bookmark')
|
||||||
|
bookmark_id = self.cursor.fetchone()[0] + 1
|
||||||
query = '''
|
query = '''
|
||||||
INSERT INTO bookmark(
|
INSERT INTO bookmark(
|
||||||
idBookmark, idFile, timeInSeconds, totalTimeInSeconds,
|
idBookmark, idFile, timeInSeconds, totalTimeInSeconds,
|
||||||
thumbNailImage, player, playerState, type)
|
thumbNailImage, player, playerState, type)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
'''
|
'''
|
||||||
self.cursor.execute(query, (bookmarkId, fileid, resume_seconds,
|
self.cursor.execute(query, (bookmark_id,
|
||||||
total_seconds, None, "DVDPlayer",
|
fileid,
|
||||||
None, 1))
|
resume_seconds,
|
||||||
|
total_seconds,
|
||||||
|
'',
|
||||||
|
"VideoPlayer",
|
||||||
|
'',
|
||||||
|
1))
|
||||||
|
|
||||||
def addTags(self, kodiid, tags, mediatype):
|
def addTags(self, kodiid, tags, mediatype):
|
||||||
# First, delete any existing tags associated to the id
|
# First, delete any existing tags associated to the id
|
||||||
|
|
Loading…
Reference in a new issue