Execute plugin: problem with the standard "extract archives script"

Suggest, post, or discuss plugins for Deluge
Post Reply
Pyrrhic
Member
Member
Posts: 19
Joined: Mon Jan 23, 2017 4:13 pm

Execute plugin: problem with the standard "extract archives script"

Post by Pyrrhic »

Hi folks,

Wonder if you can help. I am trying to use the 'extract archives script' example from the Execute plugins page to automatically unrar/unzip files after downloading:

https://dev.deluge-torrent.org/wiki/Plugins/Execute

It used to work fine for me before, but I recently had to do a system wipe so was reinstalling. I noticed it wasn't working on recent compressed files downloaded, so I tried the script manually with a recent problem torrent: What I see in the terminal is Unrar firing up, a message saying "extracting from [file].rar", followed by "extracting from [file].r00", "extracting from [file].r01" and so on - but once it cycles through all the files, it just says 'no file to extract.'

I don't think it's permissions related (i.e. the group file permissions are set right for deluge user and the media drive) and it's clear the script is *seeing* the relevant file (i.e. the terminal output is showing 'extracting from [file].rar" - but no joy.

Anyone have any idea what's going on?

Cheers!
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Execute plugin: problem with the standard "extract archives script"

Post by mhertz »

The 'find' command is seeing the rar/zip files and logs it, but the actual unrar tool fails extracting it. I quickly saw another user report same error on Linux with unrar and not with windows with winrar, so could very well be the unrar version isn't compatible with the rar version used, as some aren't, rar3 or 5 or whatever it is that some not support(windows unrar does, plus some Linux builds too I believe). Sorry don't know what you'd need to fix specifically, but see if you can find other unrar version than regular gnu unrar, or alternative tool possibly supporting more full spectrum rars, e.g maybe p7zip etc which always worked well for me for the rars I've tried, but don't know honestly. There's also dedicated extraction plugins, e.g latest announced here beeing simple extractor v2, also using 7z if remember correct: viewtopic.php?f=9&t=55519
Pyrrhic
Member
Member
Posts: 19
Joined: Mon Jan 23, 2017 4:13 pm

Re: Execute plugin: problem with the standard "extract archives script"

Post by Pyrrhic »

This is super helpful advice, thank you! - I've switched out the unrar command with 7zip ("7z x - y" - y = yes to any prompts) and manually tested it, and it seemed to spring into life and begin extracting this time, so I think that's sorted it. Thank you!
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Execute plugin: problem with the standard "extract archives script"

Post by mhertz »

You're very welcome, glad to hear it, and thanks likewise for reporting back :)

@all, for Debian-based distro's, I believe you need p7zip-rar from unfree repos or something, and using v16.02+ of p7zip should support also newest rar5 rars. P7zip includes the 7z command-line tool btw. WinRAR uses rar5 by default I believe, when creating archives. If wanna use unrar specifically, then look for a v5 or above, of it, and is in e.g ubuntu's multiverse repo I see, in v5+ all the way atleast until 18.04, and I didn't look further downwards - referenced as 'non-free version' in package description, so avoid the unrar-free one. There's also links on official rar page, e.g unrar v5.5 in deb x64/x32 packages, plus rpms and whatnot other formats, here: https://www.rarlab.com/rar_add.htm. Finally, on arch-linux, unrar from 'extra' repo, is v6.0.6 currently, so should be fine.
Last edited by mhertz on Tue Jun 01, 2021 11:12 am, edited 4 times in total.
Pyrrhic
Member
Member
Posts: 19
Joined: Mon Jan 23, 2017 4:13 pm

Re: Execute plugin: problem with the standard "extract archives script"

Post by Pyrrhic »

Hi mhertz / all,

Just to add onto the above, if you want to use 7zip, it is indeed p7zip-rar you'd need, and:

I *thought* I was having an issue with 7zip extracting to the directory above the one I wanted - fairly sure now I was just using the wrong path to test with - but it made me revert to trying to persevere with unrar. I'll spare you all the in-between things I tried, but at one point I ran a purge ('sudo apt purge unrar') and then immediately reinstalled unrar, and would you believe it - the original script setup (i.e. using unrar) seemed to start working again!

TLDR: 7zip command I used above should work, but if you also have problems with unrar not 'seeing' the files to extract using the script - perhaps just try a simple purge and reinstall first :)
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Execute plugin: problem with the standard "extract archives script"

Post by mhertz »

Thanks mate for followup :) Not important now, but if others change to 7z instead of unrar, and want same way of extracting files as before, then use 'x' instead of 'e' so files in subdirs gets extracted correctly, instead of dropping subdirs as 'e' does(I.e 'x' retains paths) . As said by OP though, just purge/reinstall unrar if having issues simply i.e possibly he had old or "free" version before if I should waver a guess, but not sure honestly why fixed it.
Pyrrhic
Member
Member
Posts: 19
Joined: Mon Jan 23, 2017 4:13 pm

Re: Execute plugin: problem with the standard "extract archives script"

Post by Pyrrhic »

Final follow-up!

Things still weren't right, but after (much) more head bashing, I realised the error; I hadn't actually got the script from the deluge wiki execute page I linked to before, but an incredibly similar one from elsewhere that had one subtle difference in it - files extracted to the directory *above* the one with the rar files in it, so they were extracting, just not where I thought they should be!

I am pleased to say that the reference script on the Deluge Execute plugin page works exactly as expected, and I'm all sorted now :) Thanks all!
digitalhigh
Member
Member
Posts: 13
Joined: Thu Oct 24, 2019 3:37 am

Re: Execute plugin: problem with the standard "extract archives script"

Post by digitalhigh »

viewtopic.php?f=9&t=56192

Created a new/remastered Extraction plugin, "ExtractorPlus".
Post Reply