Is there an RPC call to add a label?

General support for problems installing or using Deluge
Post Reply
CarloDeluge
New User
New User
Posts: 3
Joined: Sat Apr 09, 2016 6:54 pm

Is there an RPC call to add a label?

Post by CarloDeluge »

Hi,

I'm using the label plugin and I'm writing my own "client" using python.
How can I add a new label to a torrent? Is there a key 'label' or something?
Cas
Top Bloke
Top Bloke
Posts: 3681
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Is there an RPC call to add a label?

Post by Cas »

This is how the Autoadd plugin adds a label: https://github.com/deluge-torrent/delug ... re.py#L290
CarloDeluge
New User
New User
Posts: 3
Joined: Sat Apr 09, 2016 6:54 pm

Re: Is there an RPC call to add a label?

Post by CarloDeluge »

Hi Cas, thanks for your reply. This doesn't help my case however as I'm not writing a plugin. In the meantime I found out that one can get the value of a label as client with get_torrent_status, using 'label' as the key. I cannot find out how to set this value remotely however. :(

Is there a better place to ask my question?
CarloDeluge
New User
New User
Posts: 3
Joined: Sat Apr 09, 2016 6:54 pm

Re: Is there an RPC call to add a label?

Post by CarloDeluge »

After searching the forum, the only thing I could find about remotely setting labels that seemed to indicate that it was possible were references to that the WebUI wasn't able to set labels and then cas remarking 'I can't reproduce that'... From that I concluded it has at least be possible. So, I installed deluge-web and managed to indeed set remotely a label. Then I hacked deluge-web until I found out how it did that.

The answer to my own question is therefore:
call,

client.label.set_torrent(torrent_id, label)

this means you have to have the plugin installed locally too;
this line causes an RPC call, sending a base64 encoded JSON
string to the server telling it to execute this remotely.
In other words, apparently the whole remote thing is pretty
much hidden from the user and you can just call stuff as if
it was running locally.
Cas
Top Bloke
Top Bloke
Posts: 3681
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Is there an RPC call to add a label?

Post by Cas »

Granted it is a slightly different module call between plugin and client the set_torrent method is the same. Looking at the code for the label plugin would have been quicker: https://github.com/deluge-torrent/delug ... enu.py#L62
Post Reply