Streaming with VLC

Submitted by patrik on Tue, 2008-01-15 01:18

VLC can be used to stream media, transcode it and work as a bridge. Some examples:

Send:
su patrik -c "vlc http://www.chronixradio.com/chronixaggression/listen/listen.pls -I dummy --sout '#transcode{acodec=mpga,ab=128,aenc=ffmpeg}:standard{access=mmsh,mux=ogg,dst=192.168.0.201:8080}'"

Recieve with:
'vlc mmsh://192.168.0.201:8080' or Windows Media Player.

Send via http:
su patrik -c "vlc http://bandit.str.mtgradio.dgcsystems.net/bandit/ -I dummy --sout '#transcode{acodec=mpga,ab=128,aenc=ffmpeg}:standard{access=http,mux=ogg,dst=192.168.0.201:8080}'"

Receive:

PHP-USBLCD direct communication

Submitted by patrik on Mon, 2008-01-07 01:31

It's possible to use a Matrix Orbital USB-LCD (or a home made clone) with PHP and Linux without LCDProc or other software.
We'll need to know some commands to send to the LCD, these can be found in the manual.

The home made LCD's code and schematic is here.

The device uses the cdc-acm module and can be found as /dev/ttyACMn, where n is 0, 1 or some other number. This can be used to print to the LCD display:

<?php
//Open connection

PHP and LCDProc

Submitted by patrik on Sat, 2008-01-05 20:09

PHP-CLI code to show messages on an LCD with LCDProc.
Reference: http://lcdproc.sourceforge.net/docs/current-dev-html/x152.html

*WARNING*
Neither this code or my home-made USB-LCD works well with LCDProc, the results are unpredictive. It is possible to use the display without LCDProc, more about that soon.

<?php
//Code to communicate with LCDProc from PHP
//Lacks some error detection but works alright
//©Patrik Hermansson 2008

//Open a connection to LCDd

[PHP]Get song info from bandit.se

Submitted by patrik on Sat, 2008-01-05 19:57

<?
//This code uses bandittracker.metalscene.se to fetch info about
// what the metal web radio station bandit.se is playing right now.
//©Patrik Hermansson 2008

//URL to fetch
$url = "http://bandittracker.metalscene.se/rightspots.php";
//Fetch the web page
$str = file_get_contents($url);

//Remove and tags, leave the content
$content=strip_tags($str);

//Get the song info
preg_match('/Artist:([^<]*)Up Next/i', $content, $matches);
$songInfo = trim($matches[1]);

//Split at two or more spaces or newlines