plh/ 0000755 0002032 0000062 00000000000 10060466643 012302 5 ustar wavexx staff 0000000 0000000 plh/ices/ 0000755 0002032 0000062 00000000000 10060466152 013220 5 ustar wavexx staff 0000000 0000000 plh/ices/bin/ 0000755 0002032 0000062 00000000000 07714157737 014012 5 ustar wavexx staff 0000000 0000000 plh/ices/bin/search-noc 0000755 0002032 0000062 00000000262 10060466343 015742 0 ustar wavexx staff 0000000 0000000 #!/bin/sh
# search for ogg files without comments
find $1 -name "*.ogg" | while read file
do
lines="`vorbiscomment -l \"$file\" | wc -l`"
(( $lines == 0 )) && echo $file
done
plh/ices/bin/plh 0000755 0002032 0000062 00000004124 07714156727 014522 0 ustar wavexx staff 0000000 0000000 #!/usr/bin/env perl
use warnings;
use strict;
use Fcntl ":flock";
# some needed modules
use File::Basename "basename";
# compose some paths
my $prg = basename $0;
my $base = ($ARGV[0]? $ARGV[0]: ".");
my $playlist = $base . "/etc/playlist.txt";
my $position = $base . "/var/position";
my $current = $base . "/var/current";
my $req = $base . "/var/requests";
# check needed files
exit 1 if(!-f $playlist);
# concurrent file read/writing
sub shOpen($$)
{
my ($name, $mode) = @_;
if($mode == LOCK_SH) {
$name = "<$name";
} else {
$name = ">$name";
}
my $fd;
open $fd, $name or return;
flock $fd, $mode or close $fd and return;
return $fd;
}
sub shClose($)
{
my ($fd) = @_;
flock $fd, LOCK_UN;
close $fd;
}
# load files into arrays
sub loadArr($\@)
{
my ($file, $arr) = @_;
my $fd = shOpen $file, LOCK_SH or return;
while(<$fd>)
{
next if(/^\s*$/);
push @$arr, $_;
}
shClose $fd;
}
sub saveArr($\@)
{
my ($file, $arr) = @_;
my $fd = shOpen $file, LOCK_EX or die;
foreach my $e(@$arr) {
print $fd $e;
}
shClose $fd;
}
sub loadPos()
{
my $fd = shOpen $position, LOCK_SH or return 0;
$_ = <$fd>;
my ($number) = /(\d+)/;
shClose $fd;
return $number;
}
sub savePos($)
{
my ($pos) = @_;
my $fd = shOpen $position, LOCK_EX or die;
print $fd "$pos\n";
shClose $fd;
}
sub saveCur($)
{
my ($cur) = @_;
my $fd = shOpen $current, LOCK_EX or die;
print $fd "$cur\n";
shClose $fd;
}
# load basic files
my @plArr;
my @reqArr;
my $pos;
loadArr $playlist, @plArr;
loadArr $req, @reqArr;
if(@reqArr)
{
# satisfy requests, discarding consecutive duplicates
$_ = shift @reqArr;
($pos) = /(\d+)/;
while(@reqArr && $reqArr[0] == $_) {
shift @reqArr;
}
# check for upper bounds
$pos = 0 if(!$pos || $pos > $#plArr);
# save the requests back
saveArr $req, @reqArr;
}
else
{
# advance the playlist
$pos = loadPos;
# advance the playlist and echo the file
++$pos;
$pos = 0 if($pos > $#plArr);
# save-back the position
savePos $pos;
}
# current song
saveCur $pos;
# echo the new file
print $plArr[$pos];
plh/var/ 0000755 0002032 0000062 00000000000 10060466152 013065 5 ustar wavexx staff 0000000 0000000 plh/var/www/ 0000755 0002032 0000062 00000000000 10060466152 013711 5 ustar wavexx staff 0000000 0000000 plh/var/www/radio/ 0000755 0002032 0000062 00000000000 07727616230 015021 5 ustar wavexx staff 0000000 0000000 plh/var/www/radio/playlist.pl 0000755 0002032 0000062 00000011175 07713764274 017236 0 ustar wavexx staff 0000000 0000000 #!/usr/bin/perl
use strict;
use warnings;
use Fcntl ":flock";
# Some constants
my $base = "/home/ices";
my $playlist = $base . "/etc/playlist.txt";
my $playroot = $base . "/";
my $position = $base . "/var/position";
my $requests = $base . "/var/requests";
my $current = $base . "/var/current";
my $reqUri = "request";
my $nfoUri = "info";
my $bps = 15000;
# Request a song and song informations
sub req($)
{
my ($id) = @_;
return "#$id";
}
# Load a position from a file
sub loadPos($)
{
# read the file
my ($file) = @_;
open FD, "<$file" or return 0;
flock FD, LOCK_SH;
$_ =
Total playing time: $time hours ($days days) +
$qtime for requests.
Informations about song #$id
Author
Album
Title
Approx time
};
sub basicInterp(\$)
{
my $r = shift;
$_ = $$r;
$_ = "" if(!$_);
s/_/ /g;
s/-$//;
s/^pool\///;
s/\.ogg$//;
# html stuff
s/</g;
s/>/>/g;
s/&/&/g;
s/"/"/g;
# Capitalize the first letter
s/^(\w)/\U$1\E/;
$$r = $_;
}
# Convert sizes to hh:ss
sub hs($)
{
my $size = shift;
my $time = $size / $bps;
sprintf("%02d:%02d", $time / 60, $time % 60);
}
# The playlist
my $n = 1;
my $total = 0;
my $time;
my $qtime = 0;
if(open PL, "<$playlist")
{
my $file;
my $size;
while( };
}
print qq
{
On queue: };
foreach my $elem(sort {$queue{$a} <=> $queue{$b}} keys %queue) {
print qq{#$elem };
}
print q{
$pre$uri$aft
$pre$author$aft
$pre$album$aft
$pre$title$aft
$pre$time$aft
};
++$n;
$total += $size;
}
close PL;
};
# Statistics at the end
$time = int($total / $bps / 3600);
my $days = int($time / 24);
$qtime = hs($qtime);
# footer
print qq
{
Legend:
Current playlist position,
Song being played,
Queued song
$info
info:
Request informations about an id.
info?id
playlist:
Show the playlist and the queue.
request:
Enqueue a song.
request?id
request?da-a
seek:
Seek in the playlist.
seek?id