utorrent-postprocess.groovy Extract override duplicate Input

All your suggestions, requests and ideas for future development
Post Reply
verysofttoiletpaper
Posts: 141
Joined: 05 Jul 2012, 09:44

utorrent-postprocess.groovy Extract override duplicate Input

Post by verysofttoiletpaper »

Code: Select all

Extract archive [how.i.nailed.your.mom.618.720p-dimension.rar] to [/mnt/media/Media/Deluge/completed/How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION/.]
Extracting files [How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION.mkv]
Input: /mnt/media/Media/Deluge/completed/How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION/How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION.mkv
Input: /mnt/media/Media/Deluge/completed/How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION/./How.I.Met.Your.Mother.S06E18.720p.HDTV.X264-DIMENSION.mkv
If a file with the same name already exists, and the option override is set in the extract command like it is by default in utorrent-postprocess.groovy, the script tries to process the same file twice.

The is specially a problem if --conflict is set to fail, because it will try to copy the same file to the same location twice, and fail.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: utorrent-postprocess.groovy Extract override duplicate I

Post by rednoah »

How could that happen? If it overrides the file there is still only one file. Plus it should only process it once per "download complete".

If you download the same episode twice that's just expected behaviour then.


EDIT: Just noticed. The exact same path is twice in the input list. Already fixed that in newer revisions by adding a .unique()
:idea: Please read the FAQ and How to Request Help.
verysofttoiletpaper
Posts: 141
Joined: 05 Jul 2012, 09:44

Re: utorrent-postprocess.groovy Extract override duplicate I

Post by verysofttoiletpaper »

It's because of the way the extract command works.
Because it set to extract to . it returns the path for the extracted file with a ./ in the middle which points to the same file as the path without the ./ which already existed in the file list.

This only happens of course if the downloaded file was already extracted before for some reason, like filebot failed to match, etc..
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: utorrent-postprocess.groovy Extract override duplicate I

Post by rednoah »

Ah, also the newer revisions don't use "." as output path but auto-create a folder with the name of the archive. Should work.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: utorrent-postprocess.groovy Extract override duplicate I

Post by rednoah »

This will get rid of everything that might cause problems:

Code: Select all

// sanitize input
input = input.findAll{ it.exists() }.collect{ it.canonicalFile }.unique()
:idea: Please read the FAQ and How to Request Help.
Post Reply