fix if, add int
This commit is contained in:
parent
fd0f4b749d
commit
98b4f1e6d1
@ -28,7 +28,7 @@ ignore_lst = ('')
|
|||||||
# 2nd stream information is passed
|
# 2nd stream information is passed
|
||||||
USERNAME = sys.argv[1]
|
USERNAME = sys.argv[1]
|
||||||
ADDRESS = sys.argv[2]
|
ADDRESS = sys.argv[2]
|
||||||
SESSION_KEY = sys.argv[3]
|
SESSION_KEY = int(sys.argv[3])
|
||||||
|
|
||||||
if USERNAME in ignore_lst:
|
if USERNAME in ignore_lst:
|
||||||
print(u"{} ignored.".format(USERNAME))
|
print(u"{} ignored.".format(USERNAME))
|
||||||
@ -48,16 +48,15 @@ def kill_session(user, ip_address, session_key):
|
|||||||
if username == user and address == ip_address:
|
if username == user and address == ip_address:
|
||||||
user_sessions.append((session))
|
user_sessions.append((session))
|
||||||
|
|
||||||
if len(user_sessions) > 1:
|
if len(user_sessions) == 1:
|
||||||
for session in user_sessions:
|
for session in user_sessions:
|
||||||
if session_key == session.sessionKey:
|
if session_key == session.sessionKey:
|
||||||
title = (session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
title = (session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
||||||
print(u"Killing {}'s second stream of {} for {}".format(username, title, MESSAGE))
|
print(u"Killing {}'s second stream of {} for {}".format(user, title, MESSAGE))
|
||||||
session.stop(reason=MESSAGE)
|
session.stop(reason=MESSAGE)
|
||||||
else:
|
else:
|
||||||
for session in user_sessions:
|
print(u"Not killing {}'s second stream. Same IP".format(user))
|
||||||
username = session.usernames[0]
|
|
||||||
print(u"Not killing {}'s second stream. Same IP".format(username))
|
|
||||||
|
|
||||||
|
|
||||||
kill_session(USERNAME, ADDRESS, SESSION_KEY)
|
kill_session(USERNAME, ADDRESS, SESSION_KEY)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user