The online racing simulator
team INFERNO Setupfield Snapshot
(16 posts, started )
team INFERNO Setupfield Snapshot
Is this something you've done manually?

If so, top stuff! :up:
#4 - herki
would be nice to see that updated monthly
Initially I did it by hand, it didn't take all that long actually, just had each page open in a new tab in firefox. But after doing that once I didn't want to have to do it again, so I wrote a perl script that can download all of them automatically.
It is not exactly fast(has to look up the fastest set for a given track/car then download it, so it is waiting on the http requests a lot), but you can just let it run and it will get them all for sure. I ran it earlier and got 133 reverse and 242 standard setups. Which is wierd because I got 245 earlier doing it by hand...

The script assumes you have a setups folder at the same level as the script to put them in.


# This is a script to download all of the current fastest times as held by the team Inferno setup field
#
# The url to get the page is http://setupfield.teaminferno.hu/?p_section=setupdetails&p_config_id=[TRACK INDEX]&p_car_id=[CARINDEX]&p_version=S2
# to download an actual setup it is http://setupfield.teaminferno.hu/setupdownload.php?p_setup_usage_id=[SETUP ID]
# so have to lookup on the track/car page to find the fastest setup id, then download it
#
# Brandon Green 1-2-06


$SetupfieldURL="http://setupfield.teaminferno.hu/";

use File::Basename;
use Win32::Internet;
$|=1; #force immediate output of print command(no waiting for endline to output progress)

#These were found by looking at the html code of the setupfield page
@CarNames=('XF GTi','XR GT','XR Turbo','RB4','FXO','LX4','LX6','MRT5','UF 1K','RA','FZ50','FOX','XF GTR','UF GTR','F08','FXO GTR','XR GTR','FZ50 GTR');
@CarIndex=( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);

@TrackNames=('BL GP','BL RX','SO Classic','SO Sprint1','SO Sprint2','SO Long','SO Town','FE Club','FE Green','FE Gold','FE Black','FE RX','FE RX Green','AS Cadet','AS Club','AS Nat','AS Hist','AS GP','KY Oval','KY National','KY GP','WE Int','Drag','Drift');
@TrackIndex=(1,3,5,8,9,7,43,10,11,12,6,13,14,25,27,29,31,33,35,37,39,41,45,46);
@RevTrackIndex=(2,4,15,18,19,17,44,20,21,22,16,23,24,26,28,30,32,34,36,38,40,42);

$cur_name=0;
$inet = Win32::Internet->new();

#!!
# to download reverse track setups this should be changed to RevTrackIndex
#!!
foreach $track (@TrackIndex)
{
print "Downloading setups for track ".$TrackNames[$cur_name]."\t";

foreach $car (@CarIndex)
{
print ".";

#get the page that lists all of the setups for this track/car combo
$webpage = $inet->FetchURL( $SetupfieldURL."?p_section=setupdetails&p_config_id=".$track."&p_car_id=".$car."&p_version=S2" );

#split up the individual lines of the html file
@filedata=split(/\n/,$webpage);

foreach $line (@filedata)
{
#search every line to see if this line has the setup id on it
$pos=index $line, "setupdownload.php";

#if this is the line that has setup id on it
if ($pos>0)
{
#get the setup id from the line
@lineparts=split(/></,$line);
$filepath=substr($lineparts[0],$pos,-1);

$inet->OpenURL($url, $SetupfieldURL.$filepath);
#print "error was ".$inet->Error()."\n";
#print "data available ".$url->QueryDataAvailable()."\n"; #this should be 132 bytes!
#print "error was ".$inet->Error()."\n";

#get the filename of the setup
$filename = basename($url->QueryOption(33));
$filename=substr($filename, 0, -7).substr($filename,-4); #for some reason it has that pesky [1] right before the .set

#save the setup
open(OUTPUTFILE, ">./setups/$filename") or die "Couldn't open ./setups/$filename\n";
binmode(OUTPUTFILE);
print OUTPUTFILE $url->ReadEntireFile();
close(OUTPUTFILE);

$url->Close();

#only get the first setup, so break out of foreach $line (@filedata) loop
last;
}
}
}

print "\n";

$cur_name++;
}


bump for editing in the reverse sets in first post
thanks!
#8 - Lible
Thank you!
#9 - axus
Very nice!
Excellent pack ! Great thanks !
As a stuggling noob! I salute you.

Z06Vette
Nice one, thanks Brandon
Outstanding!!!!!!!
#14 - Jakg
Quote from BrandonAGr :Initially I did it by hand, it didn't take all that long actually, just had each page open in a new tab in firefox. But after doing that once I didn't want to have to do it again, so I wrote a perl script that can download all of them automatically.
It is not exactly fast(has to look up the fastest set for a given track/car then download it, so it is waiting on the http requests a lot), but you can just let it run and it will get them all for sure. I ran it earlier and got 133 reverse and 242 standard setups. Which is wierd because I got 245 earlier doing it by hand...

The script assumes you have a setups folder at the same level as the script to put them in.


# This is a script to download all of the current fastest times as held by the team Inferno setup field
#
# The url to get the page is http://setupfield.teaminferno.hu/?p_section=setupdetails&p_config_id=[TRACK INDEX]&p_car_id=[CARINDEX]&p_version=S2
# to download an actual setup it is http://setupfield.teaminferno.hu/setupdownload.php?p_setup_usage_id=[SETUP ID]
# so have to lookup on the track/car page to find the fastest setup id, then download it
#
# Brandon Green 1-2-06


$SetupfieldURL="http://setupfield.teaminferno.hu/";

use File::Basename;
use Win32::Internet;
$|=1; #force immediate output of print command(no waiting for endline to output progress)

#These were found by looking at the html code of the setupfield page
@CarNames=('XF GTi','XR GT','XR Turbo','RB4','FXO','LX4','LX6','MRT5','UF 1K','RA','FZ50','FOX','XF GTR','UF GTR','F08','FXO GTR','XR GTR','FZ50 GTR');
@CarIndex=( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26);

@TrackNames=('BL GP','BL RX','SO Classic','SO Sprint1','SO Sprint2','SO Long','SO Town','FE Club','FE Green','FE Gold','FE Black','FE RX','FE RX Green','AS Cadet','AS Club','AS Nat','AS Hist','AS GP','KY Oval','KY National','KY GP','WE Int','Drag','Drift');
@TrackIndex=(1,3,5,8,9,7,43,10,11,12,6,13,14,25,27,29,31,33,35,37,39,41,45,46);
@RevTrackIndex=(2,4,15,18,19,17,44,20,21,22,16,23,24,26,28,30,32,34,36,38,40,42);

$cur_name=0;
$inet = Win32::Internet->new();

#!!
# to download reverse track setups this should be changed to RevTrackIndex
#!!
foreach $track (@TrackIndex)
{
print "Downloading setups for track ".$TrackNames[$cur_name]."\t";

foreach $car (@CarIndex)
{
print ".";

#get the page that lists all of the setups for this track/car combo
$webpage = $inet->FetchURL( $SetupfieldURL."?p_section=setupdetails&p_config_id=".$track."&p_car_id=".$car."&p_version=S2" );

#split up the individual lines of the html file
@filedata=split(/\n/,$webpage);

foreach $line (@filedata)
{
#search every line to see if this line has the setup id on it
$pos=index $line, "setupdownload.php";

#if this is the line that has setup id on it
if ($pos>0)
{
#get the setup id from the line
@lineparts=split(/></,$line);
$filepath=substr($lineparts[0],$pos,-1);

$inet->OpenURL($url, $SetupfieldURL.$filepath);
#print "error was ".$inet->Error()."\n";
#print "data available ".$url->QueryDataAvailable()."\n"; #this should be 132 bytes!
#print "error was ".$inet->Error()."\n";

#get the filename of the setup
$filename = basename($url->QueryOption(33));
$filename=substr($filename, 0, -7).substr($filename,-4); #for some reason it has that pesky [1] right before the .set

#save the setup
open(OUTPUTFILE, ">./setups/$filename") or die "Couldn't open ./setups/$filename\n";
binmode(OUTPUTFILE);
print OUTPUTFILE $url->ReadEntireFile();
close(OUTPUTFILE);

$url->Close();

#only get the first setup, so break out of foreach $line (@filedata) loop
last;
}
}
}

print "\n";

$cur_name++;
}



do you have a compiled version of this?

team INFERNO Setupfield Snapshot
(16 posts, started )
FGED GREDG RDFGDR GSFDG