It is currently April 23rd, 2024, 8:56 am

LuaTorrent3

RSS, ATOM and other feeds, GMail, Stocks, any information retrieved from the internet
handsforfeet
Posts: 7
Joined: March 21st, 2012, 2:16 am

Re: LuaTorrent3

Post by handsforfeet »

I do have a question though.

My skin has an extra bit of background below the torrent's. See image.
Image

I have tried adjusting the "BackgroundHeight=230" variable to lower numbers, but this has not resolved the problem. It did this in both iterations I got to work. Thoughts?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

handsforfeet wrote:I do have a question though.

My skin has an extra bit of background below the torrent's. See image.

I have tried adjusting the "BackgroundHeight=230" variable to lower numbers, but this has not resolved the problem. It did this in both iterations I got to work. Thoughts?
Open up the .lua file in the folder and above the line:

for i = 1, iItemCount do

Add the line:

iItemCount = (iItemCount < 6) and iItemCount or 5

So you will have:

Code: Select all

		iItemCount = (iItemCount < 6) and iItemCount or 5
		for i = 1, iItemCount do
Save and refresh the skin.
handsforfeet
Posts: 7
Joined: March 21st, 2012, 2:16 am

Re: LuaTorrent3

Post by handsforfeet »

That fix didn't work for me, but I was able to get it working after you pointed me in the right direction of where the fix would be.

end

SKIN:Bang("!EnableMeasureGroup AllMeasures")
if iItemCount == 0 then
SKIN:Bang("!HideMeterGroup Body")
else
SKIN:Bang("!ShowMeterGroup Body")
end

SKIN:Bang("!SetVariable BackgroundHeight "..tostring(iItemCount * 15))

if iItemCount < 5 then
for i = iItemCount + 1, 5 do
SKIN:Bang("!HideMeterGroup Torrent"..i)
end
end

Right above where your solution was implemented, I changed the BackgroundHeight from 31 to 15. Thanks again for your help and for the awesome skin.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

That is actually not going to work right. There are two places with that for i = 1, iItemCount do construct or some variant of it, and you found the second one. I meant the first.

In any case, if you just replace the entire LuaTorrent3.1.lua file with:

Code: Select all

function Initialize()
	
	tItem = {}
	tNumber = {}
	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("MeasureProcess")
	msMain = SKIN:GetMeasure("MeasureWebUI")
	CurrDir = SKIN:GetVariable("CURRENTPATH")
	
end -- function Initialize

function Update()

	IsRunning = RunningState:GetValue()
	
	if IsRunning == 1 then --uTorrent running
	
		Pos = 0
	
		sAllText = msMain:GetStringValue()
		sAllText = string.match(sAllText, ".-\034torrents\034%:(.-)$")
		sTemp, iItemCount = string.gsub(sAllText, ".-%[\"(.-)\"%]", "")
		
		iItemCount = (iItemCount < 6) and iItemCount or 5
		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], '%[\"(.-)\",(.-),\"(.-)\",(.-),(.-),(.-),(.-),(.-),(.-),(.-),(.-),\"(.-)\",(.-),(.-),(.-),(.-),(.-),(.-),(.-),\"(.-)\",\"(.-)\",\"(.-)\",\"(.-)\",(.-),(.-),\"(.-)\",\"(.-)\".-%]')
			
			tNumber[i] = i
		
			tTEXTSTATUS[i] = string.gsub(tTEXTSTATUS[i], "Downloading", "Download")
			tSAVEFOLDER[i] = string.gsub(tSAVEFOLDER[i], "\092\092", "\092")
			
			SKIN:Bang("!ShowMeterGroup Torrent"..i)
			SKIN:Bang("!SetOption Meter"..i.."Name Text \""..tNAME[i].."\"")
			SKIN:Bang("!SetOption Meter"..i.."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"..i.."Size Text \""..round(tonumber(tSIZE[i]/1048576),0).." Mb\"")
			SKIN:Bang("!SetVariable Bar"..i.."Calc \""..math.floor(tonumber(tPERCENTPROGRESS[i]/10)).."\"")
			SKIN:Bang("!SetOption Meter"..i.."\% Text \""..math.floor(tonumber(tPERCENTPROGRESS[i]/10)).." \%\"")
			if round(tonumber(tDOWNLOADSPEED[i]/1024),0) <= 0 then
				SKIN:Bang("!SetOption Meter"..i.."DLSpeed FontColor \""..sGreyColor.."\"")
			else
				SKIN:Bang("!SetOption Meter"..i.."DLSpeed FontColor \""..sNormalColor.."\"")
			end	
			SKIN:Bang("!SetOption Meter"..i.."DLSpeed Text \""..round(tonumber(tDOWNLOADSPEED[i]/1024),0).." k/Bs\"")
			
			SKIN:Bang("!SetOption Meter"..i.."Seeds Text \""..tSEEDSCONNECTED[i].."("..tSEEDSINSWARM[i]..")\"")
			SKIN:Bang("!SetOption Meter"..i.."Status Text \""..tTEXTSTATUS[i].."\"")			
		
		end -- for iItemCount
		
		SKIN:Bang("!EnableMeasureGroup AllMeasures")
		if iItemCount == 0 then
			SKIN:Bang("!HideMeterGroup Body")
		else	
			SKIN:Bang("!ShowMeterGroup Body")
		end
		
		SKIN:Bang("!SetVariable BackgroundHeight "..tostring(iItemCount * 31))
		
		if iItemCount < 5 then
			for i = iItemCount + 1, 5 do
				SKIN:Bang("!HideMeterGroup Torrent"..i)
			end	
		end
		
	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
It should work fine.
handsforfeet
Posts: 7
Joined: March 21st, 2012, 2:16 am

Re: LuaTorrent3

Post by handsforfeet »

Now I'm interested, because I can't seem to get your version to work.



My version is on the left, with only the "15" from "31" adjustment. Your version is on the right, copy/pasted into the LuaTorrent3.1 file.

Should I have changed any corresponding values in the skin's .ini?
Last edited by smurfier on March 21st, 2012, 1:56 pm, edited 1 time in total.
Reason: Edited to use HSimg tags.
handsforfeet
Posts: 7
Joined: March 21st, 2012, 2:16 am

Re: LuaTorrent3

Post by handsforfeet »

Alright, you are correct. Just as I posted my reply i realized I wasn't actually downloading anything: there is the problem.

So my change only displays the client's downloaded information, making it worthless. Are you able to get it to work on your end with your reworked code?

Edit: and now I can't get it to recognize anything I'm downloading... challenge accepted, but for later today... I'll try sorting things out on my end this afternoon. I'm more than confident that I am having issues and that your code works.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

With all the testing, you may have gotten either WebParser or the WebUI for uTorrent hung up. I've seen that before. Try manually running uTorrent then exiting it it, then exit and restart Rainmeter. Now launch the skin and see if it works ok. If not, give a reboot a try to see if that fixes it.

I'll put out a full blown .rmskin version of the skin on deviantART today with that fix for the background when you have more than 5 torrents going. That way we can be sure you and I are on the same page. I'll post here with a link when I have it up. It works fine here.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: LuaTorrent3

Post by jsmorley »

handsforfeet
Posts: 7
Joined: March 21st, 2012, 2:16 am

Re: LuaTorrent3

Post by handsforfeet »

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.
vipe7
Posts: 13
Joined: February 14th, 2012, 11:21 pm

Re: LuaTorrent3

Post by vipe7 »

So is it possible if Status is Seeding just miss this torrent?
I want to view only downloading torrents, is this possible?