mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-22 08:00:31 +00:00
Code reduction (#68)
Reduce code and move kodi database functions to their own files. Fix videonodes - delete view
This commit is contained in:
parent
58e29e6e41
commit
0261cbb98a
14 changed files with 1906 additions and 1642 deletions
66
resources/lib/objects/_kodi_musicvideos.py
Normal file
66
resources/lib/objects/_kodi_musicvideos.py
Normal file
|
@ -0,0 +1,66 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
##################################################################################################
|
||||
|
||||
import logging
|
||||
|
||||
from _kodi_common import KodiItems
|
||||
|
||||
##################################################################################################
|
||||
|
||||
log = logging.getLogger("EMBY."+__name__)
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
||||
class KodiMusicVideos(KodiItems):
|
||||
|
||||
|
||||
def __init__(self, cursor):
|
||||
self.cursor = cursor
|
||||
|
||||
KodiItems.__init__(self)
|
||||
|
||||
def create_entry(self):
|
||||
self.cursor.execute("select coalesce(max(idMVideo),0) from musicvideo")
|
||||
kodi_id = self.cursor.fetchone()[0] + 1
|
||||
|
||||
return kodi_id
|
||||
|
||||
def get_musicvideo(self, kodi_id):
|
||||
|
||||
query = "SELECT * FROM musicvideo WHERE idMVideo = ?"
|
||||
self.cursor.execute(query, (kodi_id,))
|
||||
try:
|
||||
kodi_id = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
kodi_id = None
|
||||
|
||||
return kodi_id
|
||||
|
||||
def add_musicvideo(self, *args):
|
||||
|
||||
query = (
|
||||
'''
|
||||
INSERT INTO musicvideo(
|
||||
idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10, c11, c12)
|
||||
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (args))
|
||||
|
||||
def update_musicvideo(self, *args):
|
||||
|
||||
query = ' '.join((
|
||||
|
||||
"UPDATE musicvideo",
|
||||
"SET c00 = ?, c04 = ?, c05 = ?, c06 = ?, c07 = ?, c08 = ?, c09 = ?, c10 = ?,",
|
||||
"c11 = ?, c12 = ?"
|
||||
"WHERE idMVideo = ?"
|
||||
))
|
||||
self.cursor.execute(query, (args))
|
||||
|
||||
def remove_musicvideo(self, kodi_id, file_id):
|
||||
self.cursor.execute("DELETE FROM musicvideo WHERE idMVideo = ?", (kodi_id,))
|
||||
self.cursor.execute("DELETE FROM files WHERE idFile = ?", (file_id,))
|
Loading…
Add table
Add a link
Reference in a new issue