home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
Watch / Listen Media
Listen Music
Internet Radio
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Spagbol" data-source="post: 99997" data-attributes="member: 21687"><p>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#.</p><p>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.</p><p></p><p>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.</p><p>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 0.2.2.0 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...)</p><p></p><p>Changes needed...</p><p>1) Changes to GUIRadio.cs</p><p>2) Changes to g-player.cs</p><p>3) Put shoutcastinfo.exe and shoutcastinfo.ini in the root of your MediaPortal install (usually C:\Program files\Team Mediaportal\MediaPortal)</p><p></p><p>Lastly, you need MSWinSck.ocx registered on your machine.</p><p></p><p>1) In GUIRadio.cs:</p><p></p><p>change void OnClick(int itemIndex) to</p><p></p><p>[code]void OnClick(int itemIndex)</p><p> {</p><p> GUIListItem item = GetSelectedItem();</p><p></p><p> if (item == null) return;</p><p> if (item.IsFolder)</p><p> {</p><p> if (currentPlayList != null)</p><p> {</p><p> currentPlayList = null;</p><p> }</p><p> selectedItemIndex = -1;</p><p> LoadDirectory(item.Path);</p><p> }</p><p> else</p><p> {</p><p></p><p> System.Diagnostics.Process proc = new System.Diagnostics.Process();</p><p></p><p> string shoutcastpath = item.Path;</p><p> string shoutcastfirstfourletters = (shoutcastpath.Substring(0, 4));</p><p> if (shoutcastfirstfourletters == "http")</p><p> {</p><p> TextWriter tw = new StreamWriter("tempshoutcast.txt");</p><p> tw.WriteLine(shoutcastpath);</p><p> tw.Close();</p><p> proc.EnableRaisingEvents = false;</p><p> proc.StartInfo.FileName = "shoutcastinfo";</p><p> proc.Start();</p><p> }</p><p> Play(item);</p><p> GUIPropertyManager.SetProperty("#selecteditem", item.Label);</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>and change void Play(GUIListItem item) to</p><p>[code] void Play(GUIListItem item)</p><p> { </p><p></p><p> if (MediaPortal.Util.Utils.IsPlayList(item.Path))</p><p> {</p><p> currentPlayList = new PlayList();</p><p> IPlayListIO loader = PlayListFactory.CreateIO(item.Path);</p><p> loader.Load(currentPlayList, item.Path);</p><p> if (currentPlayList.Count == 1) </p><p></p><p> { </p><p> System.Diagnostics.Process proc = new System.Diagnostics.Process();</p><p> string shoutcastpath = item.Path;</p><p> TextWriter tw = new StreamWriter("tempshoutcast.txt");</p><p> tw.WriteLine(shoutcastpath);</p><p> tw.Close();</p><p> proc.EnableRaisingEvents = true;</p><p> proc.StartInfo.FileName = "shoutcastinfo";</p><p> proc.Start();</p><p></p><p></p><p> // add current directory 2 playlist and play this item</p><p> string strURL = currentPlayList[0].FileName;</p><p> currentPlayList = null;</p><p> FillPlayList();</p><p> playlistPlayer.Play(strURL);</p><p> return;</p><p> }</p><p> if (currentPlayList.Count == 0)</p><p> {</p><p> currentPlayList = null;</p><p> }</p><p> LoadDirectory(currentFolder);</p><p> }</p><p> else</p><p> {</p><p> if (currentPlayList != null)</p><p> {</p><p> // add current playlist->playlist and play selected item</p><p> string strURL = item.Path;</p><p> FillPlayList();</p><p> playlistPlayer.Play(strURL);</p><p> return;</p><p> }</p><p></p><p> // add current directory 2 playlist and play this item</p><p> RadioStation station = item.MusicTag as RadioStation;</p><p> FillPlayList();</p><p></p><p> PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC_TEMP);</p><p> for (int i = 0; i < playlist.Count; ++i)</p><p> {</p><p> PlayListItem playItem = playlist[i];</p><p> if (playItem.Description.Equals(item.Label))</p><p> {</p><p> playlistPlayer.Play(i);</p><p> break;</p><p> }</p><p> } </p><p> } </p><p> }</p><p>[/code]</p><p></p><p>These changes will write a temporary text file containing either the http path or the .pls file of the radio station.</p><p>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.</p><p></p><p>2) In g_player.cs</p><p></p><p>add using System.IO; at the top...</p><p></p><p>And change public static void Stop() to</p><p></p><p>[code]public static void Stop()</p><p> {</p><p> if (_player != null)</p><p> {</p><p> Log.Info("g_Player.Stop()");</p><p> OnStopped();</p><p> GUIGraphicsContext.ShowBackground = true;</p><p> _player.Stop();</p><p> if (GUIGraphicsContext.form != null)</p><p> {</p><p> GUIGraphicsContext.form.Invalidate(true);</p><p> }</p><p> GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED, 0, 0, 0, 0, 0, null);</p><p> GUIWindowManager.SendThreadMessage(msg);</p><p></p><p> GUIGraphicsContext.IsFullScreenVideo = false;</p><p> GUIGraphicsContext.IsPlaying = false;</p><p> GUIGraphicsContext.IsPlayingVideo = false;</p><p> CachePlayer();</p><p></p><p> TextWriter tw = new StreamWriter("tempshoutcast.txt");</p><p> tw.WriteLine("Stopped");</p><p> tw.Close();</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>This will unload the module when shoutcast playback is stopped, through any means including exiting MediaPortal.</p><p></p><p>3) Place the shoutcastinfo.exe and .ini files in your MediaPortal directory. The files can be downloaded from <a href="http://rapidshare.com/files/9456209/Shoutcastinfo.zip.html" target="_blank">here</a>.</p><p></p><p>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!</p><p>Screenshots <a href="http://img393.imageshack.us/img393/1995/screen2rw7.jpg" target="_blank">here </a>and <a href="http://img393.imageshack.us/img393/3540/screen1tk5.jpg" target="_blank">here</a>.</p><p></p><p>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 <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /></p></blockquote><p></p>
[QUOTE="Spagbol, post: 99997, member: 21687"] 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 0.2.2.0 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]void OnClick(int itemIndex) { GUIListItem item = GetSelectedItem(); if (item == null) return; if (item.IsFolder) { if (currentPlayList != null) { currentPlayList = null; } selectedItemIndex = -1; LoadDirectory(item.Path); } else { System.Diagnostics.Process proc = new System.Diagnostics.Process(); string shoutcastpath = item.Path; string shoutcastfirstfourletters = (shoutcastpath.Substring(0, 4)); if (shoutcastfirstfourletters == "http") { TextWriter tw = new StreamWriter("tempshoutcast.txt"); tw.WriteLine(shoutcastpath); tw.Close(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "shoutcastinfo"; proc.Start(); } Play(item); GUIPropertyManager.SetProperty("#selecteditem", item.Label); } } [/code] and change void Play(GUIListItem item) to [code] void Play(GUIListItem item) { if (MediaPortal.Util.Utils.IsPlayList(item.Path)) { currentPlayList = new PlayList(); IPlayListIO loader = PlayListFactory.CreateIO(item.Path); loader.Load(currentPlayList, item.Path); if (currentPlayList.Count == 1) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); string shoutcastpath = item.Path; TextWriter tw = new StreamWriter("tempshoutcast.txt"); tw.WriteLine(shoutcastpath); tw.Close(); proc.EnableRaisingEvents = true; proc.StartInfo.FileName = "shoutcastinfo"; proc.Start(); // add current directory 2 playlist and play this item string strURL = currentPlayList[0].FileName; currentPlayList = null; FillPlayList(); playlistPlayer.Play(strURL); return; } if (currentPlayList.Count == 0) { currentPlayList = null; } LoadDirectory(currentFolder); } else { if (currentPlayList != null) { // add current playlist->playlist and play selected item string strURL = item.Path; FillPlayList(); playlistPlayer.Play(strURL); return; } // add current directory 2 playlist and play this item RadioStation station = item.MusicTag as RadioStation; FillPlayList(); PlayList playlist = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC_TEMP); for (int i = 0; i < playlist.Count; ++i) { PlayListItem playItem = playlist[i]; if (playItem.Description.Equals(item.Label)) { playlistPlayer.Play(i); break; } } } } [/code] 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]public static void Stop() { if (_player != null) { Log.Info("g_Player.Stop()"); OnStopped(); GUIGraphicsContext.ShowBackground = true; _player.Stop(); if (GUIGraphicsContext.form != null) { GUIGraphicsContext.form.Invalidate(true); } GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_PLAYBACK_STOPPED, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); GUIGraphicsContext.IsFullScreenVideo = false; GUIGraphicsContext.IsPlaying = false; GUIGraphicsContext.IsPlayingVideo = false; CachePlayer(); TextWriter tw = new StreamWriter("tempshoutcast.txt"); tw.WriteLine("Stopped"); tw.Close(); } } [/code] 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 [URL="http://rapidshare.com/files/9456209/Shoutcastinfo.zip.html"]here[/URL]. 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 [URL="http://img393.imageshack.us/img393/1995/screen2rw7.jpg"]here [/URL]and [URL="http://img393.imageshack.us/img393/3540/screen1tk5.jpg"]here[/URL]. 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 [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
Watch / Listen Media
Listen Music
Internet Radio
Contact us
RSS
Top
Bottom