It is currently October 14th, 2024, 10:06 pm

Rainmeter TS3

Share and get help with Plugins and Addons
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

Rainmeter TS3

Post by MrCake »

So since i started with rainmeter I was looking to put some teamspeak info on my meter.
Unfortunately my programming skills are not so good, so the plugin makes my rainmeter really unresponsive (but I kinda expected that was going to happen, I am kinda happy that i managed to get text on it )
I looked at some other projects for guidance (vkontacte plugin, netmeter), so here is what i put together.

https://github.com/Mr0Cake/RainmeterTS3/tree/start/PluginEmpty

so what i'm thinking is that i should use a thread, like in netmeter. but i'm really pushing my boundaries on programming. I would be happy if someone said "dude the only thing you need to do is ..." but I don't think it will be that easy. (have been programming for 9 hours its already light outside going to bed now)

Thanks for reading!
Last edited by MrCake on October 2nd, 2015, 9:16 am, edited 2 times in total.
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

Re: TeamspeakPlugin early draft (slow)

Post by FlyingHyrax »

Cool idea! It might not be that hard to move some things onto a background thread. I'm not familiar with Teamspeak - is there documentation somewhere for the Teamspeak*.cs classes you're using? Or do you know exactly what calls are taking a long time and choking the plugin thread?
Flying Hyrax on DeviantArt
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

Re: TeamspeakPlugin early draft (slow)

Post by MrCake »

http://forum.teamspeak.com/showthread.php/66509-Official-ClientQuery-Plugin

It uses 1 telnet connection to get to the teamspeak data. For now that looked like the easiest solution to me. maybe i need to dig around in the teamspeak 3 sdk, but i think it would require me to make a plugin for teamspeak and for rainmeter :D
FlyingHyrax
Posts: 232
Joined: July 1st, 2011, 1:32 am
Location: US

Re: TeamspeakPlugin early draft (slow)

Post by FlyingHyrax »

Just a couple of observations. (I don't have much time at present to work on this myself, but maybe can help a litte.)
  • Do you really need the tc.Read() call in the measure constructor? (You might, I haven't read the docs yet).
  • The switch that updates the servername | channelname | users is in Reload(); you probably want that in Update() so that it is triggered by the skin update cycle, not by a skin refresh.
  • You're checking tc.IsConnected which is good, but you aren't resetting the string values if isConnected is false, so if the state goes unconnected > connected > unconnected, you'll be returning the value from the last time it was connected. That may or may not be the behavior you want.
  • You're checking for an UpdateRate setting but not using it; that logic would also go in Update(). Generally that's just used as a multiplier so that the actual update code only triggers "every UpdateRate calls to Update()".
  • The most straightforward route to add a background thread would probably be to put the switch that is updating your return values inside another method, and trigger that method in a thread started in the Update() method. Then you'd just need to add some locks so the two threads don't both try to access the return value simultaneously, and some logic to prevent starting more than one background thread at a time.
JSMorley has a good example plugin that demonstrates using UpdateRate and using a single background thread for updating: https://github.com/jsmorley/CheckNet/blob/master/PluginCheckNet.cs That could give you a good skeleton.
Flying Hyrax on DeviantArt
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

Re: TeamspeakPlugin early draft (slow)

Post by MrCake »

i use the read() because the telnet class i have first outputs "welcome to ts3 balbla" if I do read() the class clears the welcome text so that i can grab the next output.
im going to try to find out where my code uses so much time, probably remove some stuff that i dont really need to make it smaller (which makes it harder to expand it later on)

also i went through some of the c# sdk of teamspeak, looks so hard imma need some more time to figure that out (documentation is also a bit difficult, mostly centered around people trying to implement a whole teamspeak client in their program) made stuff in the sdk, read the forums "teamspeak3 sdk != teamspeak3" allright so i can't access the values of the teamspeak 3 application directly.. maybe I have to make a plugin.. Man if I knew where to look...

Also I learned how to do Threading in c# so I can make it so that it works in multiple threads. I did test how fast it could grab a user list and it was about 200ms so I don't really think it is able to work that efficiently using the method I now use.
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

Re: TeamspeakPlugin early draft (slow)

Post by MrCake »

I managed to get it working, except for the reload function (I think it might have something to do with the finalize action but i'm not touching that, the debugging says I have some values that have to be uninitialised but that logic is also used in the reconnecting so I can't just use it)

https://www.dropbox.com/s/q0wvg25lp2jieev/Screenshot%202015-02-24%2004.15.19.png?dl=0

https://github.com/Mr0Cake/RainmeterTS3Plugin/blob/master/PluginEmpty/PluginEmpty.cs

For now I only managed to dump a string that shows:
Channelname
\t usernames
usertalking
textmessage

I tried separating those in grab functions but that proved a little too hard for me.

Credits go to
https://ts3querylib.codeplex.com/
for their framework that I adapted a little.

Not tested for x86, also not tested on other platforms. If and when you have bugs you can always report them here, or github if I can get it working.

https://www.dropbox.com/s/i60m1c7r1zfc3jt/RainmeterTS3.rar?dl=0

Also I found a bug that when you close teamspeak at the right time, the plugin would give a nullpointer
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

RainTS3

Post by MrCake »

I managed to get almost all of it working.
There might be some random crashes. I have 2 other testers so I can't test alot.
Github

If anyone can guide me on using parameters it would be really appreciated
I tried using getstring and then return the appropriate strings but I think it will always try to spawn a new connection which will only give me 1 usable connection.
x64.rar
x32.rar
You do not have the required permissions to view the files attached to this post.
sundansx
Posts: 4
Joined: February 8th, 2014, 10:31 pm

Re: Rainmeter TS3

Post by sundansx »

Mr Cake,
I am interested in working on this plugin. Have you updated git with your Feb 27th changes?
thanks.
MrCake
Posts: 9
Joined: November 21st, 2014, 3:46 am

Re: Rainmeter TS3

Post by MrCake »

I've updated it now.
There are still some errors that I am not able to fix:
The string that is being read from the telnet stream is in very rare cases way too long, it reads something like "command" followed by alot of line breaks and part of the following command.
I also get DisposedExceptions and Nullreference exceptions in rare cases. These exceptions come after I checked for disposed and Null value, so it changed inside the if.

And the problem that I couldn't get it to work with multiple return values. As in: name of channel only, people in channel only, people speaking, messages only,.. It only returns the channelname on all occasions.

Anyhow, thanks for your interest, I will be watching closely what you do so I can learn more!
User avatar
HUNTwerker
Posts: 20
Joined: February 2nd, 2024, 12:33 pm

Re: Rainmeter TS3

Post by HUNTwerker »

Does the plugin still work or are there newer projects? O.O