Skip to content

Commit

Permalink
Change emby to jellyfin in functions, variables etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
cvium committed Feb 2, 2019
1 parent 6476364 commit 2331928
Show file tree
Hide file tree
Showing 39 changed files with 273 additions and 278 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<website>https://jellyfin.media/</website>
<source>https://github.com/jellyfin/jellyfin-kodi</source>
<summary lang="en"></summary>
<description lang="en">Welcome to Jellyfin for Kodi A whole new way to manage and view your media library. The Jellyfin addon for Kodi combines the best of Kodi - ultra smooth navigation, beautiful UIs and playback of any file under the sun, and Jellyfin - the most powerful fully open source multi-client media metadata indexer and server.&#10;&#10;Jellyfin for Kodi is the absolute best way to enjoy the incredible Kodi playback engine combined with the power of Jellyfin's centralized database. Features: Direct integration with the Kodi library for native Kodi speed Instant synchronization with the Jellyfin server Full support for Movie, TV and Music collections Jellyfin Server direct stream and transcoding support - use Kodi when you are away from home!</description>
<description lang="en">Welcome to Jellyfin for Kodi!&#10;A whole new way to manage and view your media library. The Jellyfin addon for Kodi combines the best of Kodi - ultra smooth navigation, beautiful UIs and playback of any file under the sun, and Jellyfin - the most powerful fully open source multi-client media metadata indexer and server.&#10;&#10;Jellyfin for Kodi is the absolute best way to enjoy the incredible Kodi playback engine combined with the power of Jellyfin's centralized database. Features:&#10;* Direct integration with the Kodi library for native Kodi speed&#10;* Instant synchronization with the Jellyfin server&#10;* Full support for Movie, TV and Music collections&#10;* Jellyfin Server direct stream and transcoding support - use Kodi when you are away from home!</description>
<news>
Rebrand in progress
</news>
Expand Down
12 changes: 6 additions & 6 deletions resources/lib/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from database import get_credentials, save_credentials
from dialogs import ServerConnect, UsersConnect, LoginManual, ServerManual
from helper import _, settings, addon_id, event, api, dialog, window
from emby import Emby
from emby.core.connection_manager import get_server_address, CONNECTION_STATE
from emby.core.exceptions import HTTPException
from jellyfin import Jellyfin
from jellyfin.core.connection_manager import get_server_address, CONNECTION_STATE
from jellyfin.core.exceptions import HTTPException

##################################################################################################

Expand Down Expand Up @@ -65,7 +65,7 @@ def register(self, server_id=None, options={}):
save_credentials(credentials)

try:
Emby(server_id).start(True)
Jellyfin(server_id).start(True)
except ValueError as error:
LOG.error(error)

Expand All @@ -80,7 +80,7 @@ def get_client(self, server_id=None):

''' Get Jellyfin client.
'''
client = Emby(server_id)
client = Jellyfin(server_id)
client['config/app']("Kodi", self.info['Version'], self.info['DeviceName'], self.info['DeviceId'])
client['config']['http.user_agent'] = "Jellyfin-Kodi/%s" % self.info['Version']
client['config']['auth.ssl'] = self.get_ssl()
Expand Down Expand Up @@ -280,7 +280,7 @@ def remove_server(self, server_id):

''' Stop client and remove server.
'''
Emby(server_id).close()
Jellyfin(server_id).close()
credentials = get_credentials()

for server in credentials['Servers']:
Expand Down
26 changes: 13 additions & 13 deletions resources/lib/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import xbmc
import xbmcvfs

import emby_db
import jellyfin_db
from helper.utils import delete_folder
from helper import _, settings, window, dialog
from objects import obj
Expand Down Expand Up @@ -58,7 +58,7 @@ def __enter__(self):
if not window('jellyfin_db_check.bool') and self.db_file == 'jellyfin':

window('jellyfin_db_check.bool', True)
emby_tables(self.cursor)
jellyfin_tables(self.cursor)
self.conn.commit()

return self
Expand Down Expand Up @@ -183,7 +183,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
self.cursor.close()
self.conn.close()

def emby_tables(cursor):
def jellyfin_tables(cursor):

''' Create the tables for the jellyfin database.
jellyfin, view, version
Expand Down Expand Up @@ -231,7 +231,7 @@ def reset():
return

reset_kodi()
reset_emby()
reset_jellyfin()
views.delete_playlists()
views.delete_nodes()

Expand Down Expand Up @@ -280,20 +280,20 @@ def reset_kodi():

LOG.warn("[ reset kodi ]")

def reset_emby():
def reset_jellyfin():

with Database('jellyfin') as embydb:
embydb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'")
with Database('jellyfin') as jellyfindb:
jellyfindb.cursor.execute("SELECT tbl_name FROM sqlite_master WHERE type='table'")

for table in embydb.cursor.fetchall():
for table in jellyfindb.cursor.fetchall():
name = table[0]

if name not in ('version', 'view'):
embydb.cursor.execute("DELETE FROM " + name)
jellyfindb.cursor.execute("DELETE FROM " + name)

embydb.cursor.execute("DROP table IF EXISTS jellyfin")
embydb.cursor.execute("DROP table IF EXISTS view")
embydb.cursor.execute("DROP table IF EXISTS version")
jellyfindb.cursor.execute("DROP table IF EXISTS jellyfin")
jellyfindb.cursor.execute("DROP table IF EXISTS view")
jellyfindb.cursor.execute("DROP table IF EXISTS version")

LOG.warn("[ reset jellyfin ]")

Expand Down Expand Up @@ -396,7 +396,7 @@ def get_item(kodi_id, media):
''' Get jellyfin item based on kodi id and media.
'''
with Database('jellyfin') as jellyfindb:
item = emby_db.EmbyDatabase(embydb.cursor).get_full_item_by_kodi_id(kodi_id, media)
item = jellyfin_db.JellyfinDatabase(jellyfindb.cursor).get_full_item_by_kodi_id(kodi_id, media)

if not item:
LOG.debug("Not an jellyfin item")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
##################################################################################################


class EmbyDatabase():
class JellyfinDatabase():


def __init__(self, cursor):
Expand Down
1 change: 0 additions & 1 deletion resources/lib/dialogs/loginmanual.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def onInit(self):
def onClick(self, control):

if control == SIGN_IN:
# Sign in to emby connect
self._disable_error()

user = self.user_field.getText()
Expand Down
2 changes: 1 addition & 1 deletion resources/lib/dialogs/serverconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import xbmcgui

from helper import _
from emby.core.connection_manager import CONNECTION_STATE
from jellyfin.core.connection_manager import CONNECTION_STATE

##################################################################################################

Expand Down
3 changes: 1 addition & 2 deletions resources/lib/dialogs/servermanual.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import xbmcaddon

from helper import _, addon_id
from emby.core.connection_manager import CONNECTION_STATE
from jellyfin.core.connection_manager import CONNECTION_STATE

##################################################################################################

Expand Down Expand Up @@ -72,7 +72,6 @@ def onInit(self):
def onClick(self, control):

if control == CONNECT:
# Sign in to jellyfin connect
self._disable_error()

server = self.host_field.getText()
Expand Down
16 changes: 8 additions & 8 deletions resources/lib/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import requests
from helper.utils import should_stop, delete_folder
from helper import settings, stop, event, window, kodi_version, unzip, create_id
from emby import Emby
from emby.core import api
from emby.core.exceptions import HTTPException
from jellyfin import Jellyfin
from jellyfin.core import api
from jellyfin.core.exceptions import HTTPException

#################################################################################################

Expand All @@ -28,7 +28,7 @@

#################################################################################################

def get_embyserver_url(handler):
def get_jellyfinserver_url(handler):

if handler.startswith('/'):

Expand All @@ -46,16 +46,16 @@ def browse_info():
def _http(action, url, request={}, server_id=None):
request.update({'url': url, 'type': action})

return Emby(server_id)['http/request'](request)
return Jellyfin(server_id)['http/request'](request)

def _get(handler, params=None, server_id=None):
return _http("GET", get_embyserver_url(handler), {'params': params}, server_id)
return _http("GET", get_jellyfinserver_url(handler), {'params': params}, server_id)

def _post(handler, json=None, params=None, server_id=None):
return _http("POST", get_embyserver_url(handler), {'params': params, 'json': json}, server_id)
return _http("POST", get_jellyfinserver_url(handler), {'params': params, 'json': json}, server_id)

def _delete(handler, params=None, server_id=None):
return _http("DELETE", get_embyserver_url(handler), {'params': params}, server_id)
return _http("DELETE", get_jellyfinserver_url(handler), {'params': params}, server_id)

def validate_view(library_id, item_id):

Expand Down
4 changes: 2 additions & 2 deletions resources/lib/entrypoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import xbmcvfs

from helper import loghandler
from emby import Emby
from jellyfin import Jellyfin

#################################################################################################

Emby.set_loghandler(loghandler.LogHandler, logging.DEBUG)
Jellyfin.set_loghandler(loghandler.LogHandler, logging.DEBUG)
loghandler.reset()
loghandler.config()
LOG = logging.getLogger('JELLYFIN.entrypoint')
Expand Down
26 changes: 13 additions & 13 deletions resources/lib/entrypoint/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import xbmcaddon

import client
from database import reset, get_sync, Database, emby_db, get_credentials
from database import reset, get_sync, Database, jellyfin_db, get_credentials
from objects import Objects, Actions
from downloader import TheVoid
from helper import _, event, settings, window, dialog, api, JSONRPC
Expand Down Expand Up @@ -130,14 +130,14 @@ def listing():

''' Display all jellyfin nodes and dynamic entries when appropriate.
'''
total = int(window('Emby.nodes.total') or 0)
total = int(window('Jellyfin.nodes.total') or 0)
sync = get_sync()
whitelist = [x.replace('Mixed:', "") for x in sync['Whitelist']]
servers = get_credentials()['Servers'][1:]

for i in range(total):

window_prop = "Emby.nodes.%s" % i
window_prop = "Jellyfin.nodes.%s" % i
path = window('%s.index' % window_prop)

if not path:
Expand Down Expand Up @@ -543,12 +543,12 @@ def get_video_extras(item_id, path, server_id=None):
"""
def getVideoFiles(jellyfinId,jellyfinPath):
#returns the video files for the item as plugin listing, can be used for browsing the actual files or videoextras etc.
emby = embyserver.Read_EmbyServer()
if not embyId:
if "plugin.video.jellyfin" in embyPath:
embyId = embyPath.split("/")[-2]
if embyId:
item = emby.getItem(embyId)
jellyfin = jellyfinserver.Read_JellyfinServer()
if not jellyfinId:
if "plugin.video.jellyfin" in jellyfinPath:
jellyfinId = jellyfinPath.split("/")[-2]
if jellyfinId:
item = jellyfin.getItem(jellyfinId)
putils = playutils.PlayUtils(item)
if putils.isDirectPlay():
#only proceed if we can access the files directly. TODO: copy local on the fly if accessed outside
Expand All @@ -571,9 +571,9 @@ def get_next_episodes(item_id, limit):

''' Only for synced content.
'''
with Database('jellyfin') as embydb:
with Database('jellyfin') as jellyfindb:

db = emby_db.EmbyDatabase(embydb.cursor)
db = jellyfin_db.JellyfinDatabase(jellyfindb.cursor)
library = db.get_view_name(item_id)

if not library:
Expand Down Expand Up @@ -784,8 +784,8 @@ def get_themes():

return

with Database('jellyfin') as embydb:
all_views = emby_db.EmbyDatabase(embydb.cursor).get_views()
with Database('jellyfin') as jellyfindb:
all_views = jellyfin_db.JellyfinDatabase(jellyfindb.cursor).get_views()
views = [x[0] for x in all_views if x[2] in ('movies', 'tvshows', 'mixed')]


Expand Down
18 changes: 9 additions & 9 deletions resources/lib/entrypoint/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from views import Views, verify_kodi_defaults
from helper import _, window, settings, event, dialog, find, compare_version
from downloader import get_objects
from emby import Emby
from database import Database, emby_db, reset
from jellyfin import Jellyfin
from database import Database, jellyfin_db, reset

#################################################################################################

Expand Down Expand Up @@ -143,7 +143,7 @@ def start_default(self):
def stop_default(self):

window('jellyfin_online', clear=True)
Emby().close()
Jellyfin().close()

if self.library_thread is not None:

Expand All @@ -154,9 +154,9 @@ def check_version(self):

''' Check the database version to ensure we do not need to do a reset.
'''
with Database('jellyfin') as embydb:
with Database('jellyfin') as jellyfindb:

version = emby_db.EmbyDatabase(embydb.cursor).get_version()
version = jellyfin_db.JellyfinDatabase(jellyfindb.cursor).get_version()
LOG.info("---[ db/%s ]", version)

if version and compare_version(version, "3.1.0") < 0:
Expand Down Expand Up @@ -206,8 +206,8 @@ def check_update(self, forced=False):
LOG.info("--[ new objects/%s ]", objects.version)

try:
if compare_version(self.settings['addon_version'], objects.embyversion) < 0:
dialog("ok", heading="{jellyfin}", line1="%s %s" % (_(33160), objects.embyversion))
if compare_version(self.settings['addon_version'], objects.jellyfinversion) < 0:
dialog("ok", heading="{jellyfin}", line1="%s %s" % (_(33160), objects.jellyfinversion))
except Exception:
pass

Expand Down Expand Up @@ -386,7 +386,7 @@ def onNotification(self, sender, method, data):
self.library_thread.stop_client()
self.library_thread = None

Emby.close_all()
Jellyfin.close_all()
self.monitor.server = []
self.monitor.sleep = True

Expand Down Expand Up @@ -506,7 +506,7 @@ def shutdown(self):
for prop in properties:
window(prop, clear=True)

Emby.close_all()
Jellyfin.close_all()

if self.library_thread is not None:
self.library_thread.stop_client()
Expand Down
Loading

0 comments on commit 2331928

Please sign in to comment.