Hello, I have basically the same process : a server that listens for incoming UDP messages directly from Rivendell, and fills up a database with the full log, along with the start time/date, etc. Then, a display interface allows for a simple listing of the last /n/ songs, as well as a search function. The result is : http://playinfo.radiom.fr.
The server itself is coded in PHP, and its a forever runnning script :
<?php
// Run this script with no time limitation, invoke it with "php -f
script.php &"
// or a more elegant method to daemonize
set_time_limit(0);
// Create the UDP listening socket
$socket = stream_socket_server("udp://0.0.0.0:8520", $errno, $errstr,
STREAM_SERVER_BIND);
if (!$socket) {
die("$errstr ($errno)");
}
// Receive the UDP messages
do {
$pkt = stream_socket_recvfrom($socket, 1500, 0, $peer);
// Do some stuff with the $pkt variable, like parsing it, and using
its data to fill up a database
// Add some "intelligence", by having Rivendell sending default
carts on specific events,
// and handle them here accordingly
} while ($pkt !== false);
?>
... and voilà !
Hope it helps.
Le 17/11/2014 16:38, Robert Orr a écrit :
> I run two scripts the first one just listens to port 5007 and copies
> the now next stuff to a file called nn.temp
>
> nc -luk 5007 |tee /home/rd/nn2.temp | nc -u roborr.com
> <http://roborr.com> 5007
>
> The next one simply sets variables to the previous played value and
> outputs a php page.
>
> #!/bin/bash
> while true
> do
>
> artist=`tr "%^" "\n" </home/robert/scripts/nn2.temp|grep -a ZZ|sed
> s/ZZ//g| sed '/./,/^$/!d'`
> album=`tr "%^" "\n" </home/robert/scripts/nn2.temp|grep -a XX|sed
> s/XX//g |sed '/./,/^$/!d'`
> song=`tr "%^" "\n" </home/robert/scripts/nn2.temp|grep -a QQ|sed
> s/QQ//g |sed '/./,/^$/!d'`
> asin=`tr "%^" "\n" </home/robert/scripts/nn2.temp|grep -a ZX|sed
> s/ZX//g |sed '/./,/^$/!d'`
> if [ "$artist" ]
> then
>
> cat /dev/null >/home/robert/scripts/nn2.temp
> artist6=$artist5
> artist5=$artist4
> artist4=$artist3
> artist3=$artist2
> artist2=$artisttemp
> artisttemp=$artist
> albumArt6=$albumArt5
> albumArt5=$albumArt4
> albumArt4=$albumArt3
> albumArt3=$albumArt2
> albumArt2=$albumArttemp
> albumArttemp=$albumArt
> album6=$album5
> album5=$album4
> album4=$album3
> album3=$album2
> album2=$albumtemp
> albumtemp=$album
> song5=$song4
> song4=$song3
> song3=$song2
> song2=$songtemp
> songtemp=$song
> asin6=$asin5
> asin5=$asin4
> asin4=$asin3
> asin3=$asin2
> asin2=$asintemp
> asintemp=$asin
> ptime6=$ptime5
> ptime5=$ptime4
> ptime4=$ptime3
> ptime3=$ptime2
> ptime2=$ptime1
> ptime1=`date +%R`
> echo -e "<?xml version="1.0" standalone="yes"?>
> <nowplaying>
> <artist>$artist</artist>
> <albumArt></albumArt>
> <album>$album</album>
> <song>$song</song>
> <asin>$asin</asin>
> <artist2>$artist2</artist2>
> <albumArt2></albumArt2>
> <album2>$album2</album2>
> <song2>$song2</song2>
> <asin2>$asin2</asin2>
> <artist3>$artist3</artist3>
> <albumArt3></albumArt3>
> <album3>$album3</album3>
> <song3>$song3</song3>
> <asin3>$asin3</asin3>
> <artist4>$artist4</artist4>
> <albumArt4></albumArt4>
> <album4>$album4</album4>
> <song4>$song4</song4>
> <asin4>$asin4</asin4>
> <artist5>$artist5</artist5>
> <albumArt5></albumArt5>
> <album5>$album5</album5>
> <song5>$song5</song5>
> <asin5>$asin5</asin5>
> <artist6>$artist6</artist6>
> <albumArt6></albumArt6>
> <album6>$album6</album6>
> <song6>$song6</song6>
> <asin6>$asin6</asin6>
> </nowplaying>" >/home/robert/scripts/nowplaying.xml
>
> echo -e "
> <?php include \"includes/top.inc\" ?> <title>Free 100.3 FM
> : Saskatoon Christian Radio</title> <?php include
> \"includes/middle.inc\" ?> <h2
> class=\"pagetitle\">Recently Played</h2>
> $song2 by $artist2 at $ptime2<p>
> $song3 by $artist3 at $ptime3<p>
> $song4 by $artist4 at $ptime4<p>
> $song5 by $artist5 at $ptime5<p>
>
> <?php include \"includes/bottom.inc\" ?>"
> >/home/robert/scripts/recentlyplayed.php
>
>
> fi
> sleep 2
> done
> exit 0
>
>
>
> On Sun, Nov 16, 2014 at 7:52 PM, Lee Baker <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi All,
>
> Just wondering has any written anything that can display the last 5-10
> songs that were played, currently playing and next to play for their
> website?
>
> Maybe a perl script or something that updates the data and parses
> to PHP.
>
> Cheers
> Lee
>
>
> _______________________________________________
> Rivendell-dev mailing list
> [email protected]
> <mailto:[email protected]>
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
>
>
>
>
> _______________________________________________
> Rivendell-dev mailing list
> [email protected]
> http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Rivendell-dev mailing list [email protected] http://caspian.paravelsystems.com/mailman/listinfo/rivendell-dev
