/[pgestraier]/trunk/data/convert.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/data/convert.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 83 - (show annotations)
Wed Jan 17 22:30:14 2007 UTC (17 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 660 byte(s)
restructure IMDB trivia parser, added db target to create
trivia database in PostgreSQL
1 #!/usr/bin/perl -w
2
3 use strict;
4 use parse_trivia;
5
6 # score for words in title
7 my $title_rank = 3;
8
9 open(my $t, "gzip -cd trivia.list.gz |") || die "can't open trivia.list.gz: $!";
10
11 my $nr = 1;
12
13 parse_trivia($t, sub {
14
15 my $a = {@_};
16
17 my $out = '@title=' . $a->{title} . "\n" .
18 '@size=' . length($a->{trivia}) . "\n";
19 $out .= "year=$a->{year}\n" if ($a->{year});
20 $out .= 'quote=' . join(",", $a->{qv}) . "\n" if ($a->{qv});
21 $out .= "\n$a->{trivia}\n" .
22 ("\t$a->{title}\n" x $title_rank) .
23 "\t" . join("\n\t", @{ $a->{qv} }) . "\n";
24
25 open(my $t, "> trivia/$nr.est") || die "can't open $nr.est: $!";
26 print $t $out;
27 close($t);
28 $nr++;
29 });

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26