blob: 306e01e2e6d3c324cd83cfbf070a9482f966508d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#!/usr/bin/perl
use lib "../../lib";
use Bucky;
use Bucky::Session;
my $bucky = new Bucky;
# my $session = new Bucky::Session;
print "Content-type: text/plain\n\n";
# get most recent 80 threads
# for each thread, get most recent mp3
# if no mp3, skip the thread
my $threads = $bucky->db->select("thread", "order by lastmodified desc limit 80");
foreach my $t (@$threads)
{
my $z_thread = $t->{id};
my $files = $bucky->db->select("file", "thread='$z_thread' and filename like '%mp3' order by date limit 1");
my $file = {id=>undef,filename=>undef};
if ($files)
{
$file = $files->[0];
}
my $z_title = $bucky->trim( $t->{title} );
my $z_file = $file->{'id'};
my $z_subtitle = $file->{'filename'};
$z_subtitle =~ s/[^a-zA-Z0-9 ()\.]/ /g;
$z_subtitle =~ s/_/ /g;
$z_subtitle =~ s/\s+/ /g;
$z_subtitle =~ s/^\s//;
$z_subtitle =~ s/\s$//;
print join "\t", $z_thread, $z_title, $z_subtitle, $z_file;
print "\n";
}
1;
|