Add enumerate video ids

This commit is contained in:
Mike Nolan 2024-12-02 16:36:27 +00:00
parent 55f62811c7
commit f8deea2c78
1 changed files with 194 additions and 185 deletions

View File

@ -7,6 +7,7 @@ using static Creds;
using System.Diagnostics.CodeAnalysis;
using YoutubeExplode.Playlists;
using YoutubeExplode.Channels;
using System.Linq;
HttpClient http=new HttpClient();
YoutubeClient ytc=new YoutubeClient(http);
@ -132,6 +133,14 @@ RouteServer routeServer=new RouteServer(msvr);
routeServer.Add("/itemsInQueue",async(ctx)=>{
await ctx.SendJsonAsync(videoIds.Count);
});
routeServer.Add("/queue.json", async(ctx)=>{
List<string> items = new List<string>();
foreach(var item in videoIds)
{
items.Add(item.Value);
}
await ctx.SendJsonAsync(items);
});
routeServer.Add("/add",async(ctx)=>{
if(ctx.QueryParams.TryGetFirst("v",out var v))
{