Please Add support for TAR files

Want something added? Ask for it here.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

yes
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

Use this NZB with a tar file on your setup: https://www.appelboor.com/dump/reftestn ... 37874f.nzb

Do you get a tar file?

If so, proceed:

This is the post-processing script that takes care of untarring a tar file:

Code: Select all

#!/bin/bash
set -e # bail out in case of any problem
echo "$1"
cd "$1"
pwd

for f in *.tar; do
	echo $f
	tar -xvf "$f"
done

dir
Put it as "untar_it.sh" in your SABnzbd script folder (see http://127.0.0.1:8080/sabnzbd/config/folders/ ).
then: make it executable with

Code: Select all

chmod +x untar_it.sh
The do the above download again, and select untar_it.sh as post-processing script.

SAB will show the logging:

Code: Select all

/media/sander/6665-6464/reftestnzb___tar-file___92c85a37874f
/media/sander/6665-6464/reftestnzb___tar-file___92c85a37874f
reftestnzb___tar-file___92c85a37874f.tar
./
./three.txt
./fout.txt
./two.txt
./one.txt
fout.txt  one.txt  reftestnzb___tar-file___92c85a37874f.tar  three.txt	two.txt
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

Ok I got it.
But the script's name does not show up in the selection box.
So I cannot apply it on the nzb.
Moreover I understand that I have to do this script selection on each of the nzb concerned.
That is a problem.
I don't know beforehand which has a tar file and which doesn't.
And i cannot throw a bulk of files in the watched folder because when they are caught by Sabnzbd you cannot set a script for them afterwards.

I wish they implement that as an automatique step activated every time there is a tar file. This is already happening when a zip file is encountered.
User avatar
safihre
Administrator
Administrator
Posts: 5338
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Please Add support for TAR files

Post by safihre »

You need to have the X bit (execute permission) set on the script file and it has to be in your Scripts folder. That's also documented in the link provided by sanderjo.

In Config > Categories you can set this script for your Default category. This will run the script for every job in any category.
If there's no tar files, it will just not do anything.

We can't integrate everything. We are trying to help you with a fast solution here.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

I am pretty sure I did everything you asked, and yet the script does not appear in the selectable box.
As if Sabnzbd simply does not see it.

root@Novanas2:/mnt/cache# cd appdata/binhex-sabnzbd/
root@Novanas2:/mnt/cache/appdata/binhex-sabnzbd# ls
admin/ sabnzbd.ini supervisord.log.1 supervisord.log.4
logs/ sabnzbd.ini.bak supervisord.log.2 supervisord.log.5
perms.txt supervisord.log supervisord.log.3 untar_it.sh*
root@Novanas2:/mnt/cache/appdata/binhex-sabnzbd# chmod +x untar_it.sh

This is from Putty. I don't know what else to do....
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

Ok... some progress....
Now I get
"ScriptExit(-1) Cannot run script /config/untar_it.sh"
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

xtrips wrote: October 21st, 2021, 1:40 pm Ok... some progress....
Now I get
"ScriptExit(-1) Cannot run script /config/untar_it.sh"
With SSH, login on your Unraid Server. There and then:

Code: Select all

/config/untar_it.sh blablabla
What is the result?
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

I don't know what that means so I am posting it.

root@Novanas2:~# cd /mnt/cache/appdata/binhex-sabnzbd/
root@Novanas2:/mnt/cache/appdata/binhex-sabnzbd# ls
admin/ sabnzbd.ini.bak supervisord.log.4
logs/ supervisord.log supervisord.log.5
perms.txt supervisord.log.1 untar_it.sh*
reftestnzb___tar-file___92c85a37874f.tar supervisord.log.2
sabnzbd.ini supervisord.log.3
root@Novanas2:/mnt/cache/appdata/binhex-sabnzbd# untar_it.sh reftestnzb___tar-file___92c85a37874f.tar
-bash: ./untar_it.sh: /bin/bash^M: bad interpreter: No such file or directory
root@Novanas2:/mnt/cache/appdata/binhex-sabnzbd#
User avatar
OneCD
Hero Member
Hero Member
Posts: 557
Joined: March 4th, 2017, 3:47 pm

Re: Please Add support for TAR files

Post by OneCD »

xtrips wrote: October 21st, 2021, 4:32 pm -bash: ./untar_it.sh: /bin/bash^M: bad interpreter: No such file or directory
Your script has the wrong line-ending characters. You'll need to convert it with 'dos2unix' or else save it with the correct characters from within a supported text editor.
Stuff I like: Apache bash cron DD-WRT Debian DNSMasq Entware FireFox GitHub ImageMagick Kate KDE LibreELEC Netrunner NFS NVIDIA OpenVPN Orvibo-S20 pfSense Python Raspberry-Pi RAID SABnzbd Transmission Usenet VirtualBox Watcher3 XFCE
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

OneCD wrote: October 21st, 2021, 4:37 pm
xtrips wrote: October 21st, 2021, 4:32 pm -bash: ./untar_it.sh: /bin/bash^M: bad interpreter: No such file or directory
Your script has the wrong line-ending characters. You'll need to convert it with 'dos2unix' or else save it with the correct characters from within a supported text editor.
Finally! Thanks. I used Notepad++ to convert it. Now it works.
Just one last question. Why does the tar process outputs the list of files uncompressed within the Sabnzbd web interface, right on the status line
"fout.txt one.txt reftestnzb___tar-file___92c85a37874f.tar three.txt two.txt" ?
A simple "Unpack successful" would suffice.
What will happen when a tar file contains thousands of files?
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

xtrips wrote: October 21st, 2021, 4:56 pm
A simple "Unpack successful" would suffice.
then put

Code: Select all

echo "Unpack successful" 
as last line the untar_it.sh post-processing script.
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

Hello again,
Thank you for the quick resolution of my problem. It works great with .tar files.
But now for the other kind of downloads which represents 99% I guess I get "Script exit code is 2" and the Retry flag lit even though the Unpack went totally fine.
Is there something we can add in the script to disregard all other kinds of files and behave transparently?
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

send an example NZB to safihre@...

And post the output of the script here.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Please Add support for TAR files

Post by sander »

Use this altered script:

Code: Select all

#!/bin/bash
set -e # bail out in case of any problem
echo "$1"
cd "$1"
pwd
find . -name "*.tar" -type f -print0 | xargs -0 tar -xvf
dir
xtrips
Jr. Member
Jr. Member
Posts: 52
Joined: May 11th, 2010, 5:45 am

Re: Please Add support for TAR files

Post by xtrips »

Hello,
Here is the result
"Retry Regarding Henry 1991 COMPLETE BLURAY-MTKTI Script exit code is 123"

Of course it shows in red like an error.
Locked