abgx360 Post processing script

Come up with a useful post-processing script? Share it here!
AllanMar
Newbie
Newbie
Posts: 6
Joined: April 16th, 2009, 1:02 pm

Re: abgx360 Post processing script

Post by AllanMar »

Just thought I'd post what i've been using.

Code: Select all

#!/bin/bash

OPTIONS="-hi --af3 --rgn 000000FF" # Define abgx360 Parameters

/usr/local/bin/abgx360 $OPTIONS --dir "$1" 2>/dev/null |  sed 's/file\:\/\/\/\/home\/xbmc\/\.abgx360\//file\:\/\/\/\/\/HTPC\/XBMC\/.abgx360\//' | tee -a "$1"/abgx360.html
Using the --dir option you dont really have to worry about .000, etc abgx attempts to check every file in the dir (it does basic checks first, like size and such). The "2>/dev/null" is because the output from the downloading was appearing at weird spots in the HTML, screwing it up a bit. (this removes the download progress parts, since that is output to stderr, will likely lose any abgx error msgs also tho....)

The second sed part is to rename the paths to the images (abgx can extract an img from the game iso and display it in html) i have my users home folder shared as //htpc/XBMC (the user is xbmc). This part can be removed if your not interested in that image. Somone better with regex, could probably clean that up a bit.

And perhaps most of all, if you make a small change to the SABnzbd code you can view the html through the web interface.

File: interface.py (usually in /usr/share/sabnzbdplus/sabnzbd)
line 2304 (roughly)
''' % (name, name, escape(msg))
if you change to:
''' % (name, name, msg)
it will show the html. This could cause other problems with script output though, use at your own risk. But since this is the only script i really view the output for, I didnt care.
Also i had to remove the tags just above that line, otherwise there was incorrect spacing.

I hope somone might be interested in this also....
XvpX
Newbie
Newbie
Posts: 6
Joined: July 7th, 2009, 9:48 pm

Re: abgx360 Post processing script

Post by XvpX »

aaearon wrote:

A couple of months ago I was trying to figure out a way to put a suffix on the end of the directory name depending if verification passed/failed so I could see at first glance if it passed instead of having to open up the .html file but I can't do any sort of batch scripting  :P
I would also like to know how to do this or at least move it to a verified folder if it passes verification. and delete if it fails.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Check out the following Linux shell script to move the file if it cannot find "Verification was successful" in the abgx360.html output.

http://pastebin.com/f5cbc59e8

Particularly the last IF statement is the addition, I also added the option at the top to set where your failed files should go, this could be adapted to delete them completely, but I do not see the point as I can always run the script again and not have to wait for the download to complete (and waste bandwidth).

Code: Select all

if [ "`grep "Verification was successful" "$FOLDER_PATH/abgx360.html"`" ]
	then
	exit
else
	mv "$FOLDER_PATH" "$FAILED_DIR"
fi
Change:

Code: Select all

mv "$FOLDER_PATH" "$FAILED_DIR"
To:

Code: Select all

rm -r "$FOLDER_PATH"
To delete the download.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
XvpX
Newbie
Newbie
Posts: 6
Joined: July 7th, 2009, 9:48 pm

Re: abgx360 Post processing script

Post by XvpX »

I hate to be a pain in the butt. Do you have any idea how to accomplish this in winxp? If not I guess im goin gto have to setup a linux box lol. Well... try anyhow :) Thanks in advance.
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 »

XvpX wrote: I hate to be a pain in the butt. Do you have any idea how to accomplish this in winxp? If not I guess im goin gto have to setup a linux box lol. Well... try anyhow :) Thanks in advance.
Sorry, I'm a bit anti Microsoft with exception of the Xbox. However, I know perl is available for Windows, probably just need to modify the script that the paths work.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Hello,

I've recently setup a WHS (Windows Home Server) box and wanted the automatic running of abgx360 to work...obviously. ;)

So I've written an AutoHotKey script that accomplishes this. I've assigned it to the Consoles category, which also applies to other Console games (in my Case Wii games).

As such you will need to define the faileddir (Directory that games are moved to if abgx360 is unable to verify/fix the file), the wiidir (for games under 6000MB in size) and the logdir (where XBox360.txt will be written to).

I've included the source for the script, in case anyone wants to tweak it.

The zip is available here:
http://www.megaupload.com/?d=7DNWVKMY

EDIT: Forgot to add, I'm pretty sure Windows will have to be logged in (if you're running this on WHS or some other server, make it auto-login (obviously there are some security risks to doing this) - if someone wants to test it without being logged in, let us know the results. (I've done it without having RDP open at the time it was running and it was likely locked at the server Console (I RDP to Console 0) anyways, but worth mentioning.

AutoHotkey is not needed as the script is already compiled, it will need to be installed if you wish to modify the script and compile it.

Windows Server Auto-Login: http://support.microsoft.com/kb/324737

Good luck and happy downloading,

Markus101
Last edited by markus101 on August 25th, 2009, 3:21 pm, edited 1 time in total.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
XvpX
Newbie
Newbie
Posts: 6
Joined: July 7th, 2009, 9:48 pm

Re: abgx360 Post processing script

Post by XvpX »

Wow! Very cool. Thanks for the PM. I am going to try this on the box I am installing WHS on.
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: Hello,

I've recently setup a WHS (Windows Home Server) box and wanted the automatic running of abgx360 to work...obviously. ;)

So I've written an AutoHotKey script that accomplishes this. I've assigned it to the Consoles category, which also applies to other Console games (in my Case Wii games).

As such you will need to define the faileddir (Directory that games are moved to if abgx360 is unable to verify/fix the file), the wiidir (for games under 6000MB in size) and the logdir (where XBox360.txt will be written to).

I've included the source for the script, in case anyone wants to tweak it.

The zip is available here:
http://www.megaupload.com/?d=7DNWVKMY

EDIT: Forgot to add, I'm pretty sure Windows will have to be logged in (if you're running this on WHS or some other server, make it auto-login (obviously there are some security risks to doing this) - if someone wants to test it without being logged in, let us know the results. (I've done it without having RDP open at the time it was running and it was likely locked at the server Console (I RDP to Console 0) anyways, but worth mentioning.

AutoHotkey is not needed as the script is already compiled, it will need to be installed if you wish to modify the script and compile it.

Windows Server Auto-Login: http://support.microsoft.com/kb/324737

Good luck and happy downloading,

Markus101
Amazing as always Markus! I've been playing the last few days too. Here's what I've been working on...

Code: Select all

#!/bin/bash
#
# Xbox 360 Burning Utility
#
# Written by BrandonG777
#

# ---------- User definable section
OPTIONS="-c -s --af3 --onlinefirst --fixangle359 --myregion 000000FF --splitvid" # Define abgx360 Parameters
BURNER="/dev/sr0" # Set Burner Device
# ---------- User definable section

verify_image()
{
 for i in *.iso
 do
    if [ -f $i ]
    then
	echo "$i Verify?" >> /tmp/finallist.$$
    fi	
 done    


 dialog --backtitle "Xbox 360 Burning Tool" --title "Select File to Verify"\
 --menu "Use [Up][Down] to move, [Enter] to select file"\
 20 60 12 `cat /tmp/finallist.$$` 2>/tmp/file2verify.tmp.$$
 
 rtval=$? 
 
 file2verify=`cat /tmp/file2verify.tmp.$$`
 
 case $rtval in 
     0) dialog --backtitle "Xbox 360 Burning Tool" --title "Are you sure?"\
      --yesno "\n\nDo you want to verify : $file2verify " 10 60
      
        if [ $? -eq 0 ] ; then
	  /usr/local/bin/abgx360 $OPTIONS "$file2verify" \; | tee -a abgx360.txt  
	  read -p "Press enter to continue..."
	else
	  dialog --backtitle "Xbox 360 Burning Tool"\
	  --title "Information: Verify Command" --infobox "File: $file2verify is not verified, Action is canceled, Press a key" 5 60
	  read
	fi
     ;;
    1)  rm -f /tmp/dirip.$$ ; rm -f /tmp/finallist.$$ ; 
        rm -f /tmp/file2verify.tmp.$$; return;;
    255) rm -f /tmp/dirip.$$ ;  rm -f /tmp/finallist.$$ ;
         rm -f /tmp/file2verify.tmp.$$; return;;
esac
 rm -f /tmp/dirip.$$
 rm -f /tmp/finallist.$$
 rm -f /tmp/file2verify.tmp.$$
 return
}

burn_image()
{
 for i in *.dvd 
 do
    if [ -f $i ]
    then
	echo "$i Burn?" >> /tmp/finallist.$$
    fi	
 done    


 dialog --backtitle "Xbox 360 Burning Tool" --title "Select Image to Burn"\
 --menu "Use [Up][Down] to move, [Enter] to select file"\
 20 60 12 `cat /tmp/finallist.$$` 2>/tmp/image2burn.tmp.$$
 
 rtval=$? 
 
 image2burn=`cat /tmp/image2burn.tmp.$$`
 
 case $rtval in 
     0) dialog --backtitle "Xbox 360 Burning Tool" --title "Are you sure?"\
      --yesno "\n\nDo you want to burn : $image2burn " 10 60

        if [ $? -eq 0 ] ; then
      layerbreak=`grep -i LayerBreak $image2burn | sed -e 's/LayerBreak=//g' | tr -d "\r \n"`
 	  iso2burn=`grep -i .iso $image2burn | tr -d "\r \n"`
	  growisofs -use-the-force-luke=dao -use-the-force-luke=break:$layerbreak  -dvd-compat -speed=4 -Z $BURNER=$iso2burn
	  read -p "Press enter to continue"
        else
	  dialog --backtitle "Xbox 360 Burning Tool"\
	  --title "Information: Burn Command" --infobox "File: $image2burn is not burned, Action is canceled, Press a key" 5 60
	  read
	fi
     ;;
    1)  rm -f /tmp/dirip.$$ ; rm -f /tmp/finallist.$$ ; 
        rm -f /tmp/image2burn.tmp.$$; return;;
    255) rm -f /tmp/dirip.$$ ;  rm -f /tmp/finallist.$$ ;
         rm -f /tmp/image2burn.tmp.$$; return;;
esac
 rm -f /tmp/dirip.$$
 rm -f /tmp/finallist.$$
 rm -f /tmp/image2burn.tmp.$$
 return
}


while true
do
dialog --clear --title "Xbox 360 Burning Tool" \
        --menu "To move [UP/DOWN] arrow keys \n\
[Enter] to Select\n\
        Choose the Service you like:" 20 51 4 \
        "verify"       "Verify image" \
        "burn"        "Burn image"\
	"Exit"            "To exit this Program" 2> menuchoice.temp.$$

retopt=$?

choice=`cat menuchoice.temp.$$`

rm -f menuchoice.temp.$$

case $retopt in
    0)
	case $choice in
	    verify) verify_image ;;
	    burn) burn_image ;;
	    Exit) exit 0;; 
        esac    
      ;;	
     1) exit ;;
     255) exit ;;
 esac
done
clear
You need the dialog package. "apt-get install dialog" for Debian/Ubuntu distros. Basically if you need to rerun abgx360 or get an iso from another source it helps with that along with setting layer break and burning to disc. All with a nice command line menu interface via dialog. Just run it in the path where your isos are at.

You also need whatever package gives you growisofs and of course abgx360. Have fun kiddos!  :o
daichiasuka
Newbie
Newbie
Posts: 2
Joined: September 7th, 2009, 9:14 am

Re: abgx360 Post processing script

Post by daichiasuka »

So.... I read through the entire 5 pages of this thread and thought I would mess with running abgx360 unmodified as a post-processing script. I took the script from the first post and striped some stuff I didn't want/need (twitter, rename .000, etc). And here is what i have for you:

Code: Select all

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

if [ `find "$1" -size +5000000k | wc -l` -gt 0 ]
	then
		/usr/local/bin/abgx360 -cas --rgn 000000FF --match "*.iso, *.000" --dir "$1" > "$1/abgx360.txt" 2> /dev/null < /dev/null
	else
		echo "Non-Xbox360 ISO Detected, abgx360 Aborted"
fi
Output is saved in a txt file in the same folder as the iso. STDERR is redirected to /dev/null (2> /dev/null). The problem that hangs scripts normally is not STDERR; it is STDIN. The 'Press Q to quit' is calling getch() which in turn is looking for input, but there is really no input source. (The process launch in python supplies PIPE as the STDIN, so the STDIN for sabnzbd will be the STDIN for the script. Not sure what it is, but getch() obviously doesn't like it.)  By adding the '< /dev/null' changes STDIN to /dev/null. This makes getch() happy because it has something to watch for input (not that it will ever see anything) and the verification continues.
Rizla
Newbie
Newbie
Posts: 3
Joined: August 27th, 2009, 8:39 pm

Re: abgx360 Post processing script

Post by Rizla »

aaearon wrote: Heres mine:

Code: Select all

@ECHO off

abgx360 -xvch --ach --af3 --onlinefirst --gamecrc --match "*.iso, *.000, *.360, *.img, *.bin" --rec --rgn 000000FF --dir %1 > %1\abgx360.html
exit
A couple of months ago I was trying to figure out a way to put a suffix on the end of the directory name depending if verification passed/failed so I could see at first glance if it passed instead of having to open up the .html file but I can't do any sort of batch scripting  :P
To get this working do i just need to change the --rgn to suit my own?

Regards

Rizla
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Hey guys,

I have another update, based on some changes I wanted to see as well as a suggestion from a friend.

I have now made the script check the one or two ISO(s) it finds two times, as during a auto-fix there are still yellow error messages and the output html file may not have the "Verification is Successful" message that is required for the script to determine if the game passed. The time it takes to do two runs of abgx360 is minimal on newer hard drivers, where I've seen speeds upwards of 100MB/sec, more commonly around 80MB/sec.

Next I have the script outputting a .BAT file if the ISO(s) fail for any reason, making it very easy to re-run the script (If you run SAB on another computer the paths will have to be the same or you will need to .RDP to the file server to run the .BAT file).

I'm also attempting to move a previously failed game back to a "passed" ISO directory, but this appears to be failing in most cases, still working on this, but due to the way I'm using AutoHotKey to move ALL or NONE of the files, its having some issues. I will upload a fix if i can get it working 100%.

Download Link: http://www.megaupload.com/?d=MV5TVNQ4


Cheers,

Markus
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
jubei
Release Testers
Release Testers
Posts: 53
Joined: January 28th, 2009, 11:49 am

Re: abgx360 Post processing script

Post by jubei »

Anyone have an updated compiled ABGX v1.0.2 binary?  I know they just released it today, but I've got no idea how to compile it.  

EDIT
Opened abgx360.c in Xcode & commented out the section that needs to be commented, but the Build menu is greyed out.  Any idea how to compile this in Mac OS X?
Last edited by jubei on November 11th, 2009, 1:29 pm, edited 1 time in total.
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 »

jubei wrote: Anyone have an updated compiled ABGX v1.0.2 binary?  I know they just released it today, but I've got no idea how to compile it.  

EDIT
Opened abgx360.c in Xcode & commented out the section that needs to be commented, but the Build menu is greyed out.  Any idea how to compile this in Mac OS X?
You don't need to modify the code in version 1.0.2, I talked to someone involved with abgx360 awhile back (feel like an ass now that I can't remember their nick) and apparently this was changed just for us. Whoever it is, I want to say good looking out!
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 »

Ok I updated the original post to reflect the changes to abgx360. As soon as I get some time I will look at everyone's additions and do some cherry picking.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: abgx360 Post processing script

Post by markus101 »

Awesome to hear Brandon - I'm seeing your Nick all over the place recently (now that I have an iPod touch :)). Thanks to the person involved with abgx360 too! It's possible this is why i never had any issues when I switch to Home Server, in any event that's awesome.

I've also updated my script (well re-wrote it all) in C Sharp (.Net 2.0) as opposed to AutoHotKey. This is my first experience with C Sharp code so I may be doing things in a more difficult way, but it works, better than my previous scripts. I've also taken the time to create a Google Code Repository to track changes and host the Binaries.

The code and downloads are available at: http://sabscripts.googlecode.com

If you have any questions let me know - Happy Downloading and enjoy Wave4 :)

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