[mythtv-users] Streaming tv/radio stations for use with MythStream

Donny F donny911 at hotmail.com
Mon Sep 25 19:50:37 UTC 2006


Hey guys. I've created a website that can be used in conjunction with 
MythStream for finding streaming tv/radio stations.

What makes the site I created different from others of it's type is that I 
do not hide the url of the stream nor do I force the user to use an embedded 
application to view the stream on the website only. With my site, you can 
download the playlists and use them in the media player you prefer. This 
opens the site up to all users with suitable media players regardless of OS.

Also, the website is community based. Users are able to submit new 
stationss, report stations as nonfunctional, submit edits to station 
information, and rate stations. You'll also notice that there are no ads on 
the website. I intend to keep it this way. I am not interested in making a 
profit for providing links to other's streaming stations. I do have a donate 
button on the site for those interested in helping with hosting costs, but 
users will never be required to donate to use the website.

Registered users can generate their own custom playlists and can use their 
playlist url (found under User Profile) to automatically acquire the most 
up-to-date version of their playlist (with nonfunctional streams reported no 
longer included in the playlist being downloaded).

I have worked with Eric, the author of Mythstream 
(http://home.kabelfoon.nl/~moongies/streamtuned.html), on integrating 
Mythstream and the user's playlist url. He has provided this script:

wwmp_pls.pl

--- Start ---

#! /usr/bin/perl
#* ============================================================
# * File        : wwmp_pls.pl
# * Version     : 0.1
# * Author      : Eric
# * Date        : 2006-09-11
# * Description : parser for World Wide Media Project user playlist
# *               (http://www.worldwidemediaproject.com)
# *
# * To use this parser
# * 1) copy this parser to ~/.mythtv/mythstream/parsers/wwmp/wwmp_pls.pl
# * 2) copy the Playlist URL from your user account profile on the
# *    World Wide Media Project site.
# * 3) add this stream item in MythStream:
# *      Stream Name   : My WWMP Favorites
# *      Stream URL    : [your Playlist URL]
# *      Stream Handler: wwmp/wwmp_pls
# *
# *
# * ============================================================ */

use English;
use XML::DOM;
use HTML::Entities;

#------------------------------------------------------------------------------
# Init
#------------------------------------------------------------------------------

&read_parse();    # get commandline parameters into @in
$source = $in[0]; # source filename from command line

my $doc = XML::DOM::Document->new;
my $head = $doc->createXMLDecl ('1.0');
my $root = $doc->createElement('items');

sub newNode
{
  local $name  = shift;
  local $value = shift;
  local $node = $doc->createElement($name);
  local $text = $doc->createTextNode($value);
  $node->appendChild($text);

  return $node;
}

#------------------------------------------------------------------------------
# read file into $data
#------------------------------------------------------------------------------

$datafile = $source;
open( INFO, "<$datafile" );      # Open file for reading
undef $/;
$data = <INFO>;                 # Read all
close(INFO);

#------------------------------------------------------------------------------
# Parse playlist
#------------------------------------------------------------------------------

# file1=mms://uasmedia.uas.alaska.edu/wmtencoder/uasbroadcast.wmv
# Title1=[United States][English]University of Alaska

sub dump_lines
{
  @lines = split ( "\n", $data);
  foreach $line(@lines)
  {
    if (@matches = ( $line =~ m/Title\d+=\[(.*)\]\[(.*)\](.*)$/ ) )
    {
      $country  = @matches[0];
      $language = @matches[1];
      $name     = @matches[2];

      @matches = ( $prevLine =~ m/file\d+=(.*)$/ );
      $url = @matches[0];

      $item = $doc->createElement('item');
      $root->appendChild($item);

      $name = decode_entities($name);

      $item->appendChild( newNode('name', $name) );
      $item->appendChild( newNode('url', $url) );
      $item->appendChild( newNode('descr', "Country: $country, Language: 
$language") );

      # This action meta node requires the stations stationid, not yet 
present in
      # ubustream or pls format
      # When user selects "mark as nonfunctional", MythStream performs that 
action,
      # and displays a message based on the server response.

        #$stationid = "";
        #$meta = $doc->createElement('meta');
        #$meta->appendChild( newNode('name'   , 'action: mark as 
nonfunctional') );
        #$meta->appendChild( newNode('content', 
"wwmp/wwmp_act|marknf|$stationid") );
        #$meta->appendChild( newNode('viewer' , 'url') );
        #$item->appendChild( $meta );
    }

    $prevLine = $line;
  }
}

#------------------------------------------------------------------------------
# search url's in $data and place them in special format
#------------------------------------------------------------------------------

&dump_lines();

print $head->toString;
print $root->toString;
print "\n";

#--------------------------------------------------------------------------------
# get command line parameters
#--------------------------------------------------------------------------------

sub read_parse
{
  local (*in) = @_ if @_;
  local ($i);
  push(@in, @ARGV);
  foreach $i (0 .. $#in) { $in[$i] =~ s/\+/ /g;}
  return scalar(@in);


--- End ---


Follow the instructions in the script header and all should be well.

I hope that some of you find this interesting. I would like to hear any of 
your comments and/or suggestions on improving the website..

Oh yeah, here's the link:

http://www.worldwidemediaproject.com

If you have any stations not listed, please add them for the other users of 
the site.




More information about the mythtv-users mailing list