Results 1 to 7 of 7
-
02-06-2012, 17:50 #1
-= TeamSpeak User =-
- Join Date
- Jun 2012
- Posts
- 4
Retrieve Avatar through ClientQuery - Possible?
Hi,
Is it possible to retrieve the actual avatar image data via the ClientQuery plugin? I can see there is a clientvariable called client_flag_avatar, but cannot see how it is possible to retrieve the actual image data using that hash.
-
02-06-2012, 18:56 #2
-= TeamSpeak Fanatic =-
- Join Date
- Jan 2010
- Location
- Germany
- Posts
- 2,039
The Avatar displayed in the Client is directly loaded from a File already on your Harddisk. Not sure what client_flag_avatar actually contains right now, thought I'd be a boolean Flag whether that client does or does not have an avatar set, but if it looks like some sort of hash it's a pretty safe bet it's the filename of the avatar.
Edit:
Actually the Filename is derived from the UniqueID of the Client which you can definately get. See here
Since you do know the Filename you just need the path which is derived from the Server UnqiueID in some fashion (can't remember which one anymore though). Then you can just load the File and do whatever you want to do.
Edit2:
Actually the Algorithm for the Folder Name is pretty simple and rather obvious - it's just the base64 encoded Server Unique ID.Last edited by SilentStorm; 02-06-2012 at 23:14. Reason: added algorithm for Folders... should've looked at the folder names before :/
-
02-06-2012, 22:28 #3
-= TeamSpeak User =-
- Join Date
- Jun 2012
- Posts
- 4
That's great, thanks. It gave me enough to get something working. I couldn't work out how to retrieve whatever is used to encode the server ID, so I just search all directories in the cache till I find the avatar file that matches.
Here is my Python code in case it is of use to anyone else. If anyone has an insight into how to retrieve and decode the server unique ID I'd love to hear it
Code:def find_avatar(client_unique_identifier): decoded = "" for c in base64.b64decode(client_unique_identifier): decoded += chr(((ord(c) & 0xf0) >> 4) + 97) decoded += chr((ord(c) & 0x0f) + 97) # This is the path on Linux, it is probably different on other platforms dir_path = os.path.expanduser("~/.ts3client/cache") for l in os.listdir(dir_path): p = os.path.join(dir_path, l, "clients", "avatar_%s" % decoded) if os.path.exists(p): return pLast edited by tanktarta; 02-06-2012 at 22:48.
-
02-06-2012, 22:40 #4
-= TeamSpeak Fanatic =-
- Join Date
- Jan 2010
- Location
- Germany
- Posts
- 2,039
Actually searching through all the Directories is kind of a bad idea. The Avatar Filename is always the same for each Unique ID, now if you had two different Avatars on two different Servers, your script would return whatever Folder comes first, which is not what you want. I realize this is (most likely) just a temporary workaround but still wanted to make you aware of this.
Edit:
Actually - LOL - the Folder Names are pretty damn obvious... just took a look at them again and it's just the base64 encoded ServerUniqueID.
So the Full Path would be:
"~/.ts3client/cache/" + base64_encode(server_unique_id) + "/clients/avatar_" + ts3_base16(base64_decode(client_unique_id))Last edited by SilentStorm; 02-06-2012 at 23:12.
-
03-06-2012, 13:20 #5
-= TeamSpeak User =-
- Join Date
- Jun 2012
- Posts
- 4
Yeh, I'd rather not have done this
Just wanted to something to work with.
Ah right, thanks. That's great, however, I cannot for the life of me work out how to get the this "ServerUniqueID" via any of the ClientQuery commands. The only ID field I can find is the servervariable virtualserver_id which has a value of 1.Actually - LOL - the Folder Names are pretty damn obvious... just took a look at them again and it's just the base64 encoded ServerUniqueID.
My cache directory has a name ZmJsdjhodGQySmgrckNjZFFpcUZiYjh0bjc0PQ==, which decodes to fblv8htd2Jh+rCcdQiqFbb8tn74=. I can't find this value anywhere.
Any ideas? I must be missing something really simple here...
-
03-06-2012, 16:00 #6
-= TeamSpeak Fanatic =-
- Join Date
- Jan 2010
- Location
- Germany
- Posts
- 2,039
The closest thing to what you'd need is servervariables but according to the help it doesn't support retrieving the ServerUniqueID which is rather strange because the Client definately knows the Server UID.
Edit: actually it's just an oversight in the help...
gives you exactly what you need.Code:servervariable virtualserver_unique_identifier
Last edited by SilentStorm; 03-06-2012 at 16:10.
-
03-06-2012, 16:50 #7
-= TeamSpeak User =-
- Join Date
- Jun 2012
- Posts
- 4
Perfectservervariable virtualserver_unique_identifier
Thanks for taking the time to help me out.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Resolved] ClientQuery Source Code
By Wilson29thID in forum PluginsReplies: 3Last Post: 03-01-2012, 09:44 -
[Official] ClientQuery Plugin
By Peter in forum PluginsReplies: 7Last Post: 22-08-2011, 08:44 -
ClientQuery: Getting my CLID
By Triscopic in forum PluginsReplies: 6Last Post: 06-08-2011, 10:51 -
ClientQuery plugin Source?
By FaltyR in forum PluginsReplies: 1Last Post: 25-07-2011, 11:19 -
ClientQuery plugin
By florian_fr40 in forum PluginsReplies: 16Last Post: 14-10-2010, 17:33


Reply With Quote
