Ticket #2231 (new defect)

Opened 3 years ago

Last modified 3 years ago

Bug in the multicall parser

Reported by: exterminator Owned by: rakshasa
Priority: normal Component: rtorrent
Version: Severity: normal
Keywords: multicall parser Cc:

Description

d.set_custom commands can't be used with t.multicall

On a selected torrent, this works:

X: t.multicall=$d.get_hash=print=$t.get_url=

this fails:

X: t.multicall=$d.get_hash=d.set_custom1=$t.get_url=

Change History

comment:1 Changed 3 years ago by exterminator

Sorry I made a typo: Here are the commands again:

Works:

^X: t.multicall=$d.get_hash=,,print=$t.get_url=

Fails:

^X: t.multicall=$d.get_hash=,,d.set_custom1=$t.get_url=

comment:2 follow-up: ↓ 3 Changed 3 years ago by anonymous

Well, it certainly won't work, because under t.multicall= the focus is on the tracker, not the download. Same thing applies to f.multicall=. Basically, commands don't go to upper container of the focus.

But if it ever worked, it will give you only the last tracker's url, because everything else will be overwritten. Is that your intention? (Also note that ?.multicall= commands don't take the first hash argument, unlike when invoked via XMLRPC interface.)

Alternatively, it works if you move d.*= commands out of other multicalls, i.e.

d.set_custom1="$cat=\"$t.multicall=,\\\"t.get_url=\\\"\""

In this case all the tracker's url will be concatenated without any delimiters; if you need one, put another ,cat=something right after t.get_url=. Or if you want only one tracker, do branch= in t.multicall= to skip unneeded ones.

comment:3 in reply to: ↑ 2 Changed 3 years ago by anonymous

it will give you only the last tracker's url

which is always dht://, unless you set dht=disabled or torrent's info had private:1.

comment:4 follow-up: ↓ 5 Changed 3 years ago by dso

Interesting. This is useful info.

One thing I've found really confusing is figuring how how many slashes to put before the quotes. It's very confusing. I've been following this rule (it's still almost always a hit-n-miss)

Inner most quotes have the most slashes (odd number), outer quotes must be without a slash... maybe I'm close but I don't know for sure.. When you need to nest multiple commands together that take more than one parameter, it's difficult to figure out where you made a mistake, and rTorrent's error messages aren't really helpful either.

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 6 Changed 3 years ago by anonymous

how many slashes

Basically, double the number of letters including " itself, for each nesting level. I.e. 2n-1 backslash(es) for level n.

... well, you should consider using system.method.insert= before it gets too lengthy :-)

comment:6 in reply to: ↑ 5 Changed 3 years ago by dso

Replying to anonymous:

how many slashes

Basically, double the number of letters including " itself, for each nesting level. I.e. 2n-1 backslash(es) for level n.

... well, you should consider using system.method.insert= before it gets too lengthy :-)

Thanks a lot! This is just what I was looking for.

Note: See TracTickets for help on using tickets.