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
|
using System;
using System.Text;
using System.IO;
namespace DoenaSoft.Playlist
{
//Warum nicht einfach "dir *.mp3 /b > !playlist.m3u"?
//Weil der nicht mit deutschen Umlauten umgehen kann.
public static class Playlist
{
public static void Main(String[] args)
{
DirectoryInfo di;
FileInfo[] fis;
StringBuilder output;
if ((args == null) || (args.Length != 1) || (Directory.Exists(args[0]) == false))
{
Console.WriteLine("No path provided. Using current directory.");
args = new String[] { "." };
}
di = new DirectoryInfo(args[0]);
Console.WriteLine("Processing \"" + di.FullName + "\"");
fis = di.GetFiles("*.mp3", SearchOption.TopDirectoryOnly);
output = new StringBuilder();
foreach (FileInfo fi in fis)
{
output.AppendLine(fi.Name);
}
using (StreamWriter sw = new StreamWriter(di.FullName + @"\!playlist.m3u", false, Encoding.GetEncoding("Windows-1252")))
{
sw.Write(output.ToString());
}
}
}
}
|