Got it to run, renamed some template stuff

Now onto the Jellyfin API, yay!
This commit is contained in:
2021-02-05 19:32:27 +01:00
parent ecbf38c005
commit cbee080b54
34 changed files with 80 additions and 76 deletions

View File

@@ -31,7 +31,7 @@ from jellypy import datatables
from jellypy import helpers
from jellypy import logger
from jellypy import users
from jellypy.plex import Plex
from jellypy.jellyfin import Jellyfin
class Export(object):
@@ -1524,7 +1524,7 @@ class Export(object):
else:
plex_token = jellypy.CONFIG.PMS_TOKEN
plex = Plex(jellypy.CONFIG.PMS_URL, plex_token)
jf = Jellyfin(jellypy.CONFIG.PMS_URL, plex_token)
if self.rating_key:
logger.debug(
@@ -1534,7 +1534,7 @@ class Export(object):
self.rating_key, self.metadata_level, self.media_info_level,
self.thumb_level, self.art_level, self.file_format)
self.obj = plex.get_item(self.rating_key)
self.obj = jf.get_item(self.rating_key)
self.media_type = self._media_type(self.obj)
if self.media_type != 'playlist':
@@ -1553,7 +1553,7 @@ class Export(object):
self.user_id, self.metadata_level, self.media_info_level,
self.thumb_level, self.art_level, self.export_type, self.file_format)
self.obj = plex.plex
self.obj = jf.plex
self.media_type = self.export_type
self.obj_title = user_info['username']
@@ -1566,7 +1566,7 @@ class Export(object):
self.section_id, self.metadata_level, self.media_info_level,
self.thumb_level, self.art_level, self.export_type, self.file_format)
self.obj = plex.get_library(str(self.section_id))
self.obj = jf.get_library(str(self.section_id))
if self.export_type == 'all':
self.media_type = self.obj.type
else:

View File

@@ -15,18 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
from plexapi.server import PlexServer
from jellyfin_apiclient_python import JellyfinClient
class Plex(object):
class Jellyfin(object):
def __init__(self, url, token):
self.plex = PlexServer(url, token)
self.jf = JellyfinClient()
def get_library(self, section_id):
return self.plex.library.sectionByID(str(section_id))
return self.jf.library.sectionByID(str(section_id))
def get_library_items(self, section_id):
return self.get_library(str(section_id)).all()
def get_item(self, rating_key):
return self.plex.fetchItem(rating_key)
return self.jf.fetchItem(rating_key)

View File

@@ -29,7 +29,7 @@ from jellypy import plextv
from jellypy import pmsconnect
from jellypy import session
from jellypy import users
from jellypy.plex import Plex
from jellypy.jellyfin import Jellyfin
def refresh_libraries():
@@ -132,8 +132,8 @@ def has_library_type(section_type):
def get_collections(section_id=None):
plex = Plex(jellypy.CONFIG.PMS_URL, session.get_session_user_token())
library = plex.get_library(section_id)
jf = Jellyfin(jellypy.CONFIG.PMS_URL, session.get_session_user_token())
library = jf.get_library(section_id)
if library.type not in ('movie', 'show', 'artist'):
return []
@@ -230,12 +230,12 @@ def get_playlists(section_id=None, user_id=None):
if not plex_token:
return []
plex = Plex(jellypy.CONFIG.PMS_URL, plex_token)
jf = Jellyfin(jellypy.CONFIG.PMS_URL, plex_token)
if user_id:
playlists = plex.plex.playlists()
playlists = jf.plex.playlists()
else:
library = plex.get_library(section_id)
library = jf.get_library(section_id)
playlists = library.playlist()
playlists_list = []