Remove unused check recently added pinger

This commit is contained in:
JonnyWong16 2020-07-15 21:05:49 -07:00
parent 9a0f83c3e7
commit b9422312f3
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -216,75 +216,6 @@ def check_active_sessions(ws_request=False):
logger.debug("Tautulli Monitor :: Unable to read session list.")
def check_recently_added():
with monitor_lock:
# add delay to allow for metadata processing
delay = plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY
time_threshold = helpers.timestamp() - delay
time_interval = plexpy.CONFIG.MONITORING_INTERVAL
pms_connect = pmsconnect.PmsConnect()
recently_added_list = pms_connect.get_recently_added_details(count='10')
library_data = libraries.Libraries()
if recently_added_list:
recently_added = recently_added_list['recently_added']
for item in recently_added:
library_details = library_data.get_details(section_id=item['section_id'])
if not library_details['do_notify_created']:
continue
metadata = []
if 0 < time_threshold - int(item['added_at']) <= time_interval:
if item['media_type'] == 'movie':
metadata = pms_connect.get_metadata_details(item['rating_key'])
if metadata:
metadata = [metadata]
else:
logger.error("Tautulli Monitor :: Unable to retrieve metadata for rating_key %s" \
% str(item['rating_key']))
else:
metadata = pms_connect.get_metadata_children_details(item['rating_key'])
if not metadata:
logger.error("Tautulli Monitor :: Unable to retrieve children metadata for rating_key %s" \
% str(item['rating_key']))
if metadata:
if not plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED:
for item in metadata:
library_details = library_data.get_details(section_id=item['section_id'])
if 0 < time_threshold - int(item['added_at']) <= time_interval:
logger.debug("Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
plexpy.NOTIFY_QUEUE.put({'timeline_data': item.copy(), 'notify_action': 'on_created'})
else:
item = max(metadata, key=lambda x:x['added_at'])
if 0 < time_threshold - int(item['added_at']) <= time_interval:
if item['media_type'] == 'episode' or item['media_type'] == 'track':
metadata = pms_connect.get_metadata_details(item['grandparent_rating_key'])
if metadata:
item = metadata
else:
logger.error("Tautulli Monitor :: Unable to retrieve grandparent metadata for grandparent_rating_key %s" \
% str(item['rating_key']))
logger.debug("Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
# Check if any notification agents have notifications enabled
plexpy.NOTIFY_QUEUE.put({'timeline_data': item.copy(), 'notify_action': 'on_created'})
def connect_server(log=True, startup=False):
if plexpy.CONFIG.PMS_IS_CLOUD:
if log: