mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
use new DatabaseCon context object for play websocket play actions
This commit is contained in:
parent
d3ce04ab10
commit
b3214a9250
2 changed files with 53 additions and 51 deletions
|
@ -129,6 +129,7 @@ class DatabaseConn(object):
|
|||
if self.db_file == "video":
|
||||
kodi_commit()
|
||||
self.conn.commit()
|
||||
log.info("commit: %s", self.path)
|
||||
|
||||
log.info("close: %s", self.path)
|
||||
self.conn.close()
|
||||
|
|
|
@ -12,6 +12,8 @@ import playbackutils
|
|||
import embydb_functions as embydb
|
||||
import read_embyserver as embyserver
|
||||
from utils import window, kodiSQL, JSONRPC
|
||||
from database import DatabaseConn
|
||||
from contextlib import closing
|
||||
|
||||
#################################################################################################
|
||||
|
||||
|
@ -29,8 +31,8 @@ class Playlist(object):
|
|||
|
||||
def play_all(self, item_ids, start_at):
|
||||
|
||||
conn = kodiSQL('emby')
|
||||
cursor = conn.cursor()
|
||||
with DatabaseConn('emby') as conn:
|
||||
with closing(conn.cursor()) as cursor:
|
||||
emby_db = embydb.Embydb_Functions(cursor)
|
||||
|
||||
player = xbmc.Player()
|
||||
|
@ -69,12 +71,11 @@ class Playlist(object):
|
|||
player.play(playlist)
|
||||
|
||||
self.verify_playlist()
|
||||
cursor.close()
|
||||
|
||||
def modify_playlist(self, item_ids):
|
||||
|
||||
conn = kodiSQL('emby')
|
||||
cursor = conn.cursor()
|
||||
with DatabaseConn('emby') as conn:
|
||||
with closing(conn.cursor()) as cursor:
|
||||
emby_db = embydb.Embydb_Functions(cursor)
|
||||
|
||||
log.info("---*** ADD TO PLAYLIST ***---")
|
||||
|
@ -99,7 +100,7 @@ class Playlist(object):
|
|||
self.add_to_playlist(db_id, media_type)
|
||||
|
||||
self.verify_playlist()
|
||||
cursor.close()
|
||||
|
||||
return playlist
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue