View Full Version : .ty XML position?
pidhead
04-29-2004, 06:31 PM
What is the proper way to seek to the XML data at the end of a .ty file?
Is the offset from the end always the same? I've searched through AVS and DD, but the simple answer isn't jumping out at me.
I'm working on a perl tool to track my downloads, so I thought I'd do it right and use the xml.
Thanks.
lart2150
05-01-2004, 01:27 AM
are you talking about the xml that msf_ftp puts in? if so it's right after the last chunk
pidhead
05-04-2004, 07:08 PM
yes, the XML at the end of the ty is what I want. I don't know anything about the "chunks" so I am asusming that somewhere in the last 8000 bytes of the file will contain the entire XML. (Probably overkill to seek 8000 back, but it doesn't hurt.)
Are the chunks a specified length?
I am using the following to extract the XML. Are there any problems with the above assumption?
#!/usr/bin/perl
$file = @ARGV[0];
open(ty_file, $file) || die "Unable to open file. \n";
binmode ty_file;
seek(ty_file,-8000,2);
read(ty_file, $buffer, 8000);
$buffer =~ m/\#*\n(<.*>)\n\n\#*/s;
$xml = $1;
print $xml;
close(ty_file);
sanderton
05-04-2004, 07:40 PM
Look at the mfs_ftp code to see how Riley puts it in.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.