Get userid of Friend Invite ? for add condition [IPTV - XTV]

Hi,
I need help for modify an plugin. (IPTV)

When a channel is used by a user. another user can open a new channel without first being cut.

Xtream code configuration panel is set up multiple online are open to the playlist.

Can you imagine retrieve the name of the current user to pick a playlist diferent?

I want to change :

def LoadPlaylist():
    if Prefs['playlist'].startswith('http://') or Prefs['playlist'].startswith('https://'):
        playlist = HTTP.Request(Prefs['playlist']).content
    else:

in :

def LoadPlaylist():
	if username = username ('USER1')
        playlist = HTTP.Request('http://url_of_playlist')
    elif username = username ('USER2')
        playlist = HTTP.Request('http://url_of_another_playlist')
else:

or maybe :

if username 'USER1'
playlist = HTTP.Request('http://url:port/' + USER1 +' /10.m3u)

I found how to do… It work for LOCAL but not for INVITE FRIEND (use default playlist)

i need your help for my code

import os
import urllib2
TokenUsers = {}
plexhost = 'http://127.0.0.1:32400'

def GetCurrentPlexUser():
		orgtoken = Request.Headers['X-Plex-Token']
		if orgtoken in TokenUsers:
			return TokenUsers[orgtoken]		
		client = Request.Headers['X-Plex-Client-Identifier']
		origin = plexhost
		plextoken = os.environ.get('PLEXTOKEN')
		if (plextoken == None):
			xml = XML.ElementFromURL(origin+"/myplex/account")
			plextoken=xml.xpath("//MyPlex/@authToken")[0]
		xml = XML.ElementFromURL(origin+"/identity", headers={'X-Plex-Token': plextoken})
		machineid=xml.xpath("//MediaContainer/@machineIdentifier")[0]
		xml = XML.ElementFromURL("https://plex.tv/api/home/users", headers={'X-Plex-Token': plextoken})
		ids=xml.xpath("//User/@id")
		username='External'
		for id in ids:
			handler = urllib2.HTTPHandler()
			opener = urllib2.build_opener(handler)
			request = urllib2.Request("https://plex.tv/api/home/users/"+id+"/switch")
			request.add_header('X-Plex-Token',plextoken)
			request.add_header('X-Plex-Client-Identifier',client)
			request.get_method = lambda: 'POST'
			xml = XML.ElementFromString(opener.open(request).read())		
			token=xml.xpath("//user/@authenticationToken")[0]
			user=xml.xpath("//user/@title")[0]
			xml = XML.ElementFromURL("https://plex.tv/api/resources?includeHttps=1", headers={'X-Plex-Token': token, 'X-Plex-Client-Identifier' : client})
			token = xml.xpath("//Device[@clientIdentifier='"+machineid+"']/@accessToken")[0];
                    iduser=id
			if token==orgtoken:
				username=user
				iduser=id
				break
 		TokenUsers[orgtoken]=username
		TokenUsers[orgtoken]=iduser
	 	return username


def LoadPlaylist():
	user = GetCurrentPlexUser()
	iduser = GetCurrentPlexUser()
	if (iduser == '000*****'): #ME
		playlist = HTTP.Request('http://url:8000/get.php?username=xxx1&password=xxx1&type=m3u_plus&output=hls').content
	elif (iduser == '000*****'): #fabienne
		playlist = HTTP.Request('http://url:8000/get.php?username=xxx2&password=xxx2&type=m3u_plus&output=hls').content
	elif (iduser == '000*****'): #Laurine
		playlist = HTTP.Request('http://url:8000/get.php?username=xxx3&password=xxx3&type=m3u_plus&output=hls').content
	elif Prefs['playlist'].startswith('http://') or Prefs['playlist'].startswith('https://'): # Default playlist in Prefs
		playlist = HTTP.Request(Prefs['playlist']).content
	else:
		playlist = Resource.Load(Prefs['playlist'], binary = True)
	if playlist != None:
		lines = playlist.splitlines()
		groups_count = 0
		streams_count = 0
		for i in range(len(lines) - 1):
			line = lines*.strip()
			if line.startswith('#EXTINF'):
				url = lines[i + 1].strip()
				if url != '' and not url.startswith('#'):
					title = line[line.rfind(',') + 1:len(line)].strip()
					id = GetAttribute(line, 'tvg-id')
					name = GetAttribute(line, 'tvg-name')
					thumb = GetAttribute(line, 'tvg-logo')
					if thumb == '':
						thumb = GetAttribute(line, 'logo')
					group_title = GetAttribute(line, 'group-title', default = unicode(L('No Category')))
					if group_title not in GROUPS.keys():
						group_thumb = GetAttribute(line, 'group-logo')
						groups_count = groups_count + 1
						group = {'title': group_title, 'thumb': group_thumb, 'order': groups_count}
						GROUPS[group_title] = group
					streams_count = streams_count + 1
					stream = {'url': url, 'title': title, 'id': id, 'name': name, 'thumb': thumb, 'group': group_title, 'order': streams_count}
					STREAMS.setdefault(unicode(L('All')), {})[streams_count] = stream
					STREAMS.setdefault(group_title, {})[streams_count] = stream
					i = i + 1 # skip the url line fot next cycle
	return None

Bonjour , personne pour m’aider ?

@TVNETWORK

I guess nobody here is familiar with Xtream, myself included. Please give us some more information. Do I understand your problem correctly, that you need to assign each user a different playlist from the streaming server? And that each user should access only their own playlist and not another?

Also you mentioned simultaneous streaming by multiple users at the same time. Can you explain what is the problem with that?