It is currently March 29th, 2024, 9:50 am

LuaTorrent3

RSS, ATOM and other feeds, GMail, Stocks, any information retrieved from the internet
User avatar
Mordasius
Posts: 1167
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: LuaTorrent3

Post by Mordasius »

handsforfeet wrote:Update 3.1.2 worked like a charm. I had to delete my downloaded files, as it was displaying the files alphabetically and not by most recent, but it was worth it as it is now working and displaying correctly.
After working around the temporary hiccup with perfmon.dll, I was in the same situation as handsforfeet in that the skin was just showing the first five torrents on the Web UI regardless of status. Rather than delete downloaded files (hey.. you never know when you'll want to watch The Big Bang S01 for the tenth time), I tiddled around with JSMorley's LUA script so that the skin would only show the torrents being downloaded.

A modded version of the script that works on my machine is:

Code: Select all

function Initialize()
	
	tItem = {}
	tHASH = {}
	tSTATUS = {}
	tNAME = {}
	tSIZE = {}
	tPERCENTPROGRESS = {}
	tDOWNLOADED = {}
	tUPLOADED = {}
	tRATIO = {}
	tUPLOADSPEED = {}
	tDOWNLOADSPEED = {}
	tETA = {}
	tLABEL = {}
	tPEERSCONNECTED = {}
	tPEERSINSWARM = {}
	tSEEDSCONNECTED = {}
	tSEEDSINSWARM = {}
	tAVAILABILITY = {}
	tTORRENTQUEUEORDER = {}
	tREMAINING = {}
	tField21 = {}
	tField22 = {}
	tTEXTSTATUS = {}
	tField24 = {}
	tField25 = {}
	tField26 = {}
	tField27 = {}
	tSAVEFOLDER = {}
	
	sNormalColor = SKIN:GetVariable("ListFontColor")
	sGreyColor = SKIN:GetVariable("GreyColor")
	RunningState = SKIN:GetMeasure("CalcTranslatePIDToRunningState")
	msMain = SKIN:GetMeasure("MeasureWebUI")
	CurrDir = SKIN:GetVariable("CURRENTPATH")
	
end -- function Initialize

function Update()

	IsRunning = RunningState:GetValue()
	
	if IsRunning == 1 then --uTorrent running
	
		Pos = 0
		iDL = 0
		sAllText = msMain:GetStringValue()
		sAllText = string.match(sAllText, ".-\034torrents\034%:(.-)$")	
		sTemp, iItemCount = string.gsub(sAllText, ".-%[\"(.-)\"%]", "")

		for i = 1, iItemCount do
			tItem[i] = "[\""..string.match(sAllText, ".-%[\"(.-)\"%]", Pos).."\"]"
			Pos = Pos + string.len(tItem[i])+1
			tHASH[i], tSTATUS[i], tNAME[i], tSIZE[i], tPERCENTPROGRESS[i], tDOWNLOADED[i], tUPLOADED[i], tRATIO[i], tUPLOADSPEED[i], tDOWNLOADSPEED[i], tETA[i], tLABEL[i], tPEERSCONNECTED[i], tPEERSINSWARM[i], tSEEDSCONNECTED[i], tSEEDSINSWARM[i], tAVAILABILITY[i], tTORRENTQUEUEORDER[i], tREMAINING[i], tField21[i], tField22[i], tTEXTSTATUS[i], tField24[i], tField25[i], tField26[i], tField27[i], tSAVEFOLDER[i] = string.match(tItem[i], '%[\"(.-)\",(.-),\"(.-)\",(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),\"(.-)\",(.-),(.-),(.-),(.-),(.-),(.-),(.-),\"(.-)\",\"(.-)\",\"(.-)\",\"(.-)\",(.-),(.-),\"(.-)\",\"(.-)\".-%]')
			
	--> filter to only show the files being downloaded
		if (tTEXTSTATUS[i] == "Downloading") and (iDL < 6) then 
				iDL = iDL + 1
				tTEXTSTATUS[i] = string.gsub(tTEXTSTATUS[i], "Downloading", "Download")
				tSAVEFOLDER[i] = string.gsub(tSAVEFOLDER[i], "\092\092", "\092")
			
				SKIN:Bang("!ShowMeterGroup Torrent"..iDL)	
				SKIN:Bang("!SetOption Meter"..iDL.."Name Text \""..tNAME[i].."\"")
				SKIN:Bang("!SetOption Meter"..iDL.."Name ToolTipText \""..tNAME[i].."#CRLF#"..tSAVEFOLDER[i].."\092#CRLF#Peers: "..tPEERSCONNECTED[i].."("..tPEERSINSWARM[i]..")#CRLF#Downloaded: "..round(tonumber(tDOWNLOADED[i]/1048576),0).." Mb".."#CRLF#Remaining: "..round(tonumber(tREMAINING[i]/1048576),0).." Mb#CRLF#Ratio: "..round(tonumber(tRATIO[i]/1000),3).."\"")
				SKIN:Bang("!SetOption Meter"..iDL.."Size Text \""..round(tonumber(tSIZE[i]/1048576),0).." Mb\"")
				SKIN:Bang("!SetVariable Bar"..iDL.."Calc \""..math.floor(tonumber(tPERCENTPROGRESS[i]/10)).."\"")
				SKIN:Bang("!SetOption Meter"..iDL.."\% Text \""..math.floor(tonumber(tPERCENTPROGRESS[i]/10)).." \%\"")
				if round(tonumber(tDOWNLOADSPEED[i]/1024),0) <= 0 then
					SKIN:Bang("!SetOption Meter"..iDL.."DLSpeed FontColor \""..sGreyColor.."\"")
				else
					SKIN:Bang("!SetOption Meter"..iDL.."DLSpeed FontColor \""..sNormalColor.."\"")
				end	
				SKIN:Bang("!SetOption Meter"..iDL.."DLSpeed Text \""..round(tonumber(tDOWNLOADSPEED[i]/1024),0).." k/Bs\"")		
				SKIN:Bang("!SetOption Meter"..iDL.."Seeds Text \""..tSEEDSCONNECTED[i].."("..tSEEDSINSWARM[i]..")\"")
				SKIN:Bang("!SetOption Meter"..iDL.."Status Text \""..tTEXTSTATUS[i].."\"")	
								
			end	-- found downloading torrent
			
			SKIN:Bang("!EnableMeasureGroup AllMeasures")
				
			if iDL == 0 then
				SKIN:Bang("!HideMeterGroup Body")
			else	
				SKIN:Bang("!ShowMeterGroup Body")
			end
		
			SKIN:Bang("!SetVariable BackgroundHeight "..tostring(iDL * 31))
			
			if iDL < 5 then
				for i = iDL + 1, 5 do
					SKIN:Bang("!HideMeterGroup Torrent"..i)
				end	
			end	
		end	-- of scanning all items listed on the Web UI
		
	else -- uTorrent not running
		
		SKIN:Bang("!DisableMeasureGroup AllMeasures")
		SKIN:Bang("!HideMeterGroup Body")
		for i = 1, 5 do
			SKIN:Bang("!HideMeterGroup Torrent"..i)
		end	
		
	end	-- Test for uTorrent running

	return IsRunning
	
end -- function Update

function round(num, idp)

  local mult = 10^(idp or 0)
  return math.floor(num * mult + 0.5) / mult
  
end -- function round
mckulz
Posts: 1
Joined: May 13th, 2012, 1:57 am

Re: LuaTorrent3

Post by mckulz »

Hi, I run utorrent on a remote computer, would it be possible to edit out the parts that need utorrent.exe?
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: LuaTorrent3

Post by smurfier »

It seems your skin is broken with uTorrent 3.1.3.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

smurfier wrote:It seems your skin is broken with uTorrent 3.1.3.
I'm on 3.1.3 (build 27167) and it is working fine.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: LuaTorrent3

Post by smurfier »

It's working now. For some reason it just wasn't connecting to the page for a while.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
HorstG
Posts: 1
Joined: September 7th, 2011, 8:34 pm

Re: LuaTorrent3

Post by HorstG »

Verry god

Geschrieben mit badaBoard!
elspag
Posts: 1
Joined: May 18th, 2012, 7:39 pm

Re: LuaTorrent3

Post by elspag »

Is there any chance of making it to show the ETA?? with that it would be a perfect meter!
User avatar
Mr. Spock
Posts: 46
Joined: August 5th, 2013, 6:07 pm
Location: The Netherlands

Re: LuaTorrent3

Post by Mr. Spock »

Need some help

I want to use this skin as a pop-up skin when you mouse over it.

Code: Select all

MouseOverAction=!RainmeterToggleMeterGroup Tor
MouseLeaveAction=MouseLeaveAction=!HideMeterGroup Tor
Just hide the top bar but not the torrent part
And yes everywhere i put

Code: Select all

Hidden=1
Group=Tor
even treid

Code: Select all

MouseOverAction=!RainmeterToggleMeterGroup Tor
MouseLeaveAction=!RainmeterRefresh
That hide it for e few seconds and the it return without the topbar
How can i make it hidden untill i mouse over again

Thx for the help
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

The hiding / showing is an integral part of the Lua code that really controls things. The top bar is always visible, and the torrent section, the "body", is made visible and sized based on the number of active torrents, up to 5, you currently have working.

It's never going to be as simple as slapping a MouseOverAction on the top bar and hiding the background and all the "torrent" meters, as the Lua is just going to make them visible again in a second or two.

You are probably going to have to have the MouseOverAction set some "MouseIsCurrentlyOver=0/1" variable, that you have the Lua read on each Upadate(). Then have a decision in the Lua that evaluates that variable and decides to either use the normal hide / show behavior, or some other behavior.

Update: So in the skin .ini file if you:

add
IsMouseOff=1
to the [Variables] section

and add
MouseOverAction=[!SetVariable IsMouseOff "0"][!CommandMeasure MeasureLua "Update()"]
MouseLeaveAction=[!SetVariable IsMouseOff "1"][!CommandMeasure MeasureLua "Update()"]
to the [MeterTopBackground] section

Then in the .lua file:

change to add

Code: Select all

function Update()

	IsRunning = RunningState:GetValue()
	isMouseOff = SKIN:GetVariable('IsMouseOff')
	
	if tonumber(isMouseOff) == 1 then
		SKIN:Bang("!HideMeterGroup Body")
		for i = 1, 5 do
			SKIN:Bang("!HideMeterGroup Torrent"..i)
		end
		return IsRunning
	end
At the top of the Update() function

Then the default behavior will "hide" the body background and torrent meters. When you mouse over the top bar, the body background and torrent meters will be shown.

BTW, don't use the "Rainmeter" prefix on bangs, you green-blooded Hobgoblin... That has been deprecated and isn't needed.

!RainmeterToggleMeterGroup
!ToggleMeterGroup
User avatar
Mr. Spock
Posts: 46
Joined: August 5th, 2013, 6:07 pm
Location: The Netherlands

Re: LuaTorrent3

Post by Mr. Spock »

BTW, don't use the "Rainmeter" prefix on bangs, you green-blooded Hobgoblin... That has been deprecated and isn't needed.
Oke master sorry I'm just a noob who wants to learn :D
Thx for the help