Personal playlists use get methods
This commit is contained in:
parent
cd7d09218a
commit
c471162cf0
|
@ -17,9 +17,11 @@ namespace Tesses.YouTubeDownloader.Net6
|
||||||
server.RootServer.Server=new StaticServer("WebSite");
|
server.RootServer.Server=new StaticServer("WebSite");
|
||||||
currentDirectory.CanDownload=true;
|
currentDirectory.CanDownload=true;
|
||||||
HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer);
|
HttpServerListener listener=new HttpServerListener(new System.Net.IPEndPoint(System.Net.IPAddress.Any,3252),server.InnerServer);
|
||||||
|
currentDirectory.CanDownload=false;
|
||||||
currentDirectory.StartLoop();
|
currentDirectory.StartLoop();
|
||||||
TYTDStorage.FFmpeg ="/usr/bin/ffmpeg";
|
TYTDStorage.FFmpeg ="/usr/bin/ffmpeg";
|
||||||
Console.WriteLine("Almost Ready to Listen");
|
Console.WriteLine("Almost Ready to Listen");
|
||||||
|
|
||||||
await listener.ListenAsync(CancellationToken.None);
|
await listener.ListenAsync(CancellationToken.None);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ using System.Net;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using YoutubeExplode.Utils.Extensions;
|
using YoutubeExplode.Utils.Extensions;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Tesses.YouTubeDownloader
|
namespace Tesses.YouTubeDownloader
|
||||||
{
|
{
|
||||||
|
@ -452,27 +453,16 @@ internal class SegmentedHttpStream : Stream
|
||||||
|
|
||||||
public async Task AddToPersonalPlaylistAsync(string name, IEnumerable<ListContentItem> items)
|
public async Task AddToPersonalPlaylistAsync(string name, IEnumerable<ListContentItem> items)
|
||||||
{
|
{
|
||||||
Dictionary<string,string> values=new Dictionary<string, string>
|
foreach(var item in items)
|
||||||
{
|
{
|
||||||
{ "name", name},
|
var response = await client.GetStringAsync($"{url}api/v2/AddToList?name={WebUtility.UrlEncode(name)}&v={item.Id}&res={item.Resolution.ToString()}");
|
||||||
{ "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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ReplacePersonalPlaylistAsync(string name, IEnumerable<ListContentItem> items)
|
public async Task ReplacePersonalPlaylistAsync(string name, IEnumerable<ListContentItem> items)
|
||||||
{
|
{
|
||||||
//ReplaceList
|
DeletePersonalPlaylist(name);
|
||||||
Dictionary<string,string> values=new Dictionary<string, string>
|
await AddToPersonalPlaylistAsync(name,items);
|
||||||
{
|
|
||||||
{ "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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RemoveItemFromPersonalPlaylistAsync(string name, VideoId id)
|
public async Task RemoveItemFromPersonalPlaylistAsync(string name, VideoId id)
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
<PackageId>Tesses.YouTubeDownloader</PackageId>
|
<PackageId>Tesses.YouTubeDownloader</PackageId>
|
||||||
<Author>Mike Nolan</Author>
|
<Author>Mike Nolan</Author>
|
||||||
<Company>Tesses</Company>
|
<Company>Tesses</Company>
|
||||||
<Version>1.2.5</Version>
|
<Version>1.2.6</Version>
|
||||||
<AssemblyVersion>1.2.5</AssemblyVersion>
|
<AssemblyVersion>1.2.6</AssemblyVersion>
|
||||||
<FileVersion>1.2.5</FileVersion>
|
<FileVersion>1.2.6</FileVersion>
|
||||||
<Description>A YouTube Downloader</Description>
|
<Description>A YouTube Downloader</Description>
|
||||||
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
|
|
Loading…
Reference in New Issue