-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGenerateM3U.cs
40 lines (34 loc) · 1011 Bytes
/
GenerateM3U.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
namespace PlayListGenerator
{
/// <summary>
/// Generate a m3u playlist file
/// </summary>
class GenerateM3U : GeneratePlaylistBase
{
public override string FileExtension
{
get
{
return "m3u";
}
}
protected override string GetHeader()
{
return "#EXTM3U" + Environment.NewLine;
}
protected override string GetFooter()
{
return "";
}
private static string Convert(string stringToConvert)
{
// According to https://trac.videolan.org/vlc/ticket/21364?cversion=0&cnum_hist=2 if a # char is found in filename, we have to replace by %23
return stringToConvert.Replace("#", "%23");
}
protected override string GetForOneFile(string aFileName)
{
return Convert(aFileName) + Environment.NewLine;
}
}
}