ISO handler:

DLC handler:

I've got branches and settings to either delete ISOs or not, move ISOs or not, and extract the files out of ISOs or not, plus a destination directory where unpacked DLC / XBLA should go. I have the settings for Wii games in there too, but haven't written the branch for Wii games yet. Should be trivial to use the Xbox360 branch as a starting point. The only thing you'd need to really change is the extraction process, since for Wii games you'd probably wanna build wbfs files from the ISOs, as opposed to just extracting the ISOs. I have set it up to automatically recognize multi-disc games and then do the filenaming accordingly.
For the xiso extractor, I got one here:
http://www.ivegotavirus.com/blog/2011/1 ... -xbox-360/
Code:
Code: Select all
#!/bin/bash
echo ""
echo "------------------------------[Now running Games Auto-Processor script]------------------------------"
echo "Variables passed from SABnzbd:"
echo "1 is $1"
echo "2 is $2"
echo "3 is $3"
echo "4 is $4"
echo "5 is $5"
echo "6 is $6"
echo "7 is $7"
echo ""
echo "Begin work."
echo "----------------------------"
###############
# Settings #
###############
#
# 360 Settings
#
################
Extract360ISO="Yes"
Delete360ISO="Yes"
Move360ISO="No"
Extract360Destination="/mnt/disk3/Games/Xbox360/Games/"
ISODestination360="/mnt/disk3/Games/Xbox360/ISO/"
DLCDestination360="/mnt/disk3/Games/Xbox360/Master/content/0000000000/"
##################
#
#Wii Settings####
#
#################
WiiExtractISO="Yes"
WiiDeleteISO="Yes"
WiiExtractDestination="/mnt/disk3/Games/Wii/Games/"
WiiISODestination="/mnt/disk3/Games/Wii/ISO/"
#
#
if [ "$7" = "0" ];
then
if [ "$1" = *XBOX360* ];
echo "Xbox 360 game found."
then
#prepare the release's "pretty name"
# First we grab the release name from SABnzbd
prettyname="$3"
# Next we replace all dots with spaces
prettyname=$(echo ${prettyname//./ })
# Then we do the same with underscores
prettyname=$(echo ${prettyname//_/ })
# Chop off the "Xbox360" and release group
prettyname=${prettyname% XBOX360*}
# Chop off the region code from the end
prettyname=${prettyname% PAL*}
prettyname=${prettyname% NTSC*}
prettyname=${prettyname% NTSCJ*}
prettyname=${prettyname% JPN*}
prettyname=${prettyname% ASIA*}
prettyname=${prettyname% RF*}
# Chop off any leading "The " from the beginning
prettyname=${prettyname#The }
echo "Finished release name is $prettyname."
echo "Looking for ISOs."
ISOCount="0"
#move into the directory where the job is
cd "$1"
# find the number of ISOs in the folder
ISOCount=$( ls -1 | grep .iso | wc -l )
# if there's more than 1 ISO we will process it as a multi-disc release
if [ $ISOCount -gt 1 ];
then
ISOCountx="1"
echo "Multi-disc release found."
for f in *.iso;
do
if [ $Extract360ISO = "Yes" ];
then
echo "Extracting $f to $Extract360Destination$prettyname-Disc $ISOCountx";
extract-xiso -x "$f" -d "$Extract360Destination$prettyname-Disc $ISOCountx>/dev/null";
rm -r "$Extract360Destination$prettyname-Disc $ISOCountx/\$SystemUpdate"
chmod -R 777 ""$Extract360Destination$prettyname-Disc $ISOCountx"";
fi
if [ $Move360ISO = "Yes" ];
then
echo "Moving $f to $ISODestination360$prettyname-Disc $ISOCountx.iso";
mv "$f" "$ISODestination360$prettyname-Disc $ISOCountx.iso";
dvdfile=${f%.dvd*};
dvdfile="$dvdfile.dvd"
echo "Moving $dvdfile to $ISODestination360$prettyname-Disc $ISOCountx.dvd";
fi
if [[ $Delete360ISO = "Yes" && $Move360ISO = "No" ]];
then
echo "Deleting $f";
rm -f "$f";
dvdfile=${f%.dvd*};
dvdfile="$dvdfile.dvd"
echo "Deleting $dvdfile";
rm -f "$dvdfile";
fi
ISOCountx=`expr $ISOCountx + 1`;
done
fi
if [ $ISOCount = "1" ];
then
# if its just one ISO we can process it without the ISOCount stuff
f=$(ls | grep .iso)
echo "Single disc release found, file is $f"
if [ $Extract360ISO = "Yes" ];
then
echo "Extracting $f to $Extract360Destination$prettyname";
extract-xiso -x "$f" -d "$Extract360Destination$prettyname" >/dev/null;
rm -r "$Extract360Destination$prettyname/\$SystemUpdate"
chmod -R 777 "$Extract360Destination$prettyname";
fi
if [ $Move360ISO = "Yes" ];
then
echo "Moving $f to $ISODestination360$prettyname.iso";
mv "$f" "$ISODestination360$prettyname.iso";
dvdfile=${f%.dvd*};
dvdfile="$dvdfile.dvd"
echo "Moving $dvdfile to $ISODestination360$prettyname.dvd";
mv "$dvdfile" "$ISODestination360$prettyname.dvd";
fi
if [[ $Delete360ISO = "Yes" && $Move360ISO = "No" ]];
then
echo "Deleting $f";
rm -f "$f"
dvdfile=${f%.iso*}
dvdfile="$dvdfile.dvd"
echo "Deleting $dvdfile";
rm -f "$dvdfile"
fi
fi
if [ $ISOCount = "0" ];
then
# if no ISOs are found maybe its DLC?
echo "No ISOs found, checking for DLC"
# This next line greps the current directory for an item named with 8 hex characters, the format for all Xbox360 Title IDs
dlccount=$( ls -1 | grep -i [0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f] | wc -l )
if [ $dlccount = "1" ];
then
dlcfolder=$( ls -1 | grep -i [0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f] )
echo "Moving $dlcfolder to $DLCDestination360";
mkdir -p "$DLCDestination360$dlcfolder";
rsync --remove-source-files -r "$dlcfolder" "$DLCDestination360$dlcfolder"
rm -r -f $dlcfolder
chmod -R 777 "$DLCDestination360$dlcfolder";
fi
fi
# Now we do some garbage cleanup
for f in *.nfo;
do
echo "Deleting $f";
rm -f "$f";
done
for f in *.nzb;
do
echo "Deleting $f";
rm -f "$f";
done
cd ..
if [ ! "$(ls -A "$1")" ];
then
echo "$1 is now empty, deleting";
rm -f -r "$1";
fi
echo "";
echo "Xbox 360 processing complete."
fi
#End Xbox 360 branch
else
echo "Job didn't complete successfully?"
fi