Ran into problem with APIs

What is the problem you are having with rclone?

I'm not a native English speaker, so please pardon my grammar.
I am trying to build an OpenWrt web GUI to set up DLNA service with rclone, but I have run into problems with the APIs. When I send the APIs with rclone rc or HTTP directly. While the service was setup, instead of getting a response, the rclone/cURL process just kept waiting. If I end those processes, the DLNA service was terminated. This means that if I need to set up a DLNA/HTTP/FTP service, I might need another process aside from the existing rclone daemon. This seems to go against the purpose of the APIs. Are there any workarounds for this issue?"
And I found something interesting in the LOG file that if I keep the rclone rc or curl process running,
there would be no more new entries after the rc: "core/command": until I terminate the rclone/curl process
I suspect that this is a bug in the rcd reply procedure.

Run the command 'rclone version' and share the full output of the command.

rclone v1.62.2

  • os/version: openwrt 22.03.0-rc6 (64 bit)
  • os/kernel: 5.10.134 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone rc core/command -a serve \
					-a dlna \
					-a "Remote:/" \
					-a "-vv" \
					-o name="DLNA Server" \
					-o addr="192.168.1.1:7876" \
					-o vfs-cache-mode=off \
					-o rc-user=admin \
					-o rc-pass=admin \
					-o config="/etc/rclone/rclone.conf" 

or

curl -X POST 'http://admin:admin@localhost:5572/core/command?command=serve&arg=\["-vv","dlna","Remote:/"\]&opt=\{"name":"DLNA Server","addr":"192.168.1.1:7876","vfs-cache-mode":"off","config":"/etc/rclone/rclone.conf"\}'

The rclone config contents with secrets removed.

Paste config here

A log from the command with the -vv flag

Logs before I terminate the rclone rc / curl process:

2023/04/02 16:15:52 DEBUG : rc: "core/command": with parameters map[_request:0xc00065cc00 _response:0xc0002a01c0 arg:["dlna","Remote:/","-vv"] command:serve opt:{"name":"DLNA Server","addr":"192.168.1.1:7876","vfs-cache-mode":"off","config":"/etc/rclone/rclone.conf"}]

Logs after :

2023/04/02 16:30:02 DEBUG : rc: "core/command": reply map[error:true result:2023/04/02 16:23:47 DEBUG : rclone: Version "v1.62.2" starting with parameters ["/usr/bin/rclone" "serve" "dlna" "Remote:/" "-vv" "--name" "DLNA Server" "--addr" "192.168.1.1:7876" "--vfs-cache-mode" "off" "--config" "/etc/rclone/rclone.conf"]
2023/04/02 16:23:47 DEBUG : Creating backend with remote "Remote:/"
2023/04/02 16:23:47 DEBUG : Using config file from "/etc/rclone/rclone.conf"
2023/04/02 16:23:47 DEBUG : found headers:
2023/04/02 16:23:47 DEBUG : fs cache: renaming cache item "Remote:/" to be canonical "Remote:"
2023/04/02 16:23:47 INFO  : webdav root '': poll-interval is not supported by this remote
2023/04/02 16:23:47 NOTICE: webdav root '': --vfs-cache-mode writes or full is recommended for this remote as it can't stream
2023/04/02 16:23:47 NOTICE: webdav root '': Serving HTTP on 192.168.1.1:7876
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876: Started SSDP on eth2
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on eth2
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876: Started SSDP on pppoe-wan
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876: Started SSDP on eth0
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on pppoe-wan
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876: Started SSDP on eth3
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on eth3
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on eth0
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876: Started SSDP on br-lan
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on br-lan
2023/04/02 16:23:47 NOTICE: DLNA server on 192.168.1.1:7876 Started SSDP on eth1
2023/04/02 16:23:47 INFO  : DLNA server on 192.168.1.1:7876: Started SSDP on eth1
2023/04/02 16:25:40 INFO  : /static/rclone-48x48.png: 192.168.1.111:52015 GET 200
2023/04/02 16:25:40 INFO  : /static/rclone-120x120.png: 192.168.1.111:52015 GET 200
2023/04/02 16:25:40 INFO  : /static/X_MS_MediaReceiverRegistrar.xml: 192.168.1.111:52015 GET 200
2023/04/02 16:25:40 INFO  : /ctl: 192.168.1.111:52016 POST 200 "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1#IsAuthorized"
2023/04/02 16:25:40 INFO  : /static/ContentDirectory.xml: 192.168.1.111:52017 GET 200
2023/04/02 16:25:40 INFO  : /static/ContentDirectory.xml: 192.168.1.111:52019 GET 200
2023/04/02 16:25:41 INFO  : /ctl: 192.168.1.111:52019 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
2023/04/02 16:26:53 INFO  : /static/X_MS_MediaReceiverRegistrar.xml: 192.168.1.111:52091 GET 200
2023/04/02 16:26:53 INFO  : /ctl: 192.168.1.111:52094 POST 200 "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1#IsAuthorized"
2023/04/02 16:26:53 INFO  : /static/ContentDirectory.xml: 192.168.1.111:52096 GET 200
2023/04/02 16:26:53 INFO  : /static/ContentDirectory.xml: 192.168.1.111:52097 GET 200
2023/04/02 16:27:03 INFO  : /ctl: 192.168.1.111:52050 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
2023/04/02 16:27:03 DEBUG : DLNA server on 192.168.1.1:7877: unrecognized file type: docs/price.docx
2023/04/02 16:27:03 INFO  : /ctl: 192.168.1.111:52067 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
2023/04/02 16:27:03 INFO  : /ctl: 192.168.1.111:52019 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
2023/04/02 16:27:03 INFO  : /ctl: 192.168.1.111:52074 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"
2023/04/02 16:27:03 DEBUG : DLNA server on 192.168.1.1:7877: unrecognized file type: docs/price.docx
2023/04/02 16:27:03 INFO  : /ctl: 192.168.1.111:52073 POST 200 "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"

Ah, you are using core/command which is not very good code.

It runs another copy of rclone rather than using the internal APIs of rclone. Here it is running rclone serve dlna which never returns.

Ideally we'd make a serve/dlna remote control API but we haven't done that yet.

You can probably work-around your problem using the _async=true parameter. The job will then run in the background.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.