From a2f0d09bfe43bc77ff8b1f568bd53b39efb5eb8c Mon Sep 17 00:00:00 2001 From: blacktwin Date: Wed, 3 Jan 2018 11:37:02 -0500 Subject: [PATCH] except for non transcoding sessions if not transcoding would error out instead of continuing. --- killstream/kill_trans_exp_audio.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/killstream/kill_trans_exp_audio.py b/killstream/kill_trans_exp_audio.py index 89f8313..f054d9a 100644 --- a/killstream/kill_trans_exp_audio.py +++ b/killstream/kill_trans_exp_audio.py @@ -40,13 +40,17 @@ def kill_session(): if user in USER_IGNORE or media_type == 'track': print('Ignoring {}\'s {} stream.'.format(user, media_type)) pass - trans_dec = session.transcodeSessions[0].videoDecision - if trans_dec == 'transcode': - platform = session.players[0].platform - MESSAGE = DEVICES.get(platform, DEFAULT_REASON) - print(MESSAGE) - print('Killing {user}\'s stream for transcoding video on {plat}.'.format(user=user, plat=platform)) - session.stop(reason=MESSAGE) + try: + trans_dec = session.transcodeSessions[0].videoDecision + if trans_dec == 'transcode': + platform = session.players[0].platform + MESSAGE = DEVICES.get(platform, DEFAULT_REASON) + #print(MESSAGE) + print('Killing {user}\'s stream for transcoding video on {plat}.'.format(user=user, plat=platform)) + session.stop(reason=MESSAGE) + except IndexError: + # print('{} not transcoding.'.format(user)) + pass if __name__ == '__main__':