Change most string occurrences of Emby to Jellyfin (case sensitive)

This commit is contained in:
Claus Vium 2019-02-02 14:10:33 +01:00
parent 168bab2b01
commit 59c1dd42e3
79 changed files with 833 additions and 832 deletions

View file

@ -18,7 +18,7 @@ from objects import obj
#################################################################################################
LOG = logging.getLogger("EMBY."+__name__)
LOG = logging.getLogger("JELLYFIN."+__name__)
#################################################################################################
@ -26,7 +26,7 @@ LOG = logging.getLogger("EMBY."+__name__)
class Database(object):
''' This should be called like a context.
i.e. with Database('emby') as db:
i.e. with Database('jellyfin') as db:
db.cursor
db.conn.commit()
'''
@ -36,7 +36,7 @@ class Database(object):
def __init__(self, file=None, commit_close=True):
''' file: emby, texture, music, video, :memory: or path to file
''' file: jellyfin, texture, music, video, :memory: or path to file
'''
self.db_file = file or "video"
self.commit_close = commit_close
@ -50,14 +50,14 @@ class Database(object):
self.conn = sqlite3.connect(self.path, timeout=self.timeout)
self.cursor = self.conn.cursor()
if self.db_file in ('video', 'music', 'texture', 'emby'):
if self.db_file in ('video', 'music', 'texture', 'jellyfin'):
self.conn.execute("PRAGMA journal_mode=WAL") # to avoid writing conflict with kodi
LOG.debug("--->[ database: %s ] %s", self.db_file, id(self.conn))
if not window('emby_db_check.bool') and self.db_file == 'emby':
if not window('jellyfin_db_check.bool') and self.db_file == 'jellyfin':
window('emby_db_check.bool', True)
window('jellyfin_db_check.bool', True)
emby_tables(self.cursor)
self.conn.commit()
@ -185,45 +185,45 @@ class Database(object):
def emby_tables(cursor):
''' Create the tables for the emby database.
emby, view, version
''' Create the tables for the jellyfin database.
jellyfin, view, version
'''
cursor.execute(
"""CREATE TABLE IF NOT EXISTS emby(
emby_id TEXT UNIQUE, media_folder TEXT, emby_type TEXT, media_type TEXT,
"""CREATE TABLE IF NOT EXISTS jellyfin(
jellyfin_id TEXT UNIQUE, media_folder TEXT, jellyfin_type TEXT, media_type TEXT,
kodi_id INTEGER, kodi_fileid INTEGER, kodi_pathid INTEGER, parent_id INTEGER,
checksum INTEGER, emby_parent_id TEXT)""")
checksum INTEGER, jellyfin_parent_id TEXT)""")
cursor.execute(
"""CREATE TABLE IF NOT EXISTS view(
view_id TEXT UNIQUE, view_name TEXT, media_type TEXT)""")
cursor.execute("CREATE TABLE IF NOT EXISTS version(idVersion TEXT)")
columns = cursor.execute("SELECT * FROM emby")
if 'emby_parent_id' not in [description[0] for description in columns.description]:
columns = cursor.execute("SELECT * FROM jellyfin")
if 'jellyfin_parent_id' not in [description[0] for description in columns.description]:
LOG.info("Add missing column emby_parent_id")
cursor.execute("ALTER TABLE emby ADD COLUMN emby_parent_id 'TEXT'")
LOG.info("Add missing column jellyfin_parent_id")
cursor.execute("ALTER TABLE jellyfin ADD COLUMN jellyfin_parent_id 'TEXT'")
def reset():
''' Reset both the emby database and the kodi database.
''' Reset both the jellyfin database and the kodi database.
'''
from views import Views
views = Views()
if not dialog("yesno", heading="{emby}", line1=_(33074)):
if not dialog("yesno", heading="{jellyfin}", line1=_(33074)):
return
window('emby_should_stop.bool', True)
window('jellyfin_should_stop.bool', True)
count = 10
while window('emby_sync.bool'):
while window('jellyfin_sync.bool'):
LOG.info("Sync is running...")
count -= 1
if not count:
dialog("ok", heading="{emby}", line1=_(33085))
dialog("ok", heading="{jellyfin}", line1=_(33085))
return
@ -235,12 +235,12 @@ def reset():
views.delete_playlists()
views.delete_nodes()
if dialog("yesno", heading="{emby}", line1=_(33086)):
if dialog("yesno", heading="{jellyfin}", line1=_(33086)):
reset_artwork()
addon_data = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
if dialog("yesno", heading="{emby}", line1=_(33087)):
if dialog("yesno", heading="{jellyfin}", line1=_(33087)):
xbmcvfs.delete(os.path.join(addon_data, "settings.xml"))
xbmcvfs.delete(os.path.join(addon_data, "data.json"))
@ -253,7 +253,7 @@ def reset():
settings('MinimumSetup', "")
settings('MusicRescan.bool', False)
settings('SyncInstallRunDone.bool', False)
dialog("ok", heading="{emby}", line1=_(33088))
dialog("ok", heading="{jellyfin}", line1=_(33088))
xbmc.executebuiltin('RestartApp')
def reset_kodi():
@ -267,7 +267,7 @@ def reset_kodi():
if name != 'version':
videodb.cursor.execute("DELETE FROM " + name)
if settings('enableMusic.bool') or dialog("yesno", heading="{emby}", line1=_(33162)):
if settings('enableMusic.bool') or dialog("yesno", heading="{jellyfin}", line1=_(33162)):
with Database('music') as musicdb:
musicdb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'")
@ -282,7 +282,7 @@ def reset_kodi():
def reset_emby():
with Database('emby') as embydb:
with Database('jellyfin') as embydb:
embydb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'")
for table in embydb.cursor.fetchall():
@ -291,11 +291,11 @@ def reset_emby():
if name not in ('version', 'view'):
embydb.cursor.execute("DELETE FROM " + name)
embydb.cursor.execute("DROP table IF EXISTS emby")
embydb.cursor.execute("DROP table IF EXISTS jellyfin")
embydb.cursor.execute("DROP table IF EXISTS view")
embydb.cursor.execute("DROP table IF EXISTS version")
LOG.warn("[ reset emby ]")
LOG.warn("[ reset jellyfin ]")
def reset_artwork():
@ -382,7 +382,6 @@ def get_credentials():
return credentials
def save_credentials(credentials):
credentials = credentials or {}
path = xbmc.translatePath("special://profile/addon_data/plugin.video.jellyfin/").decode('utf-8')
@ -394,13 +393,13 @@ def save_credentials(credentials):
def get_item(kodi_id, media):
''' Get emby item based on kodi id and media.
''' Get jellyfin item based on kodi id and media.
'''
with Database('emby') as embydb:
with Database('jellyfin') as jellyfindb:
item = emby_db.EmbyDatabase(embydb.cursor).get_full_item_by_kodi_id(kodi_id, media)
if not item:
LOG.debug("Not an emby item")
LOG.debug("Not an jellyfin item")
return