Towbar4
- Read more about Towbar4
- Log in or register to post comments
Deprecated: Array and string offset access syntax with curly braces is deprecated in /customers/b/1/2/patrikhermansson.se/httpd.www/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php on line 479
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:
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-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
<?
//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