Make it more complete
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Name = HttpUtility.HtmlEncode(name),
|
||||
Songs = songLinks,
|
||||
Addvals = HttpUtility.HtmlAttributeEncode(JsonConvert.SerializeObject(new{id}))
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using Scriban;
|
||||
using System.Web;
|
||||
namespace Tesses.YouTubeDownloader2025Companion
|
||||
{
|
||||
public class AlbumLink(string name, string id, string thumbnail) {
|
||||
public class AlbumLink(string name, string id) {
|
||||
public string Albumname => HttpUtility.HtmlEncode(name);
|
||||
public string Albumurl => HttpUtility.HtmlAttributeEncode($"/music/album?id={HttpUtility.UrlEncode(id)}");
|
||||
public string Imgurl => HttpUtility.HtmlAttributeEncode(thumbnail);
|
||||
public string Imgurl => HttpUtility.HtmlAttributeEncode($"/api/v1/album-thumbnail?id={HttpUtility.UrlEncode(id)}");
|
||||
}
|
||||
|
||||
public static partial class Pages {
|
||||
@@ -21,7 +21,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/albums?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/artist?id={HttpUtility.UrlEncode(id.ToString())}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/artist?id={HttpUtility.UrlEncode(id.ToString())}&page={page + 1}")
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/artists?q={HttpUtility.UrlEncode(query)}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/artists?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Hasanysongs = hasAny,
|
||||
Zipurl = HttpUtility.HtmlAttributeEncode($"/api/v1/album.zip?albumId={HttpUtility.UrlEncode(id)}"),
|
||||
Artists = artists
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/myalbums?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/myartist?q={HttpUtility.UrlEncode(query)}&id={HttpUtility.UrlEncode(id.ToString())}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/myartist?q={HttpUtility.UrlEncode(query)}&id={HttpUtility.UrlEncode(id.ToString())}&page={page + 1}")
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/myartists?q={HttpUtility.UrlEncode(query)}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/myartists?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Tytdurl = HttpUtility.HtmlAttributeEncode($"{tytdEndpoint.TrimEnd('/')}/watch?v={HttpUtility.UrlEncode(video.VideoId)}"),
|
||||
Dlbtn = downloaded ? $"<a class=\"button\" href=\"/api/v1/song?albumId={HttpUtility.UrlEncode(album.AlbumId)}&songId={HttpUtility.UrlEncode(song.SongId)}\"><i>download</i> Download</a>" : string.IsNullOrEmpty(video.VideoId) ? "<span><i>file_download_off</i> Unavailable</span>" : "<span><i>downloading</i> Downloading</span>",
|
||||
Hasvideo = !string.IsNullOrEmpty(video.VideoId)
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace Tesses.YouTubeDownloader2025Companion
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/mysongs?q={HttpUtility.UrlEncode(query)}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/mysongs?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
}),Program.DefaultLinks());
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Tesses.WebServer;
|
||||
using Scriban;
|
||||
using System.Web;
|
||||
namespace Tesses.YouTubeDownloader2025Companion
|
||||
{
|
||||
public class SongLink(string name, string id) {
|
||||
public string Name => HttpUtility.HtmlEncode(name);
|
||||
public string Url => HttpUtility.HtmlAttributeEncode($"/music/song?id={HttpUtility.UrlEncode(id)}");
|
||||
|
||||
}
|
||||
|
||||
public static partial class Pages {
|
||||
|
||||
private static ReloadingScript song_listing = new ReloadingScript("wwwroot/pages/music/songs/song-list.sbnhtml");
|
||||
public static string SongListing(string query, List<SongLink> links, int page)
|
||||
{
|
||||
return Components.Shell($"Song search {query}", song_listing.Render(new {
|
||||
Songs = links,
|
||||
Q = HttpUtility.HtmlAttributeEncode(query),
|
||||
Prev = HttpUtility.HtmlAttributeEncode($"/music/songs?q={HttpUtility.UrlEncode(query)}&page={(page == 1 ? 1 : page - 1)}"),
|
||||
Current = page,
|
||||
Next = HttpUtility.HtmlAttributeEncode($"/music/songs?q={HttpUtility.UrlEncode(query)}&page={page + 1}")
|
||||
}),Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Tesses.WebServer;
|
||||
using Scriban;
|
||||
using System.Web;
|
||||
using System.Text;
|
||||
namespace Tesses.YouTubeDownloader2025Companion
|
||||
{
|
||||
public static partial class Pages {
|
||||
|
||||
private static ReloadingScript song_albums = new ReloadingScript("wwwroot/pages/music/songs/song-albums.sbnhtml");
|
||||
|
||||
public static string SongAlbums(string songName, List<AlbumLink> albums)
|
||||
{
|
||||
return Components.Shell($"{songName}'s Albums", song_albums.Render(new
|
||||
{
|
||||
Songname = songName,
|
||||
Albums = albums
|
||||
}), Program.DefaultLinks(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user