trunk
Rev | Line | |
---|
[b804ca6] | 1 | #! /usr/bin/perl -w |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | |
---|
| 6 | my $exec = 'dumptorrent-1.2.exe'; |
---|
| 7 | |
---|
| 8 | my $torrent = shift @ARGV; |
---|
| 9 | |
---|
| 10 | if (! -f $torrent) { |
---|
| 11 | die "$0: file doesn't exit: $torrent"; |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | my @output = `$exec "$torrent" 2>&1`; |
---|
| 15 | |
---|
| 16 | my ($name, @files); |
---|
| 17 | |
---|
| 18 | while (my $line = shift @output) { |
---|
| 19 | |
---|
| 20 | if (!$name and $line =~ /^Name:\s+(.*)$/) { |
---|
| 21 | $name = $1; |
---|
| 22 | } |
---|
| 23 | if ($line =~ /^Files:/) { |
---|
| 24 | while ($line = shift @output) { |
---|
| 25 | if ($line =~ /^\s+(.+\w)\s+\d+( \([0-9\.]+[KM]\))?$/) { |
---|
| 26 | push (@files, $1); |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | foreach my $file (@files) { |
---|
| 33 | print "$torrent\t$name\t$file\n"; |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.