Skip to content

Error when torrent file_priorities is empty #59

@BlazeMV

Description

@BlazeMV

When we add torrents using a magnet into deluge, torrent.options["file_priorities"] is not always populated. torrent.options["file_priorities"] is only set if we wait for deluge to fetch metadata, get files list and then build and set file_priorities.

Sometime when adding magnets from ui, it takes a few seconds for this to complete, and if a user adds torrent before this process is completed torrent.options["file_priorities"] is set to an empty list []. This is also ALWAYS the case when we add a magnet programatically from another plugin / cli using core.add_torrent_magnet(uri)

when this happens in the gtk3ui, this is the error message it shows

FilebotRuntimeError error on torrent e64f9dd00c31b300bef1e73602cce245ba9ca269:
    FILEBOT OUTPUT DUMP:
    No input arguments
    No input files
    Failure (×_×)⌒☆
   
    stderr:

this is the deluged.log file result filtered for filebottool when failure happened

08:39:24.924 [INFO    ][filebottool.common                    :1672] [FileBotTool] Torrent e64f9dd00c31b300bef1e73602cce245ba9ca269 matched rule 0
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] Marking torrent e64f9dd00c31b300bef1e73602cce245ba9ca269 as processing.
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] Marking torrent e64f9dd00c31b300bef1e73602cce245ba9ca269 as processing.
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] Torrent e64f9dd00c31b300bef1e73602cce245ba9ca269 already marked as in progress.
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] targets list for torrent e64f9dd00c31b300bef1e73602cce245ba9ca269
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] targets found: []
08:39:24.924 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] beginning filebot run on torrent e64f9dd00c31b300bef1e73602cce245ba9ca269, with target []
08:39:25.553 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] recieved results from filebot: (0, [], [])
08:39:25.553 [INFO    ][filebottool.common                    :1672] [FileBotTool] No movements for e64f9dd00c31b300bef1e73602cce245ba9ca269
08:39:32.685 [INFO    ][filebottool.common                    :1672] [FileBotTool] No subs found for torrent e64f9dd00c31b300bef1e73602cce245ba9ca269
08:39:32.685 [DEBUG   ][filebottool.common                    :1672] [FileBotTool] Finished processing torrent e64f9dd00c31b300bef1e73602cce245ba9ca269

In deluge even if file_priorities is an empty list, files still gets downloaded. I'm assuming this is because deluge's default priority is 4 (Normal) and not 0 (Skip), and if a priority is not given, it defaults to 4 in deluge.

However, since filebottool relies on file_priorities list not being empty (see https://github.com/Laharah/deluge-FileBotTool/blob/ca8015240262d541536b4b71bc4a2dc271e2171b/filebottool/core.py line 383 & 384) this causes filebottool to skip over all the files in the torrent when renaming and moving.

Shouldn't filebottool also use 4 (Normal) as the default priority if the file_priorities list is empty?

ps: I have already made a post on deluge forum. It explains the deluge behaviour in detail (based on my testing). https://forum.deluge-torrent.org/viewtopic.php?t=56992

ps2: I you would like, I could submit a PR that would compare the length of torrent.options["file_priorities"] and torrent.get_files() and build file_priorities if they don't match with priority 4 (Normal) as default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions