Opened 10 years ago

Closed 10 years ago

Last modified 6 years ago

#2466 closed patch (Fixed)

[AutoAdd] Error in copy torrent code if inital rename fails

Reported by: Doadin Owned by:
Priority: minor Milestone: 2.0.0
Component: Plugin Version: develop
Keywords: Cc:

Description

Since the change to the autoadd plugin for watching folders the added torrent does not get removed from the watch folder and in the autoadd options you can only select one or the other either delete .torrent folder or copy the .torrent to a folder. I believe this behavior should change as its probably going to try to repeatedly add it which is a waste and if you remove the torrent it will probably get added back right after since it never moved. I think that all three options for "Torrent File Action" should be options separate from each other at the very least so the user can choose.

Keeping in mind if this is the case you would probably have to add checks or something for deleting the torrent after its done or something so the client can use it? Not sure how that works in deluge but i know in other clients if you delete the torrent file you added while its still in the torrent list it will give an error.

Attachments (2)

patch.diff (991 bytes) - added by Doadin 10 years ago.
patch for the above issue use if approved.
[#2466][AutoAdd] Error in copy torrent code if inital rename fails patchv2.patch (2.1 KB) - added by Doadin 10 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by Doadin

It appears the the problem is that the copy torrent option in AutoAdd? is broken.

error during update: [Failure instance: Traceback: <type 'exceptions.NameError?'>: global name 'errno' is not defined twisted/internet/base.py:1192:run twisted/internet/base.py:1201:mainLoop twisted/internet/base.py:824:runUntilCurrent twisted/internet/task.py:218:_call_ ---<exception caught here> --- twisted/internet/defer.py:140:maybeDeffered build\bdist.win32\egg\deluge\plugins\autoadd\core.py:341:update_watchdir

enableing the copy torrent in main preferences and the delete option in AutoAdd? gives the desired out come and the delete option is probably not necessary however since they are not checkboxes and they are radio options one has to be chosen.

The append extention after adding works so im guessing its not a permisions issue?

comment:2 Changed 10 years ago by Doadin

  • Component changed from Packaging to Plugin

comment:3 Changed 10 years ago by Doadin

I think if you add under line 340 "os.remove(filepath)" It will fix this as it should first copy the torrent(line 340) which works, then removes the torrent from its original location? It seems like this is what it trys if there is an error with the operation but im guessing the operation is considered successful since the copy works but loops back from another spot causing the error shown in deluged-debug?

Or maybe a easyer option would be to just use shutil.move(src, dst). Which would be "shutil.move(filepath, copy_torrent_file)" ? In place of line 340 Although shutil seems like a poor options as its not a fery nice module and it would be one more module to add.

Version 1, edited 10 years ago by Doadin (previous) (next) (diff)

comment:4 Changed 10 years ago by Doadin

  • Type changed from feature-request to patch

Changed 10 years ago by Doadin

patch for the above issue use if approved.

comment:5 Changed 10 years ago by Doadin

Not sure if that will work.

comment:6 Changed 10 years ago by Cas

  • Summary changed from Options for Torrent After AutoAdding to [AutoAdd] Error in copy torrent code if inital rename fails

Replacing that whole try..except section with shutil.move is the solution. There is nothing wrong with using shutil and it is actually more robust.

comment:7 Changed 10 years ago by Doadin

"On POSIX platforms, this means that file owner and group are lost as well as ACLs.""On Windows, file owners, ACLs and alternate data streams are not copied."

That doesnt seem too good to me? Couldnt that create issues?

Last edited 10 years ago by Doadin (previous) (diff)

comment:8 Changed 10 years ago by Doadin

It does work in windows to use the shutils.move both patches are wrong here but the one that uses shutils is closest just in the patch i forgot to add import shutils to the top so id just change it manually its easy anyways.

comment:9 Changed 10 years ago by Cas

  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in develop: [6c295cd314]

comment:10 Changed 8 years ago by Cas

  • Milestone changed from 2.0.x to 2.0

comment:11 Changed 6 years ago by Cas

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.