Opened 8 years ago

Last modified 8 months ago

#1316 assigned feature-request

Implement file/folder renaming in Web UI

Reported by: powtrix Owned by: damoxc
Priority: major Milestone: 2.x
Component: Web UI Version: 1.3.0_dev
Keywords: rename file folder webui Cc: powtrix@…, deluge@…, mathieu@…, alexandernst@…


Hi, a request. please read:

I have a daemon working well and a feature I would like to have via web:

In the File list (add torrent) I want to rename the main torrent structure dir, eg.: /Pics from Mars/ /Pics from Mars/file1.jpg /Pics from Mars/file2.png

I want to rename from "Pics from Mars" to "pics" dir name, to sync my local pictures (for example). The torrents I want to sync are 12gb, 60gb, 150gb.. I need to fix current dir to seed the data (sync to seed).

Please, using this feature via online Deluge will be the best client via web, only this feature is missing!

  • path for each torrent - already implemented
  • rename a main torrent dir to "sync" a local dir as eg. "/My Pics/" (from torrent) to "/pics/"

Thank you for develop Deluge !

Change History (13)

comment:1 Changed 8 years ago by johnnyg

  • Owner changed from powtrix to damoxc
  • Status changed from new to assigned
  • Summary changed from rename a torrent dir to sync local dir -via web to Implement file/folder renaming in Web UI

comment:2 Changed 8 years ago by damoxc

  • Milestone changed from 1.3.0 to 1.4.0

comment:3 Changed 7 years ago by johnnyg

  • Keywords file folder webui added; dir web sync local update removed

comment:4 Changed 7 years ago by johnnyg

  • Cc deluge@… added

comment:5 Changed 6 years ago by mathroc

  • Cc mathieu@… added

comment:6 Changed 6 years ago by bmnot

This is a big deal, and one of the main things preventing the WebUI from being completely standalone.

I am guessing that the reason it has not been added in 2 years is that it's difficult to implement file-naming over the web (when you don't have access to the local filesystem to verify paths, permissions, existing file clobbering, etc).

Well, how about:

  • Implementing a Rename option in the right-click menu for files in the WebUI, which pops up a simple text field, pre-filled with the current filename.
  • Sanitizing the input by disallowing slashes and illegal filename characters in the text field.
  • Doing a JSON-RPC call to ask the daemon "will this requested name (i.e. "new filename.txt") be okay?" and getting a reply like "1:ok, 2:file exists and can be overwritten, 3:file exists and no permission to overwrite"

This gets rid of the need to implement path-moving when renaming a file, and takes care of permissions/clobbering issues.


comment:7 Changed 6 years ago by bmnot

The GTK GUI could use the same piece of code, if the new filename/new folder name check is moved into DelugeRPC instead of the GTK GUI (where I assumed the check is now, since it's taken this long to get it into the WebUI), and DelugeRPC returns something like:

0 = new name OK 1 = new name invalid (illegal characters/too long) 2 = file/folder exists and we have write permissions (file can be overwritten/folders can be merged) 3 = file/folder exists and we have no write permissions

Should be trivial to update the WebUI once this RPC has been added.

comment:8 Changed 9 months ago by Cas

  • Milestone changed from 2.0.x to 2.x

Milestone renamed

comment:9 Changed 9 months ago by alexandernst

  • Cc alexandernst@… added

comment:10 Changed 9 months ago by alexandernst

I'm interested in implementing this. Is anybody working on it or should I start from scratch? Also, should I base my work on 1.3.x or 2.x?

comment:11 Changed 9 months ago by Cas

That would be fantastic, the webui is lagging behind gtkui a bit.

I haven't worked on in but you can use gtkui for inspiration. If there is shared functions or methods put them in ui/

Target develop please

comment:12 Changed 8 months ago by alexandernst

I finally managed to get my eyes through the code! :)

My very first impression: deluge is extremely hard to get working on mac! Luckily, I took notes of the entire process and I'll share it (maybe in a README.mac?).

I spotted where the magic for this FR happens (kudos, code is very clean and predictable), but it's not working as expected. After renaming a file, the UI won't refresh.

This is caused because of name, the last argument of _on_torrentfilerenamed_event, which should be a str, but it's some sort of object (which doesn't happen to behave as a str and the code crashes as soon as it gets to name.split()).

Anyways, I managed to "fix" that by placing name = on the top of that function. That seems to return the correct name and set it to name, but then the UI freezes, and I believe it's because it's busy-waiting for some other event.

Can you confirm that renaming is currently working in GTK UI?

comment:13 Changed 8 months ago by alexandernst

I forgot to mention the version of libtorrent and the git hash of deluge I'm using: 1.1.4_1 and 51b99caf24a3c2e30ed8f0a78fbef8db46d74494

Note: See TracTickets for help on using tickets.