mirror of
https://github.com/blacktwin/JBOPS.git
synced 2025-12-15 12:45:36 +00:00
Update kill_trans_library.py
add session_key arg and separate `if transcodeSessions` If an active session was not transcoding then the script would error on the session and may not complete loop through all sessions.
This commit is contained in:
parent
50c4d3b665
commit
fab88eda03
@ -8,7 +8,7 @@ PlexPy > Settings > Notification Agents > Scripts > Gear icon:
|
|||||||
Playback Start: kill_trans_library.py
|
Playback Start: kill_trans_library.py
|
||||||
|
|
||||||
PlexPy > Settings > Notifications > Script > Script Arguments:
|
PlexPy > Settings > Notifications > Script > Script Arguments:
|
||||||
{section_id}
|
{section_id} {session_key}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
@ -42,15 +42,17 @@ plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess)
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
lib_id = sys.argv[1]
|
lib_id = sys.argv[1]
|
||||||
|
session_key = sys.argv[2]
|
||||||
|
|
||||||
for session in plex.sessions():
|
for session in plex.sessions():
|
||||||
username = session.usernames[0]
|
username = session.usernames[0]
|
||||||
media_type = session.type
|
media_type = session.type
|
||||||
if username not in USER_IGNORE and media_type != 'track':
|
section_id = session.librarySectionID
|
||||||
|
if username not in USER_IGNORE and media_type != 'track' and lib_id == section_id and session.sessionKey is session_key:
|
||||||
title = session.title
|
title = session.title
|
||||||
section_id = session.librarySectionID
|
if session.transcodeSessions[0]:
|
||||||
trans_dec = session.transcodeSessions[0].videoDecision
|
trans_dec = session.transcodeSessions[0].videoDecision
|
||||||
if lib_id == section_id and trans_dec == 'transcode':
|
if trans_dec == 'transcode':
|
||||||
reason = DEVICES.get(session.players[0].platform, DEFAULT_REASON)
|
reason = DEVICES.get(session.players[0].platform, DEFAULT_REASON)
|
||||||
print(PLEXPY_LOG.format(user=username, title=title, section=section_id))
|
print(PLEXPY_LOG.format(user=username, title=title, section=section_id))
|
||||||
session.stop(reason=reason)
|
session.stop(reason=reason)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user