#!/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;