It is currently November 15th, 2019, 3:55 am

Utorrent Token System

Tips and Tricks from the Rainmeter Community
Posts: 1
Joined: February 27th, 2014, 6:08 am

Utorrent Token System

Niscandia » February 27th, 2014, 7:05 am

Well I've been lurking around for the forums for a while now, getting tips and code help that I've need for making my own skin. I figure I should share a fix I've made for an annoyance.

A little background: When I first started with rainmeter I wanted a skin that displayed my torrents, Utorrent was downloading. This proved rather annoying since I didn't know that you needed to toggle webui.token_auth to false for every skin I tried. Many google searches later, and too many Utorrent skins downloaded, trashed, redownloaded. I figured out you did need to use that toggle. And I did for awhile.

But I don't like removing security, and the webui token is higher security. So here is the code snippet that I wrote to fix it. Not sure if anyone else has implement the webui token system for rainmeter, but this is my take on it.


Code: Select all



	FinishAction=!CommandMeasure LUACode "TokenInitialize()"

As you can see a couple of variables for easy config, along with two WebParser measures. The first one gets the token, once every 30 minutes, calls the LUA code to update the URL for the second. Making the second WebParser use the token in all calls it makes.

Speaking of the lua code:

Code: Select all

function TokenInitialize()
	local tokenhtml = SKIN:GetMeasure("UtorrentToken")
	token = tokenhtml:GetStringValue()
	SKIN:Bang('!SetOption UtorrentHTML URL http://#UtorrentIP#:#UtorrentPort#/gui/?list=1&token=' .. token)
Lots of stuff left out for handling the torrents, but that isn't what this is about. Just about getting the list via a token. I tried to make this so it would be easy to drop into a Utorrent skin, and do very little editing to make it work. I belive you would need to edit two lines, in skin.ini the name of [UtorrentHTML] would need to be set to the HTML meter, and in the lua the skin bang will need to have the name updated. That and not use the regexp that I used for [UtorrentHTML] but the skin's original one.

The only problem might be a time out on the Token, which I haven't found out what that is yet. So some fiddling with the UpdateRate on UtorrentToken should fix that up. Til then I figured 30 minutes should be decent. But time will tell, always does.

I hope others find the code useful as I have.