mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-17 05:36:12 +00:00
Resume revert
Instead of seeking to position, now using setProperty('StartOffset') to launch playback at the position we want.
This commit is contained in:
parent
4e7cbc56ba
commit
1cda4ac30e
2 changed files with 28 additions and 70 deletions
|
@ -252,39 +252,6 @@ class WriteKodiVideoDB():
|
|||
# To avoid negative bookmark
|
||||
resume = resume - jumpback
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
|
||||
# Create a dummy bookmark for homescreen - widgets
|
||||
if not self.directpath:
|
||||
plugindummy = "plugin://plugin.video.emby/"
|
||||
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?", (plugindummy,))
|
||||
try:
|
||||
pathid = cursor.fetchone()[0]
|
||||
except:
|
||||
# Top level path does not exist yet
|
||||
cursor.execute("select coalesce(max(idPath),0) as tlpathid from path")
|
||||
pathid = cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (pathid, plugindummy, "tvshows", "metadata.local", 1))
|
||||
|
||||
# Validate the file in database
|
||||
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?", (filename, pathid,))
|
||||
try:
|
||||
fileid = cursor.fetchone()[0]
|
||||
except:
|
||||
# File does not exist yet
|
||||
if resume:
|
||||
cursor.execute("select coalesce(max(idFile),0) as fileid from files")
|
||||
fileid = cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (fileid, pathid, filename, playcount, dateplayed, dateadded))
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
else: # File exists
|
||||
if not resume:
|
||||
cursor.execute("DELETE FROM files WHERE idFile = ?", (fileid,))
|
||||
else:
|
||||
query = "UPDATE files SET playCount = ?, lastPlayed = ? WHERE idFile = ?"
|
||||
cursor.execute(query, (playcount, dateplayed, fileid))
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
|
||||
def addOrUpdateMusicVideoToKodiLibrary(self, embyId ,connection, cursor):
|
||||
|
||||
|
@ -700,40 +667,6 @@ class WriteKodiVideoDB():
|
|||
resume = resume - jumpback
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
|
||||
if not self.directpath:
|
||||
# Create a dummy bookmark for homescreen - widgets
|
||||
plugindummy = "plugin://plugin.video.emby/"
|
||||
cursor.execute("SELECT idPath as pathid FROM path WHERE strPath = ?", (plugindummy,))
|
||||
try:
|
||||
pathid = cursor.fetchone()[0]
|
||||
except:
|
||||
# Top level path does not exist yet
|
||||
cursor.execute("select coalesce(max(idPath),0) as tlpathid from path")
|
||||
pathid = cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO path(idPath, strPath, strContent, strScraper, noUpdate) values(?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (pathid, plugindummy, "tvshows", "metadata.local", 1))
|
||||
|
||||
# Validate the file in database
|
||||
cursor.execute("SELECT idFile as fileid FROM files WHERE strFilename = ? and idPath = ?", (filename, pathid,))
|
||||
try:
|
||||
fileid = cursor.fetchone()[0]
|
||||
except:
|
||||
# File does not exist yet
|
||||
if resume:
|
||||
cursor.execute("select coalesce(max(idFile),0) as fileid from files")
|
||||
fileid = cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO files(idFile, idPath, strFilename, playCount, lastPlayed, dateAdded) values(?, ?, ?, ?, ?, ?)"
|
||||
cursor.execute(query, (fileid, pathid, filename, playcount, dateplayed, dateadded))
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
else: # File exists
|
||||
if not resume:
|
||||
cursor.execute("DELETE FROM files WHERE idFile = ?", (fileid,))
|
||||
else:
|
||||
query = "UPDATE files SET playCount = ?, lastPlayed = ? WHERE idFile = ?"
|
||||
cursor.execute(query, (playcount, dateplayed, fileid))
|
||||
self.setKodiResumePoint(fileid, resume, total, cursor)
|
||||
|
||||
|
||||
def deleteItemFromKodiLibrary(self, id, connection, cursor ):
|
||||
|
||||
cursor.execute("SELECT kodi_id, media_type FROM emby WHERE emby_id = ?", (id,))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue