rpc: renaming single file using curl

General support for problems installing or using Deluge
Post Reply
mr.lite.touch
New User
New User
Posts: 7
Joined: Sun Jun 02, 2019 3:30 am

rpc: renaming single file using curl

Post by mr.lite.touch »

I'm trying to rename a single file in a torrent using curl but getting an error. My goal is to replace spaces in filenames for periods.

Code: Select all

curl -s -d '{"method": "core.rename_files", "params": ["<torrent_id>",["1","<new_file_name>"]], "id": 1}' -K curl.cfg
curl.cfg contents:

Code: Select all

insecure
request = "POST"
compressed
cookie = "cookie_deluge.txt"
cookie-jar = "cookie_deluge.txt"
header = "Content-Type: application/json"
header = "Accept: application/json"
url = "https://localhost:8112/json"
write-out = "\n"
Error in deluge-web.log:

Code: Select all

--------------------------------------------------------------------------------
[ERROR   ] 18:58:11 client:391 RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: core.rename_files(<torrent_id>, [u'1', u<new_file_name>'])
--------------------------------------------------------------------------------
  File "/volume2/@appstore/deluge/env/lib/python2.7/site-packages/deluge-1.3.15-py2.7.egg/deluge/core/rpcserver.py", line 301, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/volume2/@appstore/deluge/env/lib/python2.7/site-packages/deluge-1.3.15-py2.7.egg/deluge/core/core.py", line 717, in rename_files
    self.torrentmanager[torrent_id].rename_files(filenames)
  File "/volume2/@appstore/deluge/env/lib/python2.7/site-packages/deluge-1.3.15-py2.7.egg/deluge/core/torrent.py", line 1036, in rename_files
    for index, filename in filenames:

ValueError: need more than 1 value to unpack
--------------------------------------------------------------------------------
I figure my syntax is off, but I've tried multiple variations and can't seem to get it working. Thanks!
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: rpc: renaming single file using curl

Post by Cas »

The method signature is a list of lists for filenames

https://deluge.readthedocs.io/en/latest ... e/api.html

Code: Select all

curl -s -d '{"method": "core.rename_files", "params": ["<torrent_id>",[["1","<new_file_name>"]]], "id": 1}' -K curl.cfg
Post Reply