Internet Radio | Page 5

Discussion in 'Listen Music' started by Anonymous, July 14, 2004.

  1. Spragleknas
    • Team MediaPortal
    • Administrator

    Spragleknas Administrator

    December 21, 2005
    Likes Received:
    +1,892 / 12
    Home Country:
    Norway Norway
    Show System Specs
    *gotto remember this thread*

  2. Google AdSense Guest Advertisement

    to hide all adverts.
  3. burdell1

    burdell1 Portal Pro

    June 8, 2006
    Likes Received:
    +0 / 0
    I second that one.... also, I am curious how to listen radio stations as well that are on the internet (like local radio stations that don't use shoutcast.) How can i do this?
  4. arjay

    arjay Portal Pro

    April 25, 2006
    Likes Received:
    Coin, Spain
    +0 / 0
    Sorry to be so feeble, but I am trying to setup internet radio following this guide and have got stuck at the point above.

    Now I can't find "Tools/Options/Myradio in either MP or mediaportal setup. I see this thread is quite old - has this section been changed in anyway or am I just being thick?


  5. arjay

    arjay Portal Pro

    April 25, 2006
    Likes Received:
    Coin, Spain
    +0 / 0
    bump - can't anyone help?

  6. deppeler

    deppeler Portal Pro

    June 23, 2006
    Likes Received:
    +0 / 0
    Does anybody have this working?
  7. mzemina
    • Premium Supporter

    mzemina Retired Team Member

    February 23, 2005
    Likes Received:
    Project Manager
    Tulsa, OK
    +13 / 0
    Home Country:
    United States of America United States of America
  8. Spagbol

    Spagbol Portal Member

    June 23, 2006
    Likes Received:
    +0 / 0
    Been mulling over the internet radio display problem so I re-wrote the VB6 code I wrote for parsing Station name, track title and bitrate from a shoutcast stream and compiled it into an activex dll. This is in the hope that it's more use to someone as I suspect it can be imported or used quite easily in a C# application (I haven't the time to figure out how to actually code it in C#). If it doesn't work in C#, then sorry!

    The dll has 2 publicly available methods. 1 called Tune which requires the server IP as a String, and the port as a Long. The VB syntax is object.Tune IPaddress, Port.
    The other is Stop and just closes the connection to the station (object.Stop).
    The results are returned in global strings named Bitrate, Station and TrackTitle.
    The dll listens to the data stream once opened and so updates the strings when the station changes the data (e.g. track title) but I cannot find a way of getting the dll to automatically resend the data as I don't think you can specify runtime paths to send variables to from a module. The easy way round is to just set up a timer to fetch the strings from the host application every 200 milliseconds or so.

    You can download the dll and sample VB project to show how it works here. It's not pretty to look at but functional and only 18 lines of code including the timer to update the labels.
    Don't forget to register and reference the dll before trying to run the app from source code.

    Here's hoping it's of use!!

    CHACAL Portal Member

    August 16, 2006
    Likes Received:
    IT Admin
    +0 / 0
    Love this plugin / add-on / what-ever-its-called...

    I have added a heap of internet radion stations, internet TV stations, web cams... everything was hunky-dory and i was fast falling in love with Media Portal...

    then one day i woke up and the "video" for streaming Internet TV doesn't work, likewise the video for streaming web cams... i still get audio for the internet TV, but no visual.

    thinking it was probably a codec failure / corruption / hicup / full moon, i installed ffdshow and whallah! back to perfect "i love media portal" performance...

    then one day i woke up and the "video" for streaming internet TV blah blah blah... not working again!!!

    whats going on here? any suggestion guys?

  10. Spagbol

    Spagbol Portal Member

    June 23, 2006
    Likes Received:
    +0 / 0
    Well, after a brief chat with the devs in which I was (quite rightly) told that only C# source could be used, I PM'd rtv the code for the dll, and the original VB program in the hopes he could port it to C#.
    That was a while back and have heard nothing since. A post in another thread prompted me to re-look at the problem and I have a hack/workaround.

    As mentioned before, I don't program in C# but wrote a program in VB6 to do the work and worked out how to integrate it.
    A couple of points to bear in mind... many shoutcast streams don't include artist, title etc. information; the formatting of the C# code isn't perfectly neat; shoutcast data is often streamed up to 15 seconds before the audio and so changes of track don't always coincide with the display - this is not a bug; this was coded and tested with version using the internal audio player only; and lastly, for obvious reasons, this will not work if 'MediaPortal always on top" is checked (might look for a solution to this one...)

    Changes needed...
    1) Changes to GUIRadio.cs
    2) Changes to g-player.cs
    3) Put shoutcastinfo.exe and shoutcastinfo.ini in the root of your MediaPortal install (usually C:\Program files\Team Mediaportal\MediaPortal)

    Lastly, you need MSWinSck.ocx registered on your machine.

    1) In GUIRadio.cs:

    change void OnClick(int itemIndex) to

    Code (Text):
    1. void OnClick(int itemIndex)
    2.       {
    3.               GUIListItem item = GetSelectedItem();
    5.               if (item == null) return;
    6.               if (item.IsFolder)
    7.               {
    8.                   if (currentPlayList != null)
    9.                   {
    10.                       currentPlayList = null;
    11.                   }
    12.                   selectedItemIndex = -1;
    13.                   LoadDirectory(item.Path);
    14.               }
    15.               else
    16.               {
    18.                   System.Diagnostics.Process proc = new System.Diagnostics.Process();
    20.                   string shoutcastpath = item.Path;
    21.                   string shoutcastfirstfourletters = (shoutcastpath.Substring(0, 4));
    22.                   if (shoutcastfirstfourletters == "http")
    23.                   {
    24.                       TextWriter tw = new StreamWriter("tempshoutcast.txt");
    25.                       tw.WriteLine(shoutcastpath);
    26.                       tw.Close();
    27.                       proc.EnableRaisingEvents = false;
    28.                       proc.StartInfo.FileName = "shoutcastinfo";
    29.                       proc.Start();
    30.                   }
    31.                      Play(item);
    32.                  GUIPropertyManager.SetProperty("#selecteditem", item.Label);
    33.               }
    34.           }
    and change void Play(GUIListItem item) to
    Code (Text):
    1.    void Play(GUIListItem item)
    2.     {                
    4.         if (MediaPortal.Util.Utils.IsPlayList(item.Path))
    5.       {
    6.         currentPlayList = new PlayList();
    7.         IPlayListIO loader = PlayListFactory.CreateIO(item.Path);
    8.         loader.Load(currentPlayList, item.Path);
    9.         if (currentPlayList.Count == 1)                    
    11.         {          
    12.                       System.Diagnostics.Process proc = new System.Diagnostics.Process();
    13.                       string shoutcastpath = item.Path;
    14.                       TextWriter tw = new StreamWriter("tempshoutcast.txt");
    15.                       tw.WriteLine(shoutcastpath);
    16.                       tw.Close();
    17.                       proc.EnableRaisingEvents = true;
    18.                       proc.StartInfo.FileName = "shoutcastinfo";
    19.                       proc.Start();
    22.           // add current directory 2 playlist and play this item
    23.           string strURL = currentPlayList[0].FileName;
    24.           currentPlayList = null;
    25.           FillPlayList();
    26.           playlistPlayer.Play(strURL);
    27.           return;
    28.         }
    29.         if (currentPlayList.Count == 0)
    30.         {
    31.           currentPlayList = null;
    32.         }
    33.         LoadDirectory(currentFolder);
    34.       }
    35.       else
    36.       {
    37.         if (currentPlayList != null)
    38.         {
    39.           // add current playlist->playlist and play selected item
    40.           string strURL = item.Path;
    41.           FillPlayList();
    42.           playlistPlayer.Play(strURL);
    43.           return;
    44.         }
    46.         // add current directory 2 playlist and play this item
    47.         RadioStation station = item.MusicTag as RadioStation;
    48.         FillPlayList();
    50.         PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC_TEMP);
    51.         for (int i = 0; i < playlist.Count; ++i)
    52.         {
    53.           PlayListItem playItem = playlist[i];
    54.           if (playItem.Description.Equals(item.Label))
    55.           {
    56.             playlistPlayer.Play(i);
    57.             break;
    58.           }
    59.         }  
    60.       }        
    61.     }
    These changes will write a temporary text file containing either the http path or the .pls file of the radio station.
    It will then launch shoutcastinfo.exe that I wrote which will parse the correct info from the text file, connect to the stream and show the relevant data.

    2) In g_player.cs

    add using System.IO; at the top...

    And change public static void Stop() to

    Code (Text):
    1. public static void Stop()
    2.     {
    3.       if (_player != null)
    4.       {
    5.         Log.Info("g_Player.Stop()");
    6.         OnStopped();
    7.         GUIGraphicsContext.ShowBackground = true;
    8.         _player.Stop();
    9.         if (GUIGraphicsContext.form != null)
    10.         {
    11.           GUIGraphicsContext.form.Invalidate(true);
    12.         }
    13.         GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED, 0, 0, 0, 0, 0, null);
    14.         GUIWindowManager.SendThreadMessage(msg);
    16.         GUIGraphicsContext.IsFullScreenVideo = false;
    17.         GUIGraphicsContext.IsPlaying = false;
    18.         GUIGraphicsContext.IsPlayingVideo = false;
    19.         CachePlayer();
    21.         TextWriter tw = new StreamWriter("tempshoutcast.txt");
    22.         tw.WriteLine("Stopped");
    23.         tw.Close();
    24.       }
    25.     }
    This will unload the module when shoutcast playback is stopped, through any means including exiting MediaPortal.

    3) Place the shoutcastinfo.exe and .ini files in your MediaPortal directory. The files can be downloaded from here.

    The way the information box displays can be controlled by editing the ini file - font size, width of the module, height of the module and positioning on screen. You will have to experiment with those for your system!
    Screenshots here and here.

    I have a 10 day old baby so not much spare time, but any problems I will try and sort out. Works fine for me :D
  11. Spagbol

    Spagbol Portal Member

    June 23, 2006
    Likes Received:
    +0 / 0
    OK, I've updated the .exe and .ini files for more customizability(!).
    Available here.

    You can now set font size, font style, font colour, background colour, border colour, set border on or off, border size, width, height and position of the module, set the scroll speed and turn the scroll on or off all from the ini file.
    Screenshot with foul colours and a wide border here.

    With a bit of careful positioning and settings you can make it seem part of MediaPortal like here.

    For those of you who don't want to mess with SVN code, here are the compiled files.
    Make sure you backup the originals just in case...
    Core.dll which goes in your root MediaPortal directory
    WindowsPlugins.dll which goes in MediaPortal/Plugins/Windows
    Remember, they are from SVN code so not guaranteed stable.

    If you try it and can't see the module, check the following things:
    Check MP isn't always on top
    Check the Top and Left settings in the ini file - you may be showing it off screen

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.


  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!