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

4
.gitignore vendored
View File

@@ -273,3 +273,7 @@ $RECYCLE.BIN/
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/pycharm+all,python,linux,windows
/config.ini
/release.lock
/tautulli.db
/version.lock

View File

@@ -1,8 +1,8 @@
<%
import plexpy
from plexpy import version
from plexpy.helpers import anon_url
from plexpy.notifiers import BROWSER_NOTIFIERS
import jellypy
from jellypy import version
from jellypy.helpers import anon_url
from jellypy.notifiers import BROWSER_NOTIFIERS
%>
<!doctype html>

View File

@@ -13,8 +13,8 @@ DOCUMENTATION :: END
import os
import sys
import plexpy
from plexpy import common, logger
from plexpy.helpers import anon_url
from jellypy import common, logger
from jellypy.helpers import anon_url
%>
<table class="config-info-table small-muted">

View File

@@ -27,7 +27,7 @@ DOCUMENTATION :: END
</%doc>
<%!
from plexpy import helpers
from jellypy import helpers
%>
% if data != None:

View File

@@ -27,7 +27,7 @@ DOCUMENTATION :: END
</%doc>
<%!
from plexpy import helpers
from jellypy import helpers
%>
% if data != None:

View File

@@ -14,9 +14,9 @@ data :: Usable parameters
DOCUMENTATION :: END
</%doc>
<%
import plexpy
from plexpy import exporter
from plexpy.helpers import anon_url
import jellypy
from jellypy import exporter
from jellypy.helpers import anon_url
export = exporter.Export()
thumb_media_types = ', '.join([export.PLURAL_MEDIA_TYPES[k] for k, v in export.MEDIA_TYPES.items() if v[0]])
art_media_types = ', '.join([export.PLURAL_MEDIA_TYPES[k] for k, v in export.MEDIA_TYPES.items() if v[1]])

View File

@@ -5,7 +5,7 @@
</%def>
<%def name="body()">
<% from plexpy import PLEX_SERVER_UP %>
<% from jellypy import PLEX_SERVER_UP %>
<div class="container-fluid">
% for section in config['home_sections']:
% if section == 'current_activity':

View File

@@ -39,9 +39,9 @@ DOCUMENTATION :: END
from collections import defaultdict
import re
from plexpy import notifiers
from plexpy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO
from plexpy.helpers import page, get_percent, cast_to_int
from jellypy import notifiers
from jellypy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO
from jellypy.helpers import page, get_percent, cast_to_int
# Get audio codec file
def af(codec):

View File

@@ -28,7 +28,7 @@ DOCUMENTATION :: END
% if data != None:
<%
from plexpy.helpers import cast_to_int, page
from jellypy.helpers import cast_to_int, page
%>
% if data['children_count'] > 0:
<div class="item-children-wrapper">

View File

@@ -28,8 +28,8 @@ DOCUMENTATION :: END
% if data != None:
<%
from plexpy.common import MEDIA_TYPE_HEADERS
from plexpy.helpers import page
from jellypy.common import MEDIA_TYPE_HEADERS
from jellypy.helpers import page
types = ('movie', 'show', 'artist', 'album')
%>
% for media_type in types:

View File

@@ -54,7 +54,7 @@ DOCUMENTATION :: END
% if data != None:
<%
from plexpy.helpers import page
from jellypy.helpers import page
%>
% if data['results_count'] > 0:
% if 'collection' in data['results_list'] and data['results_list']['collection']:

View File

@@ -36,8 +36,8 @@ DOCUMENTATION :: END
<%def name="body()">
% if data:
<%
from plexpy.common import LIVE_TV_SECTION_ID
from plexpy.helpers import page
from jellypy.common import LIVE_TV_SECTION_ID
from jellypy.helpers import page
%>
<div class="container-fluid">
<div class="row">

View File

@@ -32,7 +32,7 @@ DOCUMENTATION :: END
% if data:
<%
from plexpy.helpers import page
from jellypy.helpers import page
%>
<div class="dashboard-recent-media-row">
<div id="recently-added-row-scroller" style="left: 0;">

View File

@@ -25,7 +25,7 @@ DOCUMENTATION :: END
% if data:
<%
from plexpy.helpers import page
from jellypy.helpers import page
types = ('movie', 'show', 'artist', 'photo')
headers = {'movie': ('Movie Libraries', ('Movies', '', '')),

View File

@@ -19,7 +19,7 @@ DOCUMENTATION :: END
</%doc>
% if data:
<% from plexpy.helpers import page %>
<% from jellypy.helpers import page %>
% for a in data:
<ul class="list-unstyled">
<div class="user-player-instance">

View File

@@ -1,6 +1,6 @@
<%
import plexpy
plex_login = plexpy.CONFIG.HTTP_PLEX_ADMIN or plexpy.CONFIG.ALLOW_GUEST_ACCESS
import jellypy
plex_login = jellypy.CONFIG.HTTP_PLEX_ADMIN or jellypy.CONFIG.ALLOW_GUEST_ACCESS
%>
<!doctype html>

View File

@@ -1,6 +1,6 @@
<%inherit file="base.html"/>
<%!
from plexpy import helpers
from jellypy import helpers
%>
<%def name="headIncludes()">

View File

@@ -1,8 +1,8 @@
% if newsletter:
<%!
import json
from plexpy import notifiers
from plexpy.helpers import anon_url, checked
from jellypy import notifiers
from jellypy.helpers import anon_url, checked
all_notifiers = sorted(notifiers.get_notifiers(), key=lambda k: (k['agent_label'].lower(), k['friendly_name'], k['id']))
email_notifiers = [n for n in all_notifiers if n['agent_name'] == 'email']

View File

@@ -9,7 +9,7 @@ Version: 0.1
DOCUMENTATION :: END
</%doc>
<% from plexpy import newsletter_handler %>
<% from jellypy import newsletter_handler %>
<ul class="stacked-configs list-unstyled">
% for newsletter in sorted(newsletters_list, key=lambda k: (k['agent_label'], k['friendly_name'], k['id'])):
<li class="newsletter-agent pointer" data-id="${newsletter['id']}">

View File

@@ -1,8 +1,8 @@
% if notifier:
<%
import json
from plexpy import notifiers, users
from plexpy.helpers import checked
from jellypy import notifiers, users
from jellypy.helpers import checked
available_notification_actions = notifiers.available_notification_actions(agent_id=notifier['agent_id'])
user_emails = [{'user': u['friendly_name'] or u['username'], 'email': u['email']} for u in users.Users().get_users() if u['email']]

View File

@@ -1,7 +1,7 @@
<%
import datetime
import plexpy
from plexpy import activity_handler, helpers
import jellypy
from jellypy import activity_handler, helpers
if queue == 'active sessions':
filter_key = 'session_key-'

View File

@@ -32,7 +32,7 @@ DOCUMENTATION :: END
% if data != None:
<%
from plexpy.helpers import cast_to_int, page
from jellypy.helpers import cast_to_int, page
%>
% if data:
<div class="dashboard-recent-media-row">

View File

@@ -11,10 +11,10 @@ DOCUMENTATION :: END
<%!
import datetime
import plexpy
from plexpy import common, helpers
import jellypy
from jellypy import common, helpers
scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
scheduled_jobs = [j.id for j in jellypy.SCHED.get_jobs()]
%>
<table class="config-scheduler-table small-muted">

View File

@@ -3,12 +3,12 @@
import os
import sys
import plexpy
from plexpy import common, notifiers, newsletters
from plexpy.helpers import anon_url, checked
import jellypy
from jellypy import common, notifiers, newsletters
from jellypy.helpers import anon_url, checked
docker_setting = 'disabled' if plexpy.DOCKER else ''
docker_msg = '<span class="setting-message small">(Controlled by Docker Container)</span>' if plexpy.DOCKER else ''
docker_setting = 'disabled' if jellypy.DOCKER else ''
docker_msg = '<span class="setting-message small">(Controlled by Docker Container)</span>' if jellypy.DOCKER else ''
available_notification_agents = sorted(notifiers.available_notification_agents(), key=lambda k: k['label'].lower())
available_newsletter_agents = sorted(newsletters.available_newsletter_agents(), key=lambda k: k['label'].lower())

View File

@@ -39,7 +39,7 @@ DOCUMENTATION :: END
% if data:
<%
from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES
from jellypy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES
%>
<div class="modal-dialog" role="document">
<div class="modal-content">

View File

@@ -1,6 +1,6 @@
<%inherit file="base.html"/>
<%!
from plexpy.helpers import anon_url
from jellypy.helpers import anon_url
%>
<%def name="headIncludes()">
</%def>

View File

@@ -26,7 +26,7 @@ DOCUMENTATION :: END
<%inherit file="base.html"/>
<%!
from plexpy import helpers
from jellypy import helpers
%>
<%def name="headIncludes()">

View File

@@ -28,7 +28,7 @@ DOCUMENTATION :: END
% if data:
<%
from plexpy.helpers import page
from jellypy.helpers import page
%>
<div class="dashboard-recent-media-row">
<div id="recently-watched-row-scroller" style="left: 0;">

View File

@@ -1,6 +1,6 @@
<%
import plexpy
from plexpy import common, helpers
import jellypy
from jellypy import common, helpers
%>
<!doctype html>

View File

@@ -1,11 +1,11 @@
% if data:
<%
import plexpy
from plexpy.helpers import grouper, get_img_service
import jellypy
from jellypy.helpers import grouper, get_img_service
recently_added = data['recently_added']
if plexpy.CONFIG.NEWSLETTER_SELF_HOSTED and plexpy.CONFIG.HTTP_BASE_URL:
base_url = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/'
if jellypy.CONFIG.NEWSLETTER_SELF_HOSTED and plexpy.CONFIG.HTTP_BASE_URL:
base_url = jellypy.CONFIG.HTTP_BASE_URL + jellypy.HTTP_ROOT + 'newsletter/'
elif preview:
base_url = 'newsletter/'
else:
@@ -13,7 +13,7 @@
service = get_img_service(include_self=True)
if service == 'self-hosted' and plexpy.CONFIG.HTTP_BASE_URL:
base_url_image = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'image/'
base_url_image = jellypy.CONFIG.HTTP_BASE_URL + jellypy.HTTP_ROOT + 'image/'
elif preview and service and service != 'self-hosted':
base_url_image = 'image/'
else:

View File

@@ -1,19 +1,19 @@
% if data:
<%
import plexpy
from plexpy.helpers import grouper, get_img_service
import jellypy
from jellypy.helpers import grouper, get_img_service
recently_added = data['recently_added']
if plexpy.CONFIG.NEWSLETTER_SELF_HOSTED and plexpy.CONFIG.HTTP_BASE_URL:
base_url = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/'
if jellypy.CONFIG.NEWSLETTER_SELF_HOSTED and jellypy.CONFIG.HTTP_BASE_URL:
base_url = jellypy.CONFIG.HTTP_BASE_URL + jellypy.HTTP_ROOT + 'newsletter/'
elif preview:
base_url = 'newsletter/'
else:
base_url = ''
service = get_img_service(include_self=True)
if service == 'self-hosted' and plexpy.CONFIG.HTTP_BASE_URL:
base_url_image = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'image/'
if service == 'self-hosted' and jellypy.CONFIG.HTTP_BASE_URL:
base_url_image = jellypy.CONFIG.HTTP_BASE_URL + jellypy.HTTP_ROOT + 'image/'
elif preview and service and service != 'self-hosted':
base_url_image = 'image/'
else:

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 = []