Page 1 of 1

torrent id assignation policy

Posted: Sun Dec 17, 2017 5:54 am
by mhyst
Hi!

I am not new on transmission, but I am new on this forum.
I am working in some scripts that communicate with transmission daemon through transmission-remote command. It works so far, so I'm not complaining about it. But for my current script (bash) I need a simple way to obtaining the id of the torrent I just added. Transmission doesn't help much, because it just confirms success. It would be good if it instead or additionaly would return the new id. But anyway, are torrent id's realiable for long periods? I plan to register either id or hash into a database for future handling and it seems to me that id's change with the time. Are torrent id's reused?

OK, another thing. May I assume that the last id for the newly inserted torrent is always the bigger number in the list? Anyway, relying on list browsing is not very efficient. Even if I load it once, if would be better if a successful "--add" would return the id or should it be marked somehow as current torrent and then a "--info" call would yield the results I need.

Any leads?

Thank's in advance

Re: torrent id assignation policy

Posted: Sun Dec 17, 2017 6:21 am
by mhyst
So to explain it better: with this command I get the max value for ID:
transmission-remote 192.168.0.234:9091 --auth user:pass -l | awk -f filtro.awk

The awk program is very simple:

Code: Select all

BEGIN {
	max=0
}

{
	if ($1 == "Sum:" || $1 == "ID")
		next

	if ($1 > max)
		max=$1
}

END {
	print max
}