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.
skin.ini
Code: Select all
[Variables]
UtorrentUsername=username
UtorrentPassword=password
UtorrentIP=127.0.0.1
UtorrentPort=8080
[LUACode]
Measure=Script
ScriptFile=Utorrent.lua
[UtorrentToken]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=http://#UtorrentUserName#:#UtorrentPassword#@#UtorrentIP#:#UtorrentPort#/gui/token.html
RegExp="(?siU)<html>.*>(.*)</div></html>"
UpdateRate=1800
StringIndex=1
FinishAction=!CommandMeasure LUACode "TokenInitialize()"
[UtorrentHTML]
Measure=Plugin
Plugin=Plugins\WebParser.dll
RegExp='(?siU)(.*)'
Speaking of the lua code:
Utorrent.lua
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)
end
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.