Jump to content


Photo

[script] Download Title Update From Iso


  • Please log in to reply
1 reply to this topic

#1 pabloalcantara

pabloalcantara

    X-S Enthusiast

  • Members
  • 8 posts

Posted 19 January 2012 - 02:51 AM

Hi,
I created a bash script that search an ISO file or a folder for titles updates no xbuc.net and marketplace.jqe360.com for Title Updates.
The script uses abgx360 to get the MEDIAID and search for th TU.

The script creates one subfolder inside the iso folder, called TU and the creates 2 files:
1) MEDIAID - to speed up the process, the first time the iso is read with abgx360 to get the mediaid, it create this file and writes the mediaid inside, and in the next run it only reads this file;
2) updates.txt - Every TU downloaded, the script writes in this file the download date, the TU version and the filename downloaded.


With this script you can put in cron to automaticaly search for new updates.

Many thanks to @molukki, without his help, this script would never exist.

Download it here: http://pastebin.com/CDyXMziZ

QUOTE

#!/bin/bash
#
# updateTitleXbox.sh
#
# by Molukki on 12 Jan 2012, 18 Jan 2012
# changed by pabloalc on 18 Jan 2012
# This file is public domain.
#
# Search all isos in a folder an download the TU

function marketplace {

echo "==== Searching for Media ID $MEDIAID on marketplace.jqe360.com"

# Search for update name and download URL from marketplace.jqe360.com
HTMLDATA=$(curl -s "http://marketplace.jqe360.com/index.php?search=$1" \
| egrep '(details&name|Direct)' | head -2 | tr -d '\n')

# Extract download URL from html data
RELATIVE_DOWNLOAD_URL=`echo $HTMLDATA | cut -d '"' -f 2`

# Get the filename from the download url HTTP headers
DOWNLOAD_FILENAME=$(
( echo "HEAD $RELATIVE_DOWNLOAD_URL HTTP/1.0"
echo "Host: marketplace.jqe360.com"
echo ) | nc marketplace.jqe360.com 80 | grep 'filename=' \
| cut -d '=' -f 2 | tr -d '\n' | tr -d '\r')

# Extract update name from html data
UPDATENAME=`echo $HTMLDATA | cut -d '>' -f 3 | cut -d '<' -f 1`

INFO="marketplace.jqe360 - `date` - $UPDATENAME - $DOWNLOAD_FILENAME"
if [ "$UPDATENAME" ]
then
INFO="marketplace.jqe360 - `date` - $UPDATENAME -
$DOWNLOAD_FILENAME"
download "$DOWNLOAD_FILENAME" \
"http://marketplace.jqe360.com$RELATIVE_DOWNLOAD_URL" \
"$INFO" "$UPDATENAME"
#else
# echo "==== No Title Updates for $MEDIAID on marketplace.jqe360"
fi
}

function xbuc {

echo "==== Searching for Media ID $MEDIAID on xbuc.net"
curl -s "http://www.xbuc.net/?searchString=$MEDIAID" \
| grep '^<td>' | tr -d '\n' | tr -d '\r' | sed 's/<\/td>/<\/td>\n/g' \
| head -n 6 | while read DATA
do
#echo -n $DATA | sed 's/<[^>]*>//g'
#echo -n " "
if [[ "$DATA" =~ "details=" ]]
then
TITLE=$(echo $DATA | sed 's/<[^>]*>//g')
fi
if [[ "$DATA" =~ "download" ]]
then
DOWNLOAD=$(echo "$DATA" | cut -d "'" -f 2 | sed 's/\&/\&/g')
LOCATION=$(curl -s -D - http://www.xbuc.net/$DOWNLOAD \
| grep Location: | cut -d ' ' -f 2- | tr -d '\n' | tr -d '\r')
if [ "${LOCATION##*/}" ]
then
INFO="xbuc.net - `date` - $TITLE - ${LOCATION##*/}"
download "${LOCATION##*/}" "$LOCATION" "$INFO" "$TITLE"
#else
# echo "== No Title Updates for $MEDIAID on xbuc.net"
fi
fi
done
}

function download {

UPDATEFILE="$DIRECTORY/TU/$1"
if [ -f "$UPDATEFILE" ];
then
echo "====== Title Update already exist in: $UPDATEFILE"
else
echo "====== Downloading $4"
wget -q -O "$DIRECTORY/TU/$1" --tries=1 $2
if [ -f "$UPDATEFILE" ]; then
echo "$3">>"$DIRECTORY/TU/updates.txt"
fi

fi

}



if [ "x$1" == "x" ]
then
echo "Usage:"
echo "$0 <xbox360_image.iso>"
echo "or:"
echo "$0 <folder with xbox360 isos>"
exit 1
fi
find "$1" -iname "*.iso" -print0 | while read -d $'\0' file
do
DIRECTORY=${file%/*}
echo "=============================================================="
echo "== Processing $DIRECTORY"
if [ ! -d "$DIRECTORY/TU" ]; then
mkdir "$DIRECTORY/TU"
fi
if [ -f "$DIRECTORY/TU/MEDIAID" ]; then
MEDIAID=`cat "$DIRECTORY/TU/MEDIAID"`
else
echo "== Executing abgx360 to get MediaID"
MEDIAID=$(abgx360 -swordv --noheader --dontparsefs "$file" \
| grep -i "XEX Media ID" | head -1 | cut -d '-' -f 2)
echo $MEDIAID >"$DIRECTORY/TU/MEDIAID"
fi

if [ "x$MEDIAID" == "x" ]
then
echo "No Media ID found. (Not an XBox360 iso?)"
exit 1
fi

marketplace $MEDIAID
xbuc $MEDIAID

done


#2 slumberpod77

slumberpod77

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,478 posts
  • Location:Portland, Oregon
  • Interests:music, music, music, computers, audio engineering, gaming, code monkeying, music again
  • Xbox Version:v1.1
  • 360 version:v1 (xenon)

Posted 29 January 2012 - 05:20 AM

This is the sort of thing most people wouldn't need, but I store an archive of my 360 games on a Linux server box and was actually intending to do something similar.
The only difference: I don't keep my games in ISO format, I unpack them to their files. However, I should be able to use your script as a starting point. Will post my results if / when I get this done.
Thank you for posting this!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users