diff --git a/Tesses.YouTubeDownloader.Net6/Program.cs b/Tesses.YouTubeDownloader.Net6/Program.cs index bfb7c53..566d7d3 100644 --- a/Tesses.YouTubeDownloader.Net6/Program.cs +++ b/Tesses.YouTubeDownloader.Net6/Program.cs @@ -17,9 +17,11 @@ namespace Tesses.YouTubeDownloader.Net6 server.RootServer.Server=new StaticServer("WebSite"); currentDirectory.CanDownload=true; HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer); + currentDirectory.CanDownload=false; currentDirectory.StartLoop(); TYTDStorage.FFmpeg ="/usr/bin/ffmpeg"; Console.WriteLine("Almost Ready to Listen"); + await listener.ListenAsync(CancellationToken.None); } diff --git a/Tesses.YouTubeDownloader/TYTDClient.cs b/Tesses.YouTubeDownloader/TYTDClient.cs index c98f0ac..e85d88e 100644 --- a/Tesses.YouTubeDownloader/TYTDClient.cs +++ b/Tesses.YouTubeDownloader/TYTDClient.cs @@ -16,6 +16,7 @@ using System.Net; using System.Diagnostics.CodeAnalysis; using YoutubeExplode.Utils.Extensions; using System.Net.Http.Headers; +using System.Web; namespace Tesses.YouTubeDownloader { @@ -452,27 +453,16 @@ internal class SegmentedHttpStream : Stream public async Task AddToPersonalPlaylistAsync(string name, IEnumerable items) { - Dictionary values=new Dictionary - { - { "name", name}, - { "data", JsonConvert.SerializeObject(items.ToArray())} - }; - var content = new FormUrlEncodedContent(values); - var response = await client.PostAsync($"{url}api/v2/AddToList",content); - var resposeStr = await response.Content.ReadAsStringAsync(); + foreach(var item in items) + { + var response = await client.GetStringAsync($"{url}api/v2/AddToList?name={WebUtility.UrlEncode(name)}&v={item.Id}&res={item.Resolution.ToString()}"); + } } public async Task ReplacePersonalPlaylistAsync(string name, IEnumerable items) { - //ReplaceList - Dictionary values=new Dictionary - { - { "name", name}, - { "data", JsonConvert.SerializeObject(items.ToArray())} - }; - var content = new FormUrlEncodedContent(values); - var response = await client.PostAsync($"{url}api/v2/ReplaceList",content); - var resposeStr = await response.Content.ReadAsStringAsync(); + DeletePersonalPlaylist(name); + await AddToPersonalPlaylistAsync(name,items); } public async Task RemoveItemFromPersonalPlaylistAsync(string name, VideoId id) diff --git a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj index ab70afd..50bfd83 100644 --- a/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj +++ b/Tesses.YouTubeDownloader/Tesses.YouTubeDownloader.csproj @@ -7,9 +7,9 @@ Tesses.YouTubeDownloader Mike Nolan Tesses - 1.2.5 - 1.2.5 - 1.2.5 + 1.2.6 + 1.2.6 + 1.2.6 A YouTube Downloader LGPL-3.0-only true