It is currently May 8th, 2024, 8:42 pm

Adding Speed Rate to Omnimo uTorrent Skin

Get help with creating, editing & fixing problems with skins
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

Hi,

This is sort of to do with my other thread here http://rainmeter.net/forum/viewtopic.php?f=5&t=6721 but but my question is a lot more specific and should be easy to answer without knowing particularly about Omnimo.

Since asking in that other thread, I sent an email to the authors of Omnimo but haven't got a reply since. So I decided to look into the code and teach myself some of it.

I have succeeded in everything I wanted to do in my last thread except one thing:

To display the download rate (speed) of each torrent.

I just cannot seem to get it to display the right string.

Here is the WebUI. Notice the download and upload have no string. I am not sure what String 9 is but I don't think it relates to my question.


Code: Select all

[SP1]
	Measure=Plugin
	Plugin=Plugins\WebParser.dll
	Url=[ITEM1]
	StringIndex=6
[SP1C]
	Measure=calc
	Formula=SP1
	Substitute="0.0":"0"
This is from an alternate uTorrent skin that can be downloaded.

It appears to correspond to this (notice Text= %1B/s) , hence SP=speed.

Code: Select all

[P1]
MeasureName=SP1C
Meter=String
MeterStyle=Style
StringAlign=RIGHT
X=(#Height#/0.54)
Y=(#Height#/5)
W=(#Height#/0.565)
H=(#Height#/10)
FontSize=(ROUND(#Height#/21.429))
FontColor=#textcolor2#,235
ClipString=1
DynamicVariables=1
Text=%1B/s
NumOfDecimals=1
Autoscale=1
Group=1
Hidden=1
This then appears to be this:



But, I copied and pasted

Code: Select all

[SP1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[WebUI]
StringIndex=6

[SP1C]
Measure=calc
Formula=SP1
Substitute="0.0":"0"
into the skin I am using and incorporated the second code into

Code: Select all

[DWSP1]
MeasureName=SP1C
Meter=String
MeterStyle=Style
StringAlign=RIGHT
X=(#height1#/0.535)
Y=(#height1#/2.3)
W=(#height1#/0.565)
H=(#height1#/10)
FontSize=(ROUND(#height1#/21.429))
FontColor=255,255,255,235
Text="%1B/s"
ClipString=1
DynamicVariables=1
Group=1
NumOfDecimals=1
Autoscale=1

The problem is this leads it to show how much has been downloaded, not the speed.


I used this to my advantage to make this:

Code: Select all

[Amount1]
MeasureName=SP1C
MeasureName2=Size1C
Meter=String
MeterStyle=Style
X=(#height1#/13.636)
Y=(#height1#/2.3)
W=(#height1#/0.565)
H=(#height1#/10)
FontSize=(ROUND(#height1#/21.429))
FontColor=255,255,255,235
Text="#Torrent1Text2#"
ClipString=1
DynamicVariables=1
ToolTipText="ETA [ETA1H]h [ETA1M]m [ETA1S]s"
Group=1
NumOfDecimals=2
Autoscale=1


So, I need to know how to edit SP1C to get it to display speed instead of size. Then when I know what needs to be alternated, I can duplicate SP1C (SP1, SP1C, SP2, SP2C, etc) and edit those so that I still can display it as size (as well).



One other and less important thing I want to say is for some reason, the skin will not display any torrents unless I have at least 2. And if I DO have at least 2, it will only display the first one.

For example:
I add one torrent. Nothing displays.
I add another torrent. The first one displays ONLY, not the second.
I add another torrent. The first and second display, not this one (the third).

But my first question is more important so I would appreciate you focus on that first.


Here is the complete skin code

Code: Select all

[Rainmeter]
MouseOverAction=!execute [!RainmeterShowMeter btn1][!RainmeterShowMeter size][!RainmeterShowMeter About][!RainmeterShowMeter MeterSettings1][!RainmeterShowMeter MeterMenu][!RainmeterShowMeter MeterClose][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter btn1][!RainmeterHideMeter size][!RainmeterHideMeter About][!RainmeterHideMeter MeterSettings1][!RainmeterHideMeter MeterMenu][!RainmeterHideMeter MeterClose][!RainmeterRedraw]
MouseActionCursor=0
MiddleMouseUpAction=!RainmeterDeactivateConfig

;Metadata added by RainBrowser
;http://rainmeter.net/cms/Rainmeter101-EditingSkins

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Author=Xyrfo and fediaFedia
License=
Variant=
Preview=

;End of added Metadata

[Variables]
@include=#SKINSPATH#\WP7\Common\Variables\UserVariables.inc
@include2=#SKINSPATH#\WP7\Panels\uTorrent\UserVariables.inc
@include3=#CURRENTPATH#\size.inc
@include4=#SKINSPATH#\WP7\Common\color\color.inc
REG=(?(?=.*\[\"(.*)\").*,(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),.*,.*,(.*),\".*\",(.*),(.*),(.*),(.*),.*,.*,(.*)],).*
Command1=pause
Command2=pause
Command3=pause
Command4=pause
TorrentSeeding2=Completed
TorrentFinished2=Finished
TorrentPaused2=Paused
TorrentDownloading2=Downloaded %1B of %2B
Torrent1Text2=
Torrent2Text2=
Torrent3Text2=
Torrent4Text2=
height1=350


[feedstitle]
Meter=STRING
Antialias=1
Text=
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

It's a simple question! What is the code to display utorrent's download rate?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by jsmorley »

Here is some info about the format of the web UI for uTorrent 2.x (not 3.x)

Code: Select all

(?siU)torrents\":.*(?(?=.*\[\").*\[\"(.*)\",(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),(.*),(.*)\])

01=> 85635A8692B6ABAE17DA3EEC36BED5B52CE1BF3C
02=> 201
03=> The Tree 2010 BRRip [H264 Masta]
04=> 1346919573
05=> 41
06=> 55368853
07=> 134168576
08=> 2423
09=> 273455
10=> 85917
11=> 24176
12=> 
13=> 40
14=> 1327
15=> 6
16=> 165
17=> 851866
18=> 1
19=> 1291550720

To get the list of all torrents, request http://[IP]:[PORT]/gui/?list=1 . This will return the torrents in the following fashion:

{
				"build": BUILD NUMBER (integer),
				"label": [
				[
				LABEL (string),
				TORRENTS IN LABEL (integer)				],
				...
				],
				"torrents": [
				[
01				HASH (string),
02				STATUS* (integer),
03				NAME (string),
04				SIZE (integer in bytes),
05				PERCENT PROGRESS (integer in per mils),
06				DOWNLOADED (integer in bytes),
07				UPLOADED (integer in bytes),
08				RATIO (integer in per mils),
09				UPLOAD SPEED (integer in bytes per second),
10				DOWNLOAD SPEED (integer in bytes per second),
11				ETA (integer in seconds),
12				LABEL (string),
13				PEERS CONNECTED (integer),
14				PEERS IN SWARM (integer),
15				SEEDS CONNECTED (integer),
16				SEEDS IN SWARM (integer),
17				AVAILABILITY (integer in 1/65535ths),
18				TORRENT QUEUE ORDER (integer),
19				REMAINING (integer in bytes)				],
				...
				],
				"torrentc": CACHE ID** (string integer)				}
			


* STATUS: The STATUS is a bitfield represented as integers, which is obtained by adding up the different values for corresponding statuses:

    1 = Started
    2 = Checking
    4 = Start after check
    8 = Checked
    16 = Error
    32 = Paused
    64 = Queued
    128 = Loaded
	
	For example, if a torrent job has a status of 201 = 128 + 64 + 8 + 1, then it is loaded, queued, checked, and started. A bitwise AND operator should be used to determine whether the given STATUS contains a particular status.
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

That suggests Download Speed is String 10 yet on mine, Peers Connected is String 10. I have uTorrent 2.2.1 beta
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by jsmorley »

Pretty sure that info I gave you is accurate for uTorrent 2.x. First, it's from a uTorrent web site, and second, It works great in a skin I wrote myself and use every day.
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

Code: Select all

[PeersConnected1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[WebUI]
StringIndex=10
The original skin authors wrote this.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by jsmorley »

StringIndex is a very relative thing that depends on how you write the RegExp. Basically if you look at the RegExp statement and count the occurrences of "(.*)" you can count it out. What I copied in is every field in the output, and what position in the output it is.
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

Yes I thought that might have been it.

This is the REG code from the skin I am trying to edit

Code: Select all

REG=(?(?=.*\[\"(.*)\").*,(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),.*,.*,(.*),\".*\",(.*),(.*),(.*),(.*),.*,.*,(.*)],).*
And this is from the skin which properly shows the speed.

Code: Select all

RegExp="(?siU)\"torrents\": \[\n(?:\n|\]|)#REGEX1##REGEX1##REGEX1##REGEX1##REGEX1##REGEX1#"
The items also make reference to "#REGEX2#". I am unfamiliar with numbers in the REG code. Could you post your code?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by jsmorley »

[Variables]
uTorrentURL=http://#UserName#:#Password#@127.0.0.1:#uTorrentPort#/gui/?list=1
Item=(?(?=.*\[\").*\[\"(.*)\",(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*),\"(.*)\",(.*),(.*),(.*),(.*),(.*),(.*),(.*)\])

[MeasureWebUI]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=#uTorrentURL#
RegExp="(?siU)torrents\":.*#Item##Item##Item##Item##Item#"
UpdateRate=2

Every place in the RegExp where there is a (.*) is a "StringIndex". Then you can match up with the list I posted earlier to see what is what.
DevourOfDarkness
Posts: 16
Joined: January 28th, 2011, 3:53 am

Re: Adding Speed Rate to Omnimo uTorrent Skin

Post by DevourOfDarkness »

Thank you so much! It works perfectly now so I guess my regexp was skipping the download/upload speeds.

I'd appreciate it if you'd help me with that other problem:

Before I made the changes you posted, the display of torrents was how I described it in my first post eg. Add 3 to get the first two showing up. I didn't play around with the skin today but the previous problem has changed.

I have two torrents active. The first is still there as before, but now it looks like it is attempting to show the second but the title is a string of numbers that weren't the hash and other meters are incorrect. Whats also strange is it is showing a percentage of completion on the third line but I have no third torrent. I don't think the values were changing. I only glanced at all this because I had to go out and have not been back on since. I'm using my iPhone.

Also, something I noticed much before I used your code was, while testing, I had 5 torrents to check all 4 were displaying correctly (1 extra needed as said above) and they were. Then I removed 3 so I could just see one and yet values on the others lines just changed to 0 but didn't actually disappear. It's like it still thinks the torrents are active but of course can't get their stats. (You can see this in the last screenshot from the first post. I have a feeling this relates to what I said above, a third torrent being shown (no name though) even though I am downloading 2. The percentage on it is actually the same value it was on the torrent I previously had running there before I removed it. Again, it's like it's not updating.



Anyway, I'm on my iPhone as I said so I can't post the code or a screenshot but when I go back, if I still can't figure this out I will post them.

Maybe you could look at the code in my first post and determine why it would only shoew one less than the total number of torrents, or why it doesn't hide those zeros. I wonder if it has something to do with the

Code: Select all

Hidden= 1
(or similar) line which I removed. And first problem was probably due to that regexp -.- If so, it should have been fixed with your code. I will see.


But yeah, thanks so much! Was stuck for ages.