38 lines
1.5 KiB
C#
38 lines
1.5 KiB
C#
using Tesses.WebServer;
|
|
using Scriban;
|
|
using System.Web;
|
|
using System.Text;
|
|
namespace Tesses.YouTubeDownloader2025Companion
|
|
{
|
|
public static partial class Pages {
|
|
|
|
private static ReloadingScript mysong_albums = new ReloadingScript("wwwroot/pages/music/mysongs/song-albums.sbnhtml");
|
|
|
|
public static string MySongAlbums(List<MediaEntry> entries, Song song, List<Artist> artists)
|
|
{
|
|
StringBuilder builder=new StringBuilder();
|
|
if(artists.Count > 0)
|
|
builder.Append($"{artists[0].ArtistName} - ");
|
|
builder.Append(song.SongName);
|
|
|
|
if(artists.Count > 1)
|
|
builder.Append($" feat. {string.Join(",",artists.Skip(1).Select(e=>e.ArtistName))}");
|
|
|
|
|
|
return Components.Shell($"{builder}'s Albums", mysong_albums.Render(new
|
|
{
|
|
Songname = builder.ToString(),
|
|
Albums = entries.Select(e =>
|
|
{
|
|
return new
|
|
{
|
|
Albumurl = $"/music/myalbum?id={HttpUtility.UrlEncode(e.AlbumId)}",
|
|
Albumname = HttpUtility.HtmlEncode(e.AlbumName),
|
|
Url = $"/music/mysong?albumId={HttpUtility.UrlEncode(e.AlbumId)}&songId={song.SongId}",
|
|
Imgurl = $"/api/v1/album-thumbnail?id={HttpUtility.UrlEncode(e.AlbumId)}"
|
|
};
|
|
})
|
|
}), Program.DefaultLinks(2));
|
|
}
|
|
}
|
|
} |