abgx360 Post processing script

Come up with a useful post-processing script? Share it here!
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

abgx360 Post processing script

Post by BrandonG777 »

*** THIS INFO IS CURRENT AS OF VERSION 1.0.6 and SABNZBD 0.7.0 ***

For those of you who use this fabulous tool you already know what's up. For those who don't I highly recommend it.

** MODIFYING ABGX360 CODE IS NO LONGER NECESSARY!!! **
Thank the guys over at abgx360 for changing the kbhit() behavior.

Code: Select all

#!/bin/bash
# $1 (source path) is provided by sabnzbd+ upon execution

# ---------- User definable section
OPTIONS="--corrupt --stripcolors --af3 --onlinefirst --fixangle359 --myregion 000000FF --splitvid" # Define abgx360 Parameters
TWITTER_NAME="BrandonG777" #Twitter Username
TWITTER_PASSWORD="****" #Twitter Password
# ---------- User definable section

# Search $1 (source path) for folders including _FAILED_, move contents of $1 to $FAILED_PATH if found and exit script
FAILED_TEST=`find "$1" -type d \( -iname "*_FAILED_*" \) -print`
if [ "$FAILED_TEST" ] ; then
echo "failed download detected, abgx360 aborted, removing bunk image"
rm -Rf "$1"
exit
fi

if [ `find . -size +5000000k -regex '.*/.*\.000' ` ]
	then
	OLD_000="$FOLDER_PATH`find . -regex '.*/.*\.000' | sort | sed -n '1p' | sed 's/^\.//'`"
	RENAME_ISO="$FOLDER_PATH`find . -regex '.*/.*\.000' | sed 's/000/iso/' | sed -n '1p' | sed 's/^\.//'`"
	mv "$OLD_000" "$RENAME_ISO"
	rm "$FOLDER_PATH"/*.dvd
fi

if [ `find "$1" -size +5000000k -regex '.*/.*\.iso' | wc -l` -eq 1 ]
	then
        find "$1" -regex '.*/.*\.iso' -exec /usr/local/bin/abgx360 $OPTIONS "{}" \; | tee -a "$1"/abgx360.txt
	else
		echo "Non-Xbox360 ISO Detected, abgx360 Aborted"
fi

# Update Twitter
echo ""
echo "- Tweet, tweet!"
curl --basic --user "$TWITTER_NAME:$TWITTER_PASSWORD" --data-ascii "status=just finished downloading $3" "http://twitter.com/statuses/update.json" >/dev/null 2>&1
Remember to change your region code in the config section otherwise leave everything alone unless you know what you're doing. Region codes are as follows:
000000FF  NTSC/U
00FE0000  PAL Europe

I will not offer any support for abgx360 here this is not the place for that. So if you ask you deserve to be banned. Other than that feel free to take it and improve upon it.

mad props to markus101 for helping with this.
Last edited by BrandonG777 on July 3rd, 2012, 10:57 am, edited 3 times in total.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Thanks Brandon! I've been looking for just the script. I wasn't even aware there was a Linux version of this great app.

Cheers,

Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

markus101 wrote: Thanks Brandon! I've been looking for just the script. I wasn't even aware there was a Linux version of this great app.

Cheers,

Markus
No problem. However, I'm a knob I didn't test with SABnzbd running my scripts only manually feeding it the parameters like SAB does but it freezes up on the CRC check. I added the nohup command to solve that but it still didn't fix the script. Anyone that could help me resolve this would be much appreciated.

Apparently what happens is abgx360 is launching another background process or something and causes it to freeze. I had similiar problems backgrounding the script while it was running so I added the nohup command and that solved the problem as far as manually running it. Now I can't seem to replicate the same method SABnzbd is using to execute script so I've hit a bit of a brick wall trying to debug.  ???
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Hmm interesting... I modified the script a bit - so it always runs on the Consoles Category, but won't wreck and "unproper" ISO files. I didn't use the nohup, and haven't in other scripts and haven't had an issue. I'll post back my comments when I get a chance to test it out, its weird that abgx360 launches another process (or whatever it does).

Possible solution would to have SAB run a different script, start the abgx360 script and then return OK to SAB....not sure if that's possible or how to do it, but it would fix the issue, although I'm not seeing any issues with nohup, but I noticed the output log file looks much cleaner.

Here is my modified file: http://pastebin.com/f26f3bb49

I'm also not moving FAILED downloads as I can deal with them manually, and they are fine where they are already (in my mind anyways :))

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

Interesting.. I just updated my script using your HTML method. Come to think of it, that may fix the issue altogether. Well, I have my theories why it may. I was just manually setting the script for the 360 downloads so I didn't hit one my Wii images, which has only one DL image so far but this way I can add them via mynzb on my iPhone. I was also wanting to display an output of the result so I could see it without SSHing in but I can make those changes.

Just tried it and got abgx360 not found. DOH! Gave it a full path will try later.
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

Yeah, I'm pulling my hair out on this one. I've never used nohup myself but something is funky with abgx360. Try backgrounding your script with & and watch what I'm talking about. I can't seem to get anywhere with it.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Why are you running it in the BG? Doesn't SAB already do that when it runs post processing scripts? I've never needed to force it to run in the BG before? You could also try using screen to run it in the BG, although I'm not sure if that would work though.

EDIT: Downloaded something with SAB - The issue revolves around the CRC check it looks like (thats the last I get back when I manually stopped the script after 20 minutes, when it shouldn't take longer than 10 Mins with high disk usage...

Things to try...
Launch a another script from with the SAB post processing script and hope that somehow works...
Figure out a clean way to use nohup (it really makes a mess of the output file), and use it for running abgx360 from the script
Do not perform CRC check with ABGX automatically from SAB - would have to manually run it though...
Try to use screen to run the script...

-Markus
Last edited by markus101 on February 10th, 2009, 7:47 pm, edited 1 time in total.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

markus101 wrote: Why are you running it in the BG? Doesn't SAB already do that when it runs post processing scripts? I've never needed to force it to run in the BG before? You could also try using screen to run it in the BG, although I'm not sure if that would work though.

EDIT: Downloaded something with SAB - The issue revolves around the CRC check it looks like (thats the last I get back when I manually stopped the script after 20 minutes, when it shouldn't take longer than 10 Mins with high disk usage...

Things to try...
Launch a another script from with the SAB post processing script and hope that somehow works...
Figure out a clean way to use nohup (it really makes a mess of the output file), and use it for running abgx360 from the script
Do not perform CRC check with ABGX automatically from SAB - would have to manually run it though...
Try to use screen to run the script...

-Markus
I say background it (for debugging purposes not actually writing the script that way) because that will give you the same effect that SAB is giving you when it gets to the CRC issue. I like the screen idea, not to mention it gives you a way to check in on the process if it acts screwy in the future. I'll give that a shot tomorrow. I was never keen on the nohup thing I was just trying to find a way to make the damn thing work.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Yeah (say the issue with running it in the BG.. its ugly and fails) , I'm trying to figure out how to get screen to accept a command and detach (run in BG).... foudn something that said this should work, but I'm getting screwy results.

Code: Select all

screen -d -m -S name /path/to/script/script.sh
- One time it actually started screen, the next nothing, but eitehr way no luck getting it to run an app... Ill play around a bit more, it would be great to get this working.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

Grr... just spent an hour downloading and forgot to set the abgx360 script to run. It would make this process a lot easier if there was just someway you could make sab rerun a post script.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

:\ about two hours for me on 10Mbit - annoying, but would be worth it to get it going. Screen looks liek the solution, but for the life of me I can't get it to open and run a command...even though it says it handles that.

I wonder if using nohup on the entire script would work... ie have SAB run a script that calls another script with nohup...I'm thinking it won't work...but might be worth a shot.

My other solution is to dump the output of SAB into a script, that writes to a txt file, then have another script call that txt file and run it through ABGX360 line by line...it would require manually running the second script to avoid the running in the BG issue, but would beat either copying the ISO to my windows box for testing or running ABGX manually/passing arguments to a script manually.

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

Yeah, and here I am thinking I've got it bad on my 25megabit/s connection. ;) Anyway, I got it working somewhat. Still need to find a better solution to this. This kicks it out as a file called screenlog.0, yeah that sucks and without doing some crazy looping you can't rename the file. Another issue I see is that my script will error out on multi disk downloads because of the session name I used on screen. You probably know an easy way to append numbers. I've been busy pulling my hair out trying to get it into a filename other than screenlog.0 Nonetheless it is progress.

Code: Select all

#!/bin/bash
# $1 (source path) is provided by sabnzbd+ upon execution

# ---------- User definable section
OPTIONS="-c -s --af3 --onlinefirst --fixangle359 --myregion 000000FF --splitvid" # Define abgx360 Parameters
# ---------- User definable section

# Search $1 (source path) for folders including _FAILED_, move contents of $1 to $FAILED_PATH if found and exit script
FAILED_TEST=`find "$1" -type d \( -iname "*_FAILED_*" \) -print`
if [ "$FAILED_TEST" ] ; then
echo "failed download detected, abgx360 aborted, removing bunk image"
rm -Rf "$1"
exit
fi

if [ `find "$1" -size +5000000k -regex '.*/.*\.iso' | wc -l` -eq 1 ]
	then
		FILEZ[1]="`find "$1" -regex '.*/.*\.iso'`"
		screen -L -dmS abgx360 /usr/local/bin/abgx360 $OPTIONS "${FILEZ[1]}"
		else
		echo "Failed Download or Non-Xbox360 ISO Detected, abgx360 Aborted" > "$1/failed.log"
    	exit
fi
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

You could call after to screen bit
mv screenlog.0 > abgx360.txt

I'm having issues with screen and passing commands to it...it seems like it doesn't always want to do it...oh well, I'll keep playing and see if it starts working...


EDIT: I think I fixed it...99% sure, just have to modify the script and try a download with SAB... I should know in the next few hours if it's working and I'll post back just as soon as I do.


-Markus
Last edited by markus101 on February 11th, 2009, 10:09 pm, edited 1 time in total.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BrandonG777
Jr. Member
Jr. Member
Posts: 79
Joined: February 9th, 2009, 5:21 pm
Location: Tulsa, OK

Re: abgx360 Post processing script

Post by BrandonG777 »

Cool, look forward to see what you've come up with. The mv command won't work because without putting the script in some kind of loop it would execute before abgx360 is finished. I think I could make it work with two scripts, having screen call another script but I was really trying to avoid that.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Well - another test another fail. I found out that abgx360 outputs its CRC check information to stderr and all other output to stdout. I tried to redirect the stderr to a text file, which again works in the testing, but doesn't work for the the script when run by SAB...back to square one...

-Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
Post Reply