diff --git a/.vs/youtube-downloader/xs/UserPrefs.xml b/.vs/youtube-downloader/xs/UserPrefs.xml index 130d5a4..a27044e 100644 --- a/.vs/youtube-downloader/xs/UserPrefs.xml +++ b/.vs/youtube-downloader/xs/UserPrefs.xml @@ -1,21 +1,23 @@  - - + - - + - + + + + + diff --git a/Program.cs b/Program.cs index 66510ed..75bb9c5 100644 --- a/Program.cs +++ b/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 args) + { + Server.Functions.Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"])); + + rp.AsRedirect("/"); + } + + public static void AddItemRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary 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 arguments) { diff --git a/Server/Functions/Downloader.cs b/Server/Functions/Downloader.cs index 986256d..f0c05ef 100644 --- a/Server/Functions/Downloader.cs +++ b/Server/Functions/Downloader.cs @@ -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); diff --git a/bin/Release/youtube-downloader.exe b/bin/Release/youtube-downloader.exe index 0b4b1b6..723ab61 100644 Binary files a/bin/Release/youtube-downloader.exe and b/bin/Release/youtube-downloader.exe differ diff --git a/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache b/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache index 0b8c2af..272ddcd 100644 --- a/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache +++ b/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -c8bdc955f173e739a77263ac50434ebe8d35543b +73ded6b5d8ab70858f6e1aa1bc9f6ab4fdb90285 diff --git a/obj/x86/Release/youtube-downloader.csproj.FileListAbsolute.txt b/obj/x86/Release/youtube-downloader.csproj.FileListAbsolute.txt index d111acb..de70938 100644 --- a/obj/x86/Release/youtube-downloader.csproj.FileListAbsolute.txt +++ b/obj/x86/Release/youtube-downloader.csproj.FileListAbsolute.txt @@ -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 diff --git a/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache b/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache index bd05d9d..20638e9 100644 Binary files a/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache and b/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache differ diff --git a/obj/x86/Release/youtube-downloader.exe b/obj/x86/Release/youtube-downloader.exe index 0b4b1b6..723ab61 100644 Binary files a/obj/x86/Release/youtube-downloader.exe and b/obj/x86/Release/youtube-downloader.exe differ