source: lab.git/misc/torrent2filelist.pl @ dea39ad

trunk
Last change on this file since dea39ad was 54536a4, checked in by mitty <mitty@…>, 13 years ago
  • parse .torrent file and print list of files
  • this script couldn't many .torrent file because of Convert::Bencode bugs like below
    Use of uninitialized value $item in string eq at Perl/site/lib/Convert/Bencode.pm line 127.
    Use of uninitialized value $item in string eq at Perl/site/lib/Convert/Bencode.pm line 138.
    Use of uninitialized value $item in string eq at Perl/site/lib/Convert/Bencode.pm line 148.
    

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@135 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100644
File size: 616 bytes
Line 
1#! /usr/bin/perl -w
2
3use strict;
4use warnings;
5
6use Net::BitTorrent::File;
7use Data::Dumper;
8
9my $torretfile = shift @ARGV;
10my $torrent = Net::BitTorrent::File->new($torretfile) or
11    die "$0: cannot load torrent file: $torretfile";
12
13my $files = $torrent->files;
14if ($files) {
15    foreach my $file (@$files) {
16        if (exists $file->{'path.utf-8'}) {
17            print $torrent->name, "/", join ("/", @{ $file->{'path.utf-8'} }), "\n";
18        }
19        else {
20            print $torrent->name, "/", join ("/", @{ $file->{'path'} }), "\n";
21           
22        }
23    }
24}
25else {
26    print $torrent->name, "\n";
27}
Note: See TracBrowser for help on using the repository browser.