[Console] filenames truncated when getting torrent details

General support for problems installing or using Deluge
Post Reply
jooks
New User
New User
Posts: 3
Joined: Thu Nov 14, 2024 11:18 pm

[Console] filenames truncated when getting torrent details

Post by jooks »

I am intending to write an execute script that needs the file names from a torrent that gets added, hopefully before it starts to download. Specifically, I'll be looking at the file extension.

I believe that the best, if not only, way to get the file list for a torrent is via the deluge-console info command, however, the filenames are truncated in the return from the console. I added a bunch of characters to the file name, so that it should read "rescuezilla-2.5.1-64bit.noble.adding.stuff.to.make.a.longer.filename.iso", but as you can see from the snippet below, that is not the case.
deluge-console -c /config "info -d rescuezilla-2.5.1-64bit.noble"
Name: rescuezilla-2.5.1-64bit.noble
ID: 2d9470dceef6a4f1ba6ce29bd420e037856f330a
State: Paused
Size: 0 B/1.3 G Downloaded: 0 B Uploaded: 0 B Share Ratio: -1.00
ETA: - Seeding: - Active: -
Last Transfer: ∞ Complete Seen: Never
Tracker: opentrackr.org
Tracker status: Announce OK
Progress: 0.00% [------------------------------------------------------------]
Download Folder: /downloads/incomplete/
Label:

Files in torrent
rescuezilla-2.5.1-64bit.noble
rescuezilla-2.5.1-64bit.noble.adding.stuf (1.3 GiB) 0.00% Priority: Normal
Connected peers
None
Is there another, better way of getting this information, or is this a bug that might simply need to be fixed?

Thanks!
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Console] filenames truncated when getting torrent details

Post by ambipro »

You would be able to get the full name from the JSON RPC, as well as the files list.

web.get_torrent_status and web.get_torrent_files would be of particular use for you.

You can check the network tab of the developer tools in the browser while viewing the webui to see these API calls and their endpoints and payloads.

Examples from there below.

Code: Select all

{"method":"web.get_torrent_status","params":["9e9575f43.....949ba8bb3ec941",["total_done","total_payload_download","total_uploaded","total_payload_upload","next_announce","tracker_status","num_pieces","piece_length","is_auto_managed","active_time","seeding_time","time_since_transfer","seed_rank","last_seen_complete","completed_time","owner","public","shared","queue","name","total_wanted","state","progress","num_seeds","total_seeds","num_peers","total_peers","download_payload_rate","upload_payload_rate","eta","ratio","distributed_copies","is_auto_managed","time_added","tracker_host","download_location","last_seen_complete","total_done","total_uploaded","max_download_speed","max_upload_speed","seeds_peers_ratio","total_remaining","completed_time","time_since_transfer"]],"id":58}

Code: Select all

{"method":"web.get_torrent_files","params":["9e9575f43.....949ba8bb3ec941"],"id":59}
You can simply use curl or something to do the authentication and query if you need this.

As far as the console, that's more mhertz's bag and I'm not entirely sure about whether its truncation is hardcoded or based on terminal size or what.
jooks
New User
New User
Posts: 3
Joined: Thu Nov 14, 2024 11:18 pm

Re: [Console] filenames truncated when getting torrent details

Post by jooks »

Gotcha. I thought the same about the terminal window size and am using it maximized. I'm not positive if there's something else that would be at play, but that has helped with other things in the past. I'd expect using grep to get the file extension would work in that case still though...

In the mean time, I'll give the json api a shot tomorrow. For some reason I thought I needed to enable the plug in, and it was not allowing me to do so. I see now that I do not need to do that and have been able to poke at it a bit.
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Console] filenames truncated when getting torrent details

Post by ambipro »

I can whip up a python script for you to do it all if that would be suitable for you, you'd just need the requests module installed in the venv or whatever.

Just tell me what you're trying to do exactly so I can make it usable from a CLI.

If you know python yourself, this is a barebones script that authenticates and reconnects the webui to the daemon, it wouldn't take much to edit it for your purposes if you fill me in on your goals.

https://gist.github.com/zakkarry/5a64fe ... bb8f4c9008
jooks
New User
New User
Posts: 3
Joined: Thu Nov 14, 2024 11:18 pm

Re: [Console] filenames truncated when getting torrent details

Post by jooks »

I appreciate the offer, but I've already got something started up in bash. I do know python and might move it over there to shake off some of the rust. I enjoy writing these things up :D

Thanks again for the help!
User avatar
ambipro
Moderator
Moderator
Posts: 672
Joined: Thu May 19, 2022 3:33 am
Contact:

Re: [Console] filenames truncated when getting torrent details

Post by ambipro »

No problem, glad to be of service.
Post Reply