mirror of
https://github.com/sphildreth/roadie
synced 2024-11-26 22:20:21 +00:00
25 lines
698 B
C#
25 lines
698 B
C#
using Roadie.Library.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Roadie.Library.Utility
|
|
{
|
|
public static class M3uHelper
|
|
{
|
|
public static string M3uContentForTracks(IEnumerable<TrackList> tracks)
|
|
{
|
|
var result = new List<string>
|
|
{
|
|
"#EXTM3U"
|
|
};
|
|
foreach (var track in tracks)
|
|
{
|
|
result.Add($"#EXTINF:{ track.Duration },{ track.Artist.Text} - { track.Track.Text }");
|
|
result.Add($"{ track.TrackPlayUrl }");
|
|
result.Add(string.Empty);
|
|
}
|
|
return string.Join("\r\n", result);
|
|
}
|
|
}
|
|
}
|