#!/usr/bin/perl use localbucky; use URI::Escape; $dbh = DBI->connect ($dsn); our ($USER, $lastlog) = checkin(); our $loggedin = ($USER != -1); our ($t, $kw, $files) = playlist_init(); playlist_run($t, $kw, $files); sub playlist_run { my ($t, $kw, $files) = @_; my $sorty = sub { sort {lc($a->{filename}) cmp lc($b->{filename})} @_ }; my $z_title = $t->{title}; my $z_link = qq($BUCKY/).details_link().qq(/$t->{id}); $z_link .= get_revision($t) if ($USER != -1); my $rss = <<__RSS__; $z_title $z_link __RSS__ foreach my $file ($sorty->(@$files)) { next if (($file->{username} ne $USER->{username}) && $file->{private} && !$whitelist && $USER->{ulevel} != 3); next unless ($file->{filename} =~ /mp3$/i); my $z_file = $file->{filename}; my $z_filepath = uri_escape($file->{filename}); my $z_content = "https://$BUCKY_HOST$live_path/$file->{thread}/$z_filepath"; $rss .= <<__RSS__; $z_file $z_content __RSS__ } $rss .= "\n\n"; print "Content-type: text/xml\n\n"; $rss =~ s/&/&/g; print $rss; } sub playlist_init { $input->{id} ||= $input->{object_from_uri} if defined($input->{object_from_uri}); my $id = exists($input->{id}) ? $input->{id} : error("No such thread!"); my $t = get_thread($id); error("No such post.") if ($t == -1); my $kw = get_keyword($t->{keyword}); my $files = get_files($t->{id}); # my $comments = get_comments ($t->{id}); if ( ! check_privacy($t, $kw) ) # || check_participation($files, $comments) ) #unless ( check_privacy($t, $kw) || check_participation($files, $comments) ) { error("No such post!"); } # Reset NULL viewed if ( ! $t->{viewed} ) { $t->{viewed} = 0; } # Increment viewed for this thread # $t->{viewed}++; # Update thread viewed count # update_thread_viewed( $t->{id}, $t->{viewed} ); return ($t, $kw, $files); # $comments); }