removed plextv / pms, added TODO's for reimplementing Jellyfin
This commit is contained in:
@@ -39,7 +39,6 @@ from jellypy import datafactory
|
||||
from jellypy import logger
|
||||
from jellypy import helpers
|
||||
from jellypy import notifiers
|
||||
from jellypy import pmsconnect
|
||||
from jellypy import request
|
||||
from jellypy.newsletter_handler import notify as notify_newsletter
|
||||
|
||||
@@ -164,18 +163,20 @@ def notify_conditions(notify_action=None, stream_data=None, timeline_data=None):
|
||||
# return False
|
||||
|
||||
if notify_action == 'on_concurrent':
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_current_activity()
|
||||
|
||||
user_sessions = []
|
||||
if result:
|
||||
user_sessions = [s for s in result['sessions'] if s['user_id'] == stream_data['user_id']]
|
||||
|
||||
if jellypy.CONFIG.NOTIFY_CONCURRENT_BY_IP:
|
||||
evaluated = len(
|
||||
Counter(s['ip_address'] for s in user_sessions)) >= jellypy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD
|
||||
else:
|
||||
evaluated = len(user_sessions) >= jellypy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD
|
||||
pass
|
||||
# TODO: Jellyfin
|
||||
# pms_connect = pmsconnect.PmsConnect()
|
||||
# result = pms_connect.get_current_activity()
|
||||
#
|
||||
# user_sessions = []
|
||||
# if result:
|
||||
# user_sessions = [s for s in result['sessions'] if s['user_id'] == stream_data['user_id']]
|
||||
#
|
||||
# if jellypy.CONFIG.NOTIFY_CONCURRENT_BY_IP:
|
||||
# evaluated = len(
|
||||
# Counter(s['ip_address'] for s in user_sessions)) >= jellypy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD
|
||||
# else:
|
||||
# evaluated = len(user_sessions) >= jellypy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD
|
||||
|
||||
elif notify_action == 'on_newdevice':
|
||||
data_factory = datafactory.DataFactory()
|
||||
@@ -536,10 +537,11 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
|
||||
notify_params.update(media_part_info)
|
||||
|
||||
child_metadata = grandchild_metadata = []
|
||||
for key in kwargs.pop('child_keys', []):
|
||||
child_metadata.append(pmsconnect.PmsConnect().get_metadata_details(rating_key=key))
|
||||
for key in kwargs.pop('grandchild_keys', []):
|
||||
grandchild_metadata.append(pmsconnect.PmsConnect().get_metadata_details(rating_key=key))
|
||||
# TODO: Jellyfin
|
||||
# for key in kwargs.pop('child_keys', []):
|
||||
# child_metadata.append(pmsconnect.PmsConnect().get_metadata_details(rating_key=key))
|
||||
# for key in kwargs.pop('grandchild_keys', []):
|
||||
# grandchild_metadata.append(pmsconnect.PmsConnect().get_metadata_details(rating_key=key))
|
||||
|
||||
# Session values
|
||||
session = session or {}
|
||||
@@ -1097,7 +1099,8 @@ def build_server_notify_params(notify_action=None, **kwargs):
|
||||
date_format = jellypy.CONFIG.DATE_FORMAT.replace('Do', '')
|
||||
time_format = jellypy.CONFIG.TIME_FORMAT.replace('Do', '')
|
||||
|
||||
update_channel = pmsconnect.PmsConnect().get_server_update_channel()
|
||||
# TODO: Jellyfin
|
||||
# update_channel = pmsconnect.PmsConnect().get_server_update_channel()
|
||||
|
||||
pms_download_info = defaultdict(str, kwargs.pop('pms_download_info', {}))
|
||||
plexpy_download_info = defaultdict(str, kwargs.pop('plexpy_download_info', {}))
|
||||
@@ -1146,7 +1149,8 @@ def build_server_notify_params(notify_action=None, **kwargs):
|
||||
'update_url': pms_download_info['download_url'],
|
||||
'update_release_date': arrow.get(pms_download_info['release_date']).format(date_format)
|
||||
if pms_download_info['release_date'] else '',
|
||||
'update_channel': 'Beta' if update_channel == 'beta' else 'Public',
|
||||
# TODO: Jellyfin
|
||||
# 'update_channel': 'Beta' if update_channel == 'beta' else 'Public',
|
||||
'update_platform': pms_download_info['platform'],
|
||||
'update_distro': pms_download_info['distro'],
|
||||
'update_distro_build': pms_download_info['build'],
|
||||
@@ -1410,32 +1414,34 @@ def get_img_info(img=None, rating_key=None, title='', width=1000, height=1500,
|
||||
img_info = database_img_info[0]
|
||||
|
||||
elif not database_img_info and img:
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_image(refresh=True, **image_info)
|
||||
|
||||
if result and result[0]:
|
||||
img_url = delete_hash = ''
|
||||
|
||||
if service == 'imgur':
|
||||
img_url, delete_hash = helpers.upload_to_imgur(img_data=result[0],
|
||||
img_title=title,
|
||||
rating_key=rating_key,
|
||||
fallback=fallback)
|
||||
elif service == 'cloudinary':
|
||||
img_url = helpers.upload_to_cloudinary(img_data=result[0],
|
||||
img_title=title,
|
||||
rating_key=rating_key,
|
||||
fallback=fallback)
|
||||
|
||||
if img_url:
|
||||
img_hash = set_hash_image_info(**image_info)
|
||||
data_factory.set_img_info(img_hash=img_hash,
|
||||
img_title=title,
|
||||
img_url=img_url,
|
||||
delete_hash=delete_hash,
|
||||
service=service)
|
||||
|
||||
img_info = {'img_title': title, 'img_url': img_url}
|
||||
pass
|
||||
# TODO: Jellyfin
|
||||
# pms_connect = pmsconnect.PmsConnect()
|
||||
# result = pms_connect.get_image(refresh=True, **image_info)
|
||||
#
|
||||
# if result and result[0]:
|
||||
# img_url = delete_hash = ''
|
||||
#
|
||||
# if service == 'imgur':
|
||||
# img_url, delete_hash = helpers.upload_to_imgur(img_data=result[0],
|
||||
# img_title=title,
|
||||
# rating_key=rating_key,
|
||||
# fallback=fallback)
|
||||
# elif service == 'cloudinary':
|
||||
# img_url = helpers.upload_to_cloudinary(img_data=result[0],
|
||||
# img_title=title,
|
||||
# rating_key=rating_key,
|
||||
# fallback=fallback)
|
||||
#
|
||||
# if img_url:
|
||||
# img_hash = set_hash_image_info(**image_info)
|
||||
# data_factory.set_img_info(img_hash=img_hash,
|
||||
# img_title=title,
|
||||
# img_url=img_url,
|
||||
# delete_hash=delete_hash,
|
||||
# service=service)
|
||||
#
|
||||
# img_info = {'img_title': title, 'img_url': img_url}
|
||||
|
||||
if img_info['img_url'] and service == 'cloudinary':
|
||||
# Transform image using Cloudinary
|
||||
|
Reference in New Issue
Block a user