[patch] Adressed a couple of playlist issues (1 Viewer)

enco

Portal Member
October 5, 2007
12
0
Home Country
Germany Germany
Hi,

making my first steps in C# (I'm a Delphi and scripting guy), I adressed the bugs reported here and here, 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:

Core.PlayList.PlayListM3uIO.cs:
Line 59, old code:
Code:
using (file = new StreamReader(playlistFileName))
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))
This took care of the problem with special chars in .m3u playlists.


Core.PlayList.PlayListPLSIO.cs:
Commented out line 138
Code:
//duration *= 1000;
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;
}
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;
}
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...
 

enco

Portal Member
October 5, 2007
12
0
Home Country
Germany Germany
Whoops, I see... thanks for the hint.
I uploaded the two source files to the patches section on SF.net now. Hope it helps :)
 

Users who are viewing this thread

Top Bottom