mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-07-28 01:07:31 +00:00
Change most string occurrences of Emby to Jellyfin (case sensitive)
This commit is contained in:
parent
168bab2b01
commit
59c1dd42e3
79 changed files with 833 additions and 832 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import queries as QU
|
|||
|
||||
##################################################################################################
|
||||
|
||||
LOG = logging.getLogger("EMBY."+__name__)
|
||||
LOG = logging.getLogger("JELLYFIN."+__name__)
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
get_item = """ SELECT kodi_id, kodi_fileid, kodi_pathid, parent_id, media_type,
|
||||
emby_type, media_folder, emby_parent_id
|
||||
FROM emby
|
||||
WHERE emby_id = ?
|
||||
jellyfin_type, media_folder, jellyfin_parent_id
|
||||
FROM jellyfin
|
||||
WHERE jellyfin_id = ?
|
||||
"""
|
||||
get_item_obj = [ "{Id}"
|
||||
]
|
||||
|
@ -10,20 +10,20 @@ get_item_series_obj = [ "{SeriesId}"
|
|||
]
|
||||
get_item_song_obj = [ "{SongAlbumId}"
|
||||
]
|
||||
get_item_id_by_parent = """ SELECT emby_id, kodi_id
|
||||
FROM emby
|
||||
get_item_id_by_parent = """ SELECT jellyfin_id, kodi_id
|
||||
FROM jellyfin
|
||||
WHERE parent_id = ?
|
||||
AND media_type = ?
|
||||
"""
|
||||
get_item_id_by_parent_boxset_obj = [ "{SetId}","movie"
|
||||
]
|
||||
get_item_by_parent = """ SELECT emby_id, kodi_id, kodi_fileid
|
||||
FROM emby
|
||||
get_item_by_parent = """ SELECT jellyfin_id, kodi_id, kodi_fileid
|
||||
FROM jellyfin
|
||||
WHERE parent_id = ?
|
||||
AND media_type = ?
|
||||
"""
|
||||
get_item_by_media_folder = """ SELECT emby_id, emby_type
|
||||
FROM emby
|
||||
get_item_by_media_folder = """ SELECT jellyfin_id, jellyfin_type
|
||||
FROM jellyfin
|
||||
WHERE media_folder = ?
|
||||
"""
|
||||
get_item_by_parent_movie_obj = [ "{KodiId}","movie"
|
||||
|
@ -39,31 +39,31 @@ get_item_by_parent_album_obj = [ "{ParentId}","album"
|
|||
get_item_by_parent_song_obj = [ "{ParentId}","song"
|
||||
]
|
||||
get_item_by_wild = """ SELECT kodi_id, media_type
|
||||
FROM emby
|
||||
WHERE emby_id LIKE ?
|
||||
FROM jellyfin
|
||||
WHERE jellyfin_id LIKE ?
|
||||
"""
|
||||
get_item_by_wild_obj = [ "{Id}"
|
||||
]
|
||||
get_item_by_kodi = """ SELECT emby_id, parent_id, media_folder, emby_type, checksum
|
||||
FROM emby
|
||||
get_item_by_kodi = """ SELECT jellyfin_id, parent_id, media_folder, jellyfin_type, checksum
|
||||
FROM jellyfin
|
||||
WHERE kodi_id = ?
|
||||
AND media_type = ?
|
||||
"""
|
||||
get_checksum = """ SELECT emby_id, checksum
|
||||
FROM emby
|
||||
WHERE emby_type = ?
|
||||
get_checksum = """ SELECT jellyfin_id, checksum
|
||||
FROM jellyfin
|
||||
WHERE jellyfin_type = ?
|
||||
"""
|
||||
get_view_name = """ SELECT view_name
|
||||
FROM view
|
||||
WHERE view_id = ?
|
||||
"""
|
||||
get_media_by_id = """ SELECT emby_type
|
||||
FROM emby
|
||||
WHERE emby_id = ?
|
||||
get_media_by_id = """ SELECT jellyfin_type
|
||||
FROM jellyfin
|
||||
WHERE jellyfin_id = ?
|
||||
"""
|
||||
get_media_by_parent_id = """ SELECT emby_id, emby_type, kodi_id, kodi_fileid
|
||||
FROM emby
|
||||
WHERE emby_parent_id = ?
|
||||
get_media_by_parent_id = """ SELECT jellyfin_id, jellyfin_type, kodi_id, kodi_fileid
|
||||
FROM jellyfin
|
||||
WHERE jellyfin_parent_id = ?
|
||||
"""
|
||||
get_view = """ SELECT view_name, media_type
|
||||
FROM view
|
||||
|
@ -76,8 +76,8 @@ get_views_by_media = """ SELECT *
|
|||
FROM view
|
||||
WHERE media_type = ?
|
||||
"""
|
||||
get_items_by_media = """ SELECT emby_id
|
||||
FROM emby
|
||||
get_items_by_media = """ SELECT jellyfin_id
|
||||
FROM jellyfin
|
||||
WHERE media_type = ?
|
||||
"""
|
||||
get_version = """ SELECT idVersion
|
||||
|
@ -86,36 +86,36 @@ get_version = """ SELECT idVersion
|
|||
|
||||
|
||||
|
||||
add_reference = """ INSERT OR REPLACE INTO emby(emby_id, kodi_id, kodi_fileid, kodi_pathid, emby_type,
|
||||
media_type, parent_id, checksum, media_folder, emby_parent_id)
|
||||
add_reference = """ INSERT OR REPLACE INTO jellyfin(jellyfin_id, kodi_id, kodi_fileid, kodi_pathid, jellyfin_type,
|
||||
media_type, parent_id, checksum, media_folder, jellyfin_parent_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"""
|
||||
add_reference_movie_obj = [ "{Id}","{MovieId}","{FileId}","{PathId}","Movie","movie", None,"{Checksum}","{LibraryId}",
|
||||
"{EmbyParentId}"
|
||||
"{JellyfinParentId}"
|
||||
]
|
||||
add_reference_boxset_obj = [ "{Id}","{SetId}",None,None,"BoxSet","set",None,"{Checksum}",None,None
|
||||
]
|
||||
add_reference_tvshow_obj = [ "{Id}","{ShowId}",None,"{PathId}","Series","tvshow",None,"{Checksum}","{LibraryId}",
|
||||
"{EmbyParentId}"
|
||||
"{JellyfinParentId}"
|
||||
]
|
||||
add_reference_season_obj = [ "{Id}","{SeasonId}",None,None,"Season","season","{ShowId}",None,None,None
|
||||
]
|
||||
add_reference_pool_obj = [ "{SeriesId}","{ShowId}",None,"{PathId}","Series","tvshow",None,"{Checksum}","{LibraryId}",None
|
||||
]
|
||||
add_reference_episode_obj = [ "{Id}","{EpisodeId}","{FileId}","{PathId}","Episode","episode","{SeasonId}","{Checksum}",
|
||||
None,"{EmbyParentId}"
|
||||
None,"{JellyfinParentId}"
|
||||
]
|
||||
add_reference_mvideo_obj = [ "{Id}","{MvideoId}","{FileId}","{PathId}","MusicVideo","musicvideo",None,"{Checksum}",
|
||||
"{LibraryId}","{EmbyParentId}"
|
||||
"{LibraryId}","{JellyfinParentId}"
|
||||
]
|
||||
add_reference_artist_obj = [ "{Id}","{ArtistId}",None,None,"{ArtistType}","artist",None,"{Checksum}","{LibraryId}",
|
||||
"{EmbyParentId}"
|
||||
"{JellyfinParentId}"
|
||||
]
|
||||
add_reference_album_obj = [ "{Id}","{AlbumId}",None,None,"MusicAlbum","album",None,"{Checksum}",None,"{EmbyParentId}"
|
||||
add_reference_album_obj = [ "{Id}","{AlbumId}",None,None,"MusicAlbum","album",None,"{Checksum}",None,"{JellyfinParentId}"
|
||||
]
|
||||
add_reference_song_obj = [ "{Id}","{SongId}",None,"{PathId}","Audio","song","{AlbumId}","{Checksum}",
|
||||
None,"{EmbyParentId}"
|
||||
]
|
||||
None,"{JellyfinParentId}"
|
||||
]
|
||||
add_view = """ INSERT OR REPLACE INTO view(view_id, view_name, media_type)
|
||||
VALUES (?, ?, ?)
|
||||
"""
|
||||
|
@ -124,15 +124,15 @@ add_version = """ INSERT OR REPLACE INTO version(idVersion)
|
|||
"""
|
||||
|
||||
|
||||
update_reference = """ UPDATE emby
|
||||
update_reference = """ UPDATE jellyfin
|
||||
SET checksum = ?
|
||||
WHERE emby_id = ?
|
||||
WHERE jellyfin_id = ?
|
||||
"""
|
||||
update_reference_obj = [ "{Checksum}", "{Id}"
|
||||
]
|
||||
update_parent = """ UPDATE emby
|
||||
update_parent = """ UPDATE jellyfin
|
||||
SET parent_id = ?
|
||||
WHERE emby_id = ?
|
||||
WHERE jellyfin_id = ?
|
||||
"""
|
||||
update_parent_movie_obj = [ "{SetId}","{Id}"
|
||||
]
|
||||
|
@ -142,12 +142,12 @@ update_parent_album_obj = [ "{ArtistId}","{AlbumId}"]
|
|||
|
||||
|
||||
|
||||
delete_item = """ DELETE FROM emby
|
||||
WHERE emby_id = ?
|
||||
delete_item = """ DELETE FROM jellyfin
|
||||
WHERE jellyfin_id = ?
|
||||
"""
|
||||
delete_item_obj = [ "{Id}"
|
||||
]
|
||||
delete_item_by_parent = """ DELETE FROM emby
|
||||
delete_item_by_parent = """ DELETE FROM jellyfin
|
||||
WHERE parent_id = ?
|
||||
AND media_type = ?
|
||||
"""
|
||||
|
@ -163,20 +163,20 @@ delete_item_by_parent_artist_obj = [ "{ParentId}","artist"
|
|||
]
|
||||
delete_item_by_parent_album_obj = [ "{KodiId}","album"
|
||||
]
|
||||
delete_item_by_kodi = """ DELETE FROM emby
|
||||
delete_item_by_kodi = """ DELETE FROM jellyfin
|
||||
WHERE kodi_id = ?
|
||||
AND media_type = ?
|
||||
"""
|
||||
delete_item_by_wild = """ DELETE FROM emby
|
||||
WHERE emby_id LIKE ?
|
||||
delete_item_by_wild = """ DELETE FROM jellyfin
|
||||
WHERE jellyfin_id LIKE ?
|
||||
"""
|
||||
delete_view = """ DELETE FROM view
|
||||
WHERE view_id = ?
|
||||
"""
|
||||
delete_parent_boxset_obj = [ None, "{Movie}"
|
||||
]
|
||||
delete_media_by_parent_id = """ DELETE FROM emby
|
||||
WHERE emby_parent_id = ?
|
||||
delete_media_by_parent_id = """ DELETE FROM jellyfin
|
||||
WHERE jellyfin_parent_id = ?
|
||||
"""
|
||||
delete_version = """ DELETE FROM version
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue