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
Development
General Development (no feature request here!)
[patch] Adressed a couple of playlist issues
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="enco" data-source="post: 207627" data-attributes="member: 57728"><p>Hi,</p><p></p><p>making my first steps in C# (I'm a Delphi and scripting guy), I adressed the bugs reported <a href="https://forum.team-mediaportal.com/mymusic_bass_player_doesnt_play_songs_special-t28278.html" target="_blank">here</a> and <a href="https://forum.team-mediaportal.com/m3u_playlist_problems_foreign_characters-t5347.html?t=5347" target="_blank">here</a>, being:</p><p>- tracks containing special characters in .m3u playlists were skipped as well as not displayed properly</p><p>- track lengths in .pls playlists were off by a factor of 1000 seconds</p><p>- relative paths in .pls playlists didn't work</p><p></p><p></p><p>Here's what I changed:</p><p></p><p><strong>Core.PlayList.PlayListM3uIO.cs</strong>:</p><p>Line 59, old code:</p><p>[code]using (file = new StreamReader(playlistFileName))[/code]</p><p>new code:</p><p>[code]Encoding fileEncoding = Encoding.Default;</p><p>FileStream stream = File.Open(playlistFileName, FileMode.Open, FileAccess.Read, FileShare.Read);</p><p>using (file = new StreamReader(stream, fileEncoding, true))</p><p>[/code]</p><p>This took care of the problem with special chars in .m3u playlists.</p><p></p><p></p><p><strong>Core.PlayList.PlayListPLSIO.cs</strong>:</p><p>Commented out line 138</p><p>[code]//duration *= 1000;[/code]</p><p>This fixed the faulty track length display.</p><p></p><p>Lines 142-146, old code:</p><p>[code]if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0)</p><p>{</p><p> MediaPortal.Util.Utils.GetQualifiedFilename(basePath, ref fileName);</p><p> newItem.Type = PlayListItem.PlayListItemType.AudioStream;</p><p>}[/code]</p><p>New code (just inserted one LOC inbetween):</p><p>[code]if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0)</p><p>{</p><p> MediaPortal.Util.Utils.GetQualifiedFilename(basePath, ref fileName);</p><p> newItem.FileName = fileName;</p><p> newItem.Type = PlayListItem.PlayListItemType.AudioStream;</p><p>}[/code]</p><p>This fixed the handling of relative paths.</p><p></p><p>BTW I'm not sure if the assignment of the newItem.Type is correct in this last piece of code. But since it's been working for me so far, I left it alone. Someone with more inside knowledge may verify this.</p><p></p><p>Cheers...</p></blockquote><p></p>
[QUOTE="enco, post: 207627, member: 57728"] Hi, making my first steps in C# (I'm a Delphi and scripting guy), I adressed the bugs reported [url=https://forum.team-mediaportal.com/mymusic_bass_player_doesnt_play_songs_special-t28278.html]here[/url] and [url=https://forum.team-mediaportal.com/m3u_playlist_problems_foreign_characters-t5347.html?t=5347]here[/url], being: - tracks containing special characters in .m3u playlists were skipped as well as not displayed properly - track lengths in .pls playlists were off by a factor of 1000 seconds - relative paths in .pls playlists didn't work Here's what I changed: [B]Core.PlayList.PlayListM3uIO.cs[/B]: Line 59, old code: [code]using (file = new StreamReader(playlistFileName))[/code] new code: [code]Encoding fileEncoding = Encoding.Default; FileStream stream = File.Open(playlistFileName, FileMode.Open, FileAccess.Read, FileShare.Read); using (file = new StreamReader(stream, fileEncoding, true)) [/code] This took care of the problem with special chars in .m3u playlists. [B]Core.PlayList.PlayListPLSIO.cs[/B]: Commented out line 138 [code]//duration *= 1000;[/code] This fixed the faulty track length display. Lines 142-146, old code: [code]if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0) { MediaPortal.Util.Utils.GetQualifiedFilename(basePath, ref fileName); newItem.Type = PlayListItem.PlayListItemType.AudioStream; }[/code] New code (just inserted one LOC inbetween): [code]if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0) { MediaPortal.Util.Utils.GetQualifiedFilename(basePath, ref fileName); newItem.FileName = fileName; newItem.Type = PlayListItem.PlayListItemType.AudioStream; }[/code] This fixed the handling of relative paths. BTW I'm not sure if the assignment of the newItem.Type is correct in this last piece of code. But since it's been working for me so far, I left it alone. Someone with more inside knowledge may verify this. Cheers... [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Development
General Development (no feature request here!)
[patch] Adressed a couple of playlist issues
Contact us
RSS
Top
Bottom