Laharah / deluge-FileBotTool

A plugin to integrate simple FileBot functionality into Deluge
GNU General Public License v3.0
114 stars 10 forks source link

could not find index for relative path names #42

Closed xaeiougit closed 4 years ago

xaeiougit commented 4 years ago

Hi,

First, thanks for the great plugin, I've used it a lot over the years.

Recently I was fiddling around trying to make my installation a bit more portable, and tried using relative save paths (rather than absolute paths) for my torrents. This means my save path looks something like "media/SHOW/episode.mkv".

You can easily do this by adding any torrent and leaving the leading slash off the save location. What it will do (under linux at least) is put in in your home directory, ie ~/media/SHOW/episode.mkv

When I tried to use FileBotTool on such a torrent, I get the message "Unhandled error in Deferred: " on the console of the deluged process, and diving into the log what I see is:

[INFO ] 15:54:33 pluginmanagerbase:158 Plugin FileBotTool enabled..
[INFO ] 15:55:09 core:214 [FileBotTool] No movements for 9516ebcf7ce96705e325d9b79d8 [ERROR ] 15:55:16 core:235 [FileBotTool] could not find index for /home/user/media/SHOW/episode.mkv in the torrent, problem with movement matching.

So it appears to be looking for the (actually correct) absolute path, but doesn't find it in the state files.

The file does get renamed, but the plugin just hangs forever (spinning wheel) trying to update the torrent state files to reflect the new name.

Just to check this isn't some problem deep in Deluge/libtorrent, I tried renaming these files using the "BatchRenamerRegEx" plugin instead, and that worked fine both renaming the files and updating the state files. I looked at the state files themselves and torrents.state does contain relative paths (I haven't completely figured out how this works in the binary torrents.fastresume yet, which does seem to contain absolute paths, but that's another story).

Anyway, is there perhaps code in the FileBotTool plugin that assumes absolute paths in torrents.state? It would be great if you could update the plugin to either handle the state file update properly or refuse to rename torrents with a relative path name. Currently it leaves the torrent in a broken state where you have to manually go back and rename the files.

Thanks again for all your hard work in developing and sharing this plugin.

Laharah commented 4 years ago

Just released an update that should at least let the plugin do it's job:

https://github.com/Laharah/deluge-FileBotTool/releases/tag/1.2.7

Let me know if it solves your issue.

Unfortunately, the paths have to be handled as absolute within the plugin because they have to be handed off between processes. If the deluge process and the filebot process get their working directory out of sync (easier to do than I thought), the renames will also be out of sync.

xaeiougit commented 4 years ago

That works great, thanks for such a quick fix!

I noticed the hotfix filename is "FileBotTool-1.2.5-py2.7". I tried changing it to "FileBotTool-1.2.7-py2.7" but this caused installation issues, so I had to leave it at 1.2.5 for now. Is it supposed to be "FileBotTool-1.2.7-py2.7"?

Thanks again.

xaeiougit commented 4 years ago

Unfortunately, the paths have to be handled as absolute within the plugin

Ah, I see what you mean now - after running filebot the storage path is always changed to absolute. This does break portability of the deluge torrent storage tree I was trying to achieve, but is easily fixed by manually running a standard deluge "Move Storage" after running filebot and returning it to a relative path.

Do you think doing a final "was it originally a relative path if so move it back to relative path" check is a bit risky or too onerous for the plugin?

Either way, doing it manually afterwards is quick and easy, so no problem and certainly no complaints :) I just mention it here so anyone reading knows what to expect and how to fix it :)

Laharah commented 4 years ago

Do you think doing a final "was it originally a relative path if so move it back to relative path" check is a bit risky or too onerous for the plugin?

I'll look into it and add it to the todo list for the re-factor when deluge 2.0 is stable and available on windows. Once that happens I'll have to do a bunch of work to get it working in python3

Is it supposed to be "FileBotTool-1.2.7-py2.7"?

Yeah, it's supposed to be, I built it first before I updated the build number correctly. I've fixed the release, but it shouldn't affect the functionality.