add /api/AddItem and /api/AddItemRes
This commit is contained in:
parent
a846c9ec96
commit
c1ffcb8b89
|
@ -1,21 +1,23 @@
|
|||
<Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Program.cs">
|
||||
<Files>
|
||||
<File FileName="Program.cs" Line="119" Column="70" />
|
||||
<File FileName="Server/Models/InfoType.cs" Line="45" Column="39" />
|
||||
<File FileName="Server/Models/YoutubeDownloaderResponse.cs" Line="1" Column="1" />
|
||||
<File FileName="Server/Functions/Downloader.cs" Line="888" Column="8" />
|
||||
<File FileName="Server/Functions/Downloader.cs" Line="118" Column="30" />
|
||||
<File FileName="Server/Functions/SavedMedia.cs" Line="1" Column="1" />
|
||||
<File FileName="Server/Models/SavedVideo.cs" Line="35" Column="10" />
|
||||
<File FileName="Server/Models/InfomationQueueItem.cs" Line="25" Column="27" />
|
||||
<File FileName="Server/Functions/ffmpeg.cs" Line="30" Column="14" />
|
||||
<File FileName="../Projects/tytdtool/tytdtool/Program.cs" Line="1" Column="1" />
|
||||
<File FileName="../../../usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets" Line="2101" Column="5" />
|
||||
<File FileName="Program.cs" Line="1" Column="1" />
|
||||
</Files>
|
||||
<Pads>
|
||||
<Pad Id="ProjectPad">
|
||||
<State name="__root__">
|
||||
<Node name="youtube-downloader" expanded="True" />
|
||||
<Node name="youtube-downloader" expanded="True">
|
||||
<Node name="youtube-downloader" expanded="True">
|
||||
<Node name="Program.cs" selected="True" />
|
||||
</Node>
|
||||
</Node>
|
||||
</State>
|
||||
</Pad>
|
||||
</Pads>
|
||||
|
|
14
Program.cs
14
Program.cs
|
@ -78,6 +78,8 @@ namespace youtube_downloader
|
|||
|
||||
/* Generic */
|
||||
Route.Add("/api/AddItems", (HttpAction)AddItems, "POST");
|
||||
Route.Add("/api/AddItem/{Id}", (HttpAction)AddItem);
|
||||
Route.Add("/api/AddItemRes/{R}/{Id}", (HttpAction)AddItemRes);
|
||||
Route.Add("/api/AddFile/{Url}", (HttpAction)AddFile);
|
||||
Route.Add("/api/AddCaptions/{Id}", (HttpAction)AddCaptions);
|
||||
|
||||
|
@ -159,6 +161,18 @@ namespace youtube_downloader
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
public static void AddItem(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
|
||||
{
|
||||
Server.Functions.Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"]));
|
||||
|
||||
rp.AsRedirect("/");
|
||||
}
|
||||
|
||||
public static void AddItemRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
|
||||
{
|
||||
Server.Functions.Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
|
||||
rp.AsRedirect("/");
|
||||
}
|
||||
public static void AddFile(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments)
|
||||
{
|
||||
|
|
|
@ -881,6 +881,45 @@ namespace youtube_downloader.Server.Functions
|
|||
{
|
||||
DownloadChannel(id, Resolution.NoConvert);
|
||||
}
|
||||
public static void DownloadItem(string id)
|
||||
{
|
||||
DownloadItem(id, Resolution.NoConvert);
|
||||
}
|
||||
public static void DownloadItem(string id,Resolution res)
|
||||
{
|
||||
VideoId? vid = VideoId.TryParse(id);
|
||||
PlaylistId? pid = PlaylistId.TryParse(id);
|
||||
ChannelId? cid = ChannelId.TryParse(id);
|
||||
UserName? user = UserName.TryParse(id);
|
||||
|
||||
if (id.Length == 11)
|
||||
{
|
||||
if (vid.HasValue)
|
||||
{
|
||||
DownloadVideo(vid.Value, res); //shall we download video
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pid.HasValue)
|
||||
{
|
||||
DownloadPlaylist(pid.Value, res);
|
||||
}
|
||||
else if (vid.HasValue)
|
||||
{
|
||||
DownloadVideo(vid.Value, res);
|
||||
}
|
||||
else if (cid.HasValue)
|
||||
{
|
||||
DownloadChannel(cid.Value, res);
|
||||
}
|
||||
else if (user.HasValue)
|
||||
{
|
||||
DownloadUser(user.Value, res);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void DownloadUser(string name, Resolution res)
|
||||
{
|
||||
UserName? v=UserName.TryParse(name);
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
c8bdc955f173e739a77263ac50434ebe8d35543b
|
||||
73ded6b5d8ab70858f6e1aa1bc9f6ab4fdb90285
|
||||
|
|
|
@ -277,3 +277,140 @@
|
|||
/home/ddlovato/site/bin/Release/SimpleBase.pdb
|
||||
/home/ddlovato/site/obj/x86/Release/youtube-downloader.csproj.CopyComplete
|
||||
/home/ddlovato/site/bin/Release/CookiesTxtParser.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/youtube-downloader.exe
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.InteropServices.RuntimeInformation.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Cryptography.Algorithms.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ValueTuple.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Microsoft.Win32.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/netstandard.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.AppContext.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Collections.Concurrent.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Collections.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Collections.NonGeneric.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Collections.Specialized.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ComponentModel.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ComponentModel.EventBasedAsync.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ComponentModel.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ComponentModel.TypeConverter.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Console.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Data.Common.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.Contracts.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.Debug.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.FileVersionInfo.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.Process.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.StackTrace.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.TextWriterTraceListener.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.Tools.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.TraceSource.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Diagnostics.Tracing.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Drawing.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Dynamic.Runtime.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Globalization.Calendars.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Globalization.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Globalization.Extensions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.Compression.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.Compression.ZipFile.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.FileSystem.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.FileSystem.DriveInfo.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.FileSystem.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.FileSystem.Watcher.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.IsolatedStorage.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.MemoryMappedFiles.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.Pipes.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.IO.UnmanagedMemoryStream.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Linq.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Linq.Expressions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Linq.Parallel.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Linq.Queryable.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Http.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.NameResolution.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.NetworkInformation.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Ping.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Requests.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Security.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.Sockets.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.WebHeaderCollection.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.WebSockets.Client.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Net.WebSockets.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.ObjectModel.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Reflection.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Reflection.Extensions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Reflection.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Resources.Reader.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Resources.ResourceManager.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Resources.Writer.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.CompilerServices.VisualC.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Extensions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Handles.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.InteropServices.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Numerics.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Serialization.Formatters.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Serialization.Json.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Serialization.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.Serialization.Xml.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Claims.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Cryptography.Csp.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Cryptography.Encoding.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Cryptography.Primitives.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Cryptography.X509Certificates.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.Principal.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Security.SecureString.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Encoding.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Encoding.Extensions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.RegularExpressions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Overlapped.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Tasks.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Tasks.Parallel.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Thread.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.ThreadPool.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Timer.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.ReaderWriter.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.XDocument.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.XmlDocument.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.XmlSerializer.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.XPath.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Xml.XPath.XDocument.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/AngleSharp.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/AsyncEnumerable.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Common.Logging.Core.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Common.Logging.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/CookiesTxtParser.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Microsoft.Bcl.AsyncInterfaces.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/MimeTypesMap.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Newtonsoft.Json.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/SimpleBase.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/SimpleHTTP.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Buffers.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Memory.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Numerics.Vectors.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.CompilerServices.Unsafe.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Encoding.CodePages.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Encodings.Web.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Json.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Tasks.Extensions.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/YoutubeExplode.dll
|
||||
/home/ddlovato/tytd/site/bin/Release/Newtonsoft.Json.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Buffers.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Numerics.Vectors.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Runtime.CompilerServices.Unsafe.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Memory.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/AngleSharp.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Encodings.Web.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Threading.Tasks.Extensions.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/Microsoft.Bcl.AsyncInterfaces.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/System.Text.Json.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/YoutubeExplode.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/SimpleHTTP.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/AsyncEnumerable.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/Common.Logging.Core.pdb
|
||||
/home/ddlovato/tytd/site/bin/Release/Common.Logging.pdb
|
||||
/home/ddlovato/tytd/site/bin/Release/Common.Logging.xml
|
||||
/home/ddlovato/tytd/site/bin/Release/SimpleBase.pdb
|
||||
/home/ddlovato/tytd/site/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache
|
||||
/home/ddlovato/tytd/site/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache
|
||||
/home/ddlovato/tytd/site/obj/x86/Release/youtube-downloader.csproj.CopyComplete
|
||||
/home/ddlovato/tytd/site/obj/x86/Release/youtube-downloader.exe
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue