ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/tpb/fsck
Revision: 1.1
Committed: Sun Sep 27 07:55:20 2015 UTC (8 years, 8 months ago) by root
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/opt/bin/perl
2    
3     BEGIN { require "common.pl" }
4     our ($TXN, %stat, $db_env, $TPB, $db_info, $TODAY);
5    
6     use common::sense;
7     use BDB;
8     use JSON::XS;
9     use Bencode;
10     use CBOR::XS;
11    
12     #############################################################################
13    
14     our $db_http = table "http";
15     our $db_torrent = table "torrent";
16    
17     #############################################################################
18    
19     #db_compact $db_http, undef, undef, undef, undef, 0, undef;
20    
21     my @del_http;
22     my @del_torrent;
23    
24     if(1)
25     {
26     my $c = $db_torrent->cursor;
27    
28     while () {
29     db_c_get $c, my $key, my $data, BDB::NEXT;
30     last if $!;
31    
32     syswrite STDOUT, "\rT $key ";
33    
34     unless (ref eval { Bencode::bdecode $data, 1, 32 }) {
35     print "bdecode error $@";
36     iput $key, [0, 1];
37     push @del_torrent, $key;
38     }
39     }
40     }
41    
42     if(0)
43     {
44     my $c = $db_http->cursor;
45    
46     while () {
47     db_c_get $c, my $key, my $data, BDB::NEXT;
48     last if $!;
49    
50     syswrite STDOUT, "\rH $key ";
51    
52     unless ((dic_decompress 0, $data) =~ m% href="magnet:\?xt=urn:btih:([0-9a-f]*)&dn%) {
53     print +(dic_decompress 0, $data), "\nno magnet";
54     iput $key, [0, 1];
55     push @del_http, $key;
56     push @del_torrent, $key;
57     };
58     }
59     }
60    
61     db_del $db_http , undef, $_ for @del_http;
62     db_del $db_torrent, undef, $_ for @del_torrent;
63