Nebo můžeš použít utilitu napsanou v C# před chvilkou - tzn. není moc otestovaná ;)
Použití:
SeznamPisnicek.exe -file c:\temp\SouborSeSeznamem.xlsx -folder C:\MP3
Src:using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using OfficeOpenXml;
using NDesk.Options;
namespace SeznamPisnicek
{
class Program
{
private static readonly List<TagLib.File> Files = new List<TagLib.File>();
private static void Main(string[] args)
{
string folder = null;
string fn = null;
var p = new OptionSet()
{
{"folder=", v => folder = v},
{"file=", v => fn = v},
};
p.Parse(args);
if (string.IsNullOrEmpty(folder) || string.IsNullOrEmpty(fn))
{
Console.WriteLine("Neplatný název složky nebo souboru!");
return;
}
GetFiles(folder,fn);
}
private static void GetFiles(string folder, string fn)
{
var di = new DirectoryInfo(folder);
foreach (var file in di.GetFiles("*.mp3"))
{
try
{
Files.Add(TagLib.File.Create(file.FullName));
}
catch (Exception)
{
// ignored
}
}
CreateExcel(fn);
}
private static void CreateExcel(string fn)
{
var fileName = new FileInfo(fn);
if (fileName.Exists) fileName.Delete();
using (var ex = new ExcelPackage(fileName))
{
var ws = ex.Workbook.Worksheets.Add("Seznam písniček");
ws.Cells[1, 1].Value = "Název souboru";
ws.Cells[1, 2].Value = "Název - ID3 tag Title";
ws.Cells[1, 3].Value = "Délka";
var y = 1;
foreach (var file in Files)
{
ws.Cells[y + 1, 1].Value = file.Name.Split('\\').Last();
ws.Cells[y + 1, 2].Value = file.Tag.Title;
ws.Cells[y + 1, 3].Value = file.Properties.Duration.Hours > 0 ? $"{file.Properties.Duration.Hours}:{file.Properties.Duration.Minutes:00}:{file.Properties.Duration.Seconds:00}"
: $"{file.Properties.Duration.Minutes}:{file.Properties.Duration.Seconds:00}";
y++;
}
ws.Column(1).AutoFit();
ws.Column(2).AutoFit();
ws.Column(3).AutoFit();
ex.Save();
}
}
}
}