Personal playlists use get methods

This commit is contained in:
Mike Nolan 2022-11-01 03:55:28 -05:00
parent cd7d09218a
commit c471162cf0
3 changed files with 12 additions and 20 deletions

View File

@ -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);
}

View File

@ -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<ListContentItem> items)
{
Dictionary<string,string> values=new Dictionary<string, string>
{
{ "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<ListContentItem> items)
{
//ReplaceList
Dictionary<string,string> values=new Dictionary<string, string>
{
{ "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)

View File

@ -7,9 +7,9 @@
<PackageId>Tesses.YouTubeDownloader</PackageId>
<Author>Mike Nolan</Author>
<Company>Tesses</Company>
<Version>1.2.5</Version>
<AssemblyVersion>1.2.5</AssemblyVersion>
<FileVersion>1.2.5</FileVersion>
<Version>1.2.6</Version>
<AssemblyVersion>1.2.6</AssemblyVersion>
<FileVersion>1.2.6</FileVersion>
<Description>A YouTube Downloader</Description>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>