Compare commits

..

10 Commits

31 changed files with 985 additions and 4036 deletions

View File

@ -1,34 +1,30 @@
<Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True">
<MonoDevelop.Ide.Workbench ActiveDocument="Program.cs">
<Files>
<File FileName="TYTD.Api/Server/Models/InfoType.cs" Line="155" Column="47" />
<File FileName="TYTD.Api/Server/Functions/Downloader.cs" Line="18" Column="1" />
<File FileName="TYTD.Api/Server/Models/InfoType.cs" Line="171" Column="40" />
<File FileName="TYTD.Api/Server/Functions/Downloader.cs" Line="1141" Column="18" />
<File FileName="TYTD.Api/Server/Models/SavedMedia.cs" Line="1" Column="1" />
<File FileName="TYTD.Api/Server/Models/SavedVideo.cs" Line="8" Column="1" />
<File FileName="TYTD.Api/Server/Models/InfomationQueueItem.cs" Line="280" Column="42" />
<File FileName="TYTD.Api/Server/Functions/ffmpeg.cs" Line="5" Column="15" />
<File FileName="Program.cs" Line="1060" Column="23" />
<File FileName="TYTD.Api/MyClass.cs" Line="80" Column="14" />
<File FileName="TYTD.Api/Server/Models/InfomationQueueItem.cs" Line="269" Column="74" />
<File FileName="TYTD.Api/Server/Functions/ffmpeg.cs" Line="1" Column="1" />
<File FileName="Program.cs" Line="231" Column="28" />
<File FileName="TYTD.Api/MyClass.cs" Line="287" Column="37" />
<File FileName="TYTD.Api/Server/Models/SavedChannel.cs" Line="6" Column="10" />
<File FileName="TYTD.Api/Server/Models/SavedPlaylist.cs" Line="7" Column="1" />
<File FileName="TYTD.Api/Server/Models/VideoDownloadProgress.cs" Line="13" Column="1" />
<File FileName="youtube-downloader.csproj" Line="1" Column="1" />
<File FileName="../../../usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets" Line="2101" Column="5" />
<File FileName="TYTD.Api/Server/Models/IEnumerator.cs" Line="1" Column="1" />
<File FileName="TYTD.Api/SimpleHttpExtensions.cs" Line="432" Column="1" />
<File FileName="TYTD.Api/SimpleHttpExtensions.cs" Line="17" Column="19" />
<File FileName="Broadcast.cs" Line="23" Column="38" />
<File FileName="../../../../usr/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets" Line="2101" Column="5" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="youtube-downloader" expanded="True">
<Node name="TYTD.Api" expanded="True">
<Node name="Server" expanded="True">
<Node name="Models" expanded="True" />
</Node>
</Node>
<Node name="youtube-downloader" expanded="True">
<Node name="Packages" selected="True" />
<Node name="Properties" expanded="True" />
<Node name="Program.cs" selected="True" />
</Node>
</Node>
</State>
@ -40,7 +36,7 @@
<MonoDevelop.Ide.ItemProperties.youtube-downloader PreferredExecutionTarget="MonoDevelop.Default" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore>
<Breakpoint file="/home/mike/tytd-server/TYTD.Api/Server/Models/YoutubeDownloaderResponse.cs" relfile="TYTD.Api/Server/Models/YoutubeDownloaderResponse.cs" line="10" column="1" />
<Breakpoint file="/home/ddlovato/git/tytd-server/TYTD.Api/Server/Models/YoutubeDownloaderResponse.cs" relfile="TYTD.Api/Server/Models/YoutubeDownloaderResponse.cs" line="10" column="1" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MultiItemStartupConfigurations />

29
Broadcast.cs Normal file
View File

@ -0,0 +1,29 @@
using System;
using System.Net;
namespace TYTD
{
public class Broadcast
{
public Broadcast(ushort port,string name)
{
this.port = port;
this.name = name;
}
public string name { get; set; }
public ushort port { get; set; }
}
public class BroadcastSettings
{
public BroadcastSettings()
{
name = Dns.GetHostName();
broadcast = true;
}
public bool broadcast { get; set; }
public string name { get; set; }
}
}

View File

@ -25,6 +25,8 @@ using YoutubeExplode.Playlists;
using Dasync.Collections;
using YoutubeExplode.Search;
using Hyperlinq;
using System.Net.Sockets;
using System.IO.Compression;
namespace TYTD
{
@ -39,9 +41,18 @@ namespace TYTD
}
}
static string webSitePath;
static ApiHomePageInfo info;
//static string webSitePath;
static void Main(string[] arg)
{
foreach (var dir in new[] {"Info", "PersonalPlaylist", "NotConverted","Converted","Audio","Download","Channel","Playlist","WebSite","ClosedCaptions","config/apidll","config/apistore", "Thumbnails/120x90", "Thumbnails/168x94", "Thumbnails/196x110", "Thumbnails/320x180", "Thumbnails/360x202", "Thumbnails/480x360", "Thumbnails/900x900", "Thumbnails/1280x720", "Thumbnails/1920x1080", "Thumbnails/246x138", "Thumbnails/336x188", "Thumbnails/480x270", "Thumbnails/720x404" })
{
Directory.CreateDirectory(dir);
}
info = new ApiHomePageInfo();
Directory.CreateDirectory(Path.Combine("config", "apidll"));
Downloader.GetManifest = GetManifest;
Thread t = new Thread(new ThreadStart(() => {
@ -53,12 +64,61 @@ namespace TYTD
}));
t2.Start();
string file = Path.Combine("config","discover_info.json");
BroadcastSettings settings = new BroadcastSettings();
//http://+:3250/
if(File.Exists(file))
{
settings=JsonConvert.DeserializeObject<BroadcastSettings>(file);
}
if(settings.broadcast)
{
ushort port = 3250;
if(arg.Length > 0)
{
string url0 = arg[0];
Uri uri = new Uri(url0.Replace("+", "domain"));
port = (ushort)uri.Port;
}
//UdpClient cl;
Thread t3 = new Thread(() => {
IPEndPoint end = new IPEndPoint(0, 0);
ushort _port = port;
UdpClient c = new UdpClient(new IPEndPoint(IPAddress.Any, 32501));
while (true)
{
var data= c.Receive(ref end);
string text=Encoding.UTF8.GetString(data);
if(text.Equals("TYTD_BROADCAST", StringComparison.Ordinal))
{
byte[] json = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new Broadcast(_port,settings.name)));
c.Send(json,json.Length, end);
}
}
});
t3.Start();
}
// we need to get our app name so that
// we can create unique names for our mutex and our pipe
webSitePath = Downloader.DL.GetPath(true, "WebSite");
//webSitePath = Downloader.DL.GetPath(true, "WebSite");
Directory.CreateDirectory("WebSite");
Route.Before += Route_Before;
@ -84,7 +144,7 @@ namespace TYTD
/* Playlist */
Downloader.RouteAdd("/api/AddPlaylistOnly/{Id}","Playlist","Add playlist, dont download videos\nParams:\n{Id}: Playlist Id or Url to download", AddPlaylistOnly);
Downloader.RouteAdd("/api/RedownloadPlaylist/{Id}", "Playlist", "Redownload Playlist Entries (Wont Update Playlist, use /api/AddPlaylist/ for that)\nThis will download playlist if not already done, or if playlist is empty\n(SD, Premuxed Video)\nParams:\n{Id}: Existing Playlist Id",(HttpAction)RedownloadPlaylist);
Downloader.RouteAdd("/api/RedownloadPlaylistRes/{R}/{Id}", "Playlist", "Redownload Playlist Entries (Wont Update Playlist, use /api/AddPlaylist/ for that)\nThis will download playlist if not already done, or if playlist is empty\nParams:\n{Id}: Existing Playlist Id\n{R}: 0=HD (Muxed using ffmpeg), 1=SD (Premuxed Video), 2=Audio only", (HttpAction)RedownloadPlaylistRes);
Downloader.RouteAdd("/api/RedownloadPlaylistRes/{R}/{Id}", "Playlist", "Redownload Playlist Entries (Wont Update Playlist, use /api/AddPlaylist/ for that)\nThis will download playlist if not already done, or if playlist is empty\nParams:\n{Id}: Existing Playlist Id\n{R}: 0=HD (Muxed using ffmpeg), 1=SD (Premuxed Video), 2=Audio only", (HttpAction)RedownloadPlaylistRes, "GET");
Downloader.RouteAdd("/api/AddPlaylist/{Id}","Playlist", "Add Playlist to downloader\nIt will be SD (Premuxed Video)\nParams:\n{Id}: The Id or URL for the Playlist", (HttpAction)AddPlaylist);
Downloader.RouteAdd("/api/AddPlaylistRes/{R}/{Id}","Playlist", "Add Playlist to downloader\nParams:\n{R}:0=HD (Muxed using ffmpeg), 1=SD (Premuxed Video), 2=Audio only\n{Id}: The Id or URL for the playlist", (HttpAction)AddPlaylistRes);
Downloader.RouteAdd("/api/PersonalPlaylist/{PlaylistName}","PersonalPlaylist","Create personal playlist with name",(HttpAction)PersonalPlaylist);
@ -130,12 +190,95 @@ namespace TYTD
Downloader.RouteAdd("/api/Storage/DirectoryExists/{Path}", "Storage", "returns \"true\" if directory exists or \"false\" if not",(HttpAction)StorageDirectoryExists);
Downloader.RouteAdd("/api/Storage/FileExists/{Path}","Storage","returns \"true\" if file exists or \"false\" if not", (HttpAction)StorageFileExists);
Downloader.RouteAdd("/api/Storage/File/{Path}","Storage","Get file based on working directory", (HttpAction)StorageFile);
Downloader.RouteAdd("/api/Storage/File/{Path}", "Storage", "Upload file over put (not Website Directory)", (HttpAction)UploadStorageFilePut, "PUT");
Downloader.RouteAdd("/api/Storage/Video/{Id}","Storage","",(HttpAction)Video);
Downloader.RouteAdd("/api/Storage/VideoRes/{Res}/{Id}","Storage","Download Video to Computer from Downloader\nParams:\n{Res}: 0=HD (Muxed using ffmpeg), 1=SD (Premuxed Video), 2=Audio only\n{Id}: Video Id to Download",(HttpAction)VideoRes);
Downloader.RouteAdd("/api/upload/","Storage","Upload file via POST", (HttpAction)UploadFiles, "POST");
Downloader.RouteAdd("/api/upload/","Admin","Upload file via POST", (HttpAction)UploadFiles, "POST");
Downloader.RouteAdd("/api/endpoint","Generic","POST endpoint for many functions\n<a href=\"https://tesses.cf/markdown.php#apps/tytd/api_endpoint.md\">Documentation</a>", (HttpAction)Endpoint,"POST");
Downloader.RouteAdd("/api/endpoints.html","Other","This Page", (HttpAction)Endpoints);
Downloader.RouteAdd("/api/RestartServer", "Admin", "Restart server", (req, resp, args) =>
{
if (AuthorizedAdmin(req, resp, args))
{
ApiLoader.RestartApp();
}
});
Downloader.RouteAdd("/api/KillServer", "Admin", "Stop server", (req, resp, args) =>
{
if (AuthorizedAdmin(req, resp, args))
{
ApiLoader.StopApp();
}
});
Downloader.RouteAdd("/api/HomePageChanger.html", "Admin", "Change Home Page", (HttpAction)ChangeFrontEnd);
Downloader.RouteAdd("/api/SetHomePage", "Admin", "Used by /api/HomePageChanger.html to actually change home page", (HttpAction)SetFrontEnd, "POST");
Downloader.RouteAdd("/api/RemoveUnwanted", "Admin", "Used by /api/InstallExtensionUpload", (req, resp, args) => {
if(AuthorizedAdmin(req, resp, args))
{
req.ParseBody(args);
foreach(var a in args)
{
try
{
ApiLoader.UninstallExtension(a.Key);
}
catch(Exception ex)
{
_ = ex;
}
}
}
},"POST");
Downloader.RouteAdd("/api/InstallExtensionUpload", "Admin", "Install Extension from Upload",(request, response, arguments) =>
{
if (Authorized(request, response, arguments))
{
Directory.CreateDirectory("extension_temp");
var files = request.ParseBody(arguments, (fieldName, fileName, contentType) =>
{
return File.Create($"extension_temp/{fileName}");
});
List<(ext_conf conf, string name)> ext_names = new List<(ext_conf, string)>();
foreach (var f in files)
{
f.Value.Dispose();
string key = f.Value.FileName;
ext_names.Add(ApiLoader.InstallExtension($"extension_temp/{key}"));
}
Directory.Delete("extension_temp",true);
StringBuilder fields = new StringBuilder();
foreach (var item in ext_names)
{
string name = WebUtility.HtmlEncode(item.name);
string name_text = WebUtility.HtmlEncode(item.conf.name);
string desc = string.Join("<br>", item.conf.desc.Split('\n').Select<string, string>(e => { return WebUtility.HtmlEncode(e); }));
string data = "";
string root = Path.Combine(Environment.CurrentDirectory, "config");
string fallbackIcon = Path.Combine(root, "default_icon.png");
string icon = Path.Combine(root, "apiicons", name + ".png");
string icon2 = File.Exists(icon) ? icon : fallbackIcon;
if (File.Exists(icon2))
{
data = Convert.ToBase64String(File.ReadAllBytes(icon2));
}
fields.Append("<td><input type=\"checkbox\" name=\"{name}\"></td><td><img src=\"data:image/png;base64,{data}\"</td> <td>{name_text}</td><td>{desc}</td>");
}
string html = $"<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Extensions Installed</title></head><body><h1>Do You Want all of these Extensions</h1><h3>If you kill the downloader before Accept, these extensions will be installed</h3> <form action=\"../api/RemoveUnwanted\" method=\"POST\"><table><tr><th>Remove This</th><th>Icon</th> <th>Title</th> <th>Description</th> </tr>{fields.ToString()} </table><input type=\"submit\" value=\"Remove\"></form></body></html>";
response.AsText(html);
}
},"POST");
Route.Add("/api/example_tripple_structure.json", (req, resp, args) =>
{
List<IDResolutionTypeTriplet> v = new List<IDResolutionTypeTriplet>();
@ -148,7 +291,38 @@ namespace TYTD
resp.AsJson(v);
});
ApiLoader.Init();
var cancel= ApiLoader.Init(info);
if (string.IsNullOrWhiteSpace(Config.HomePageExtension))
{
info.Change(null);
}
else
{
foreach(var ext in ApiLoader.EnumerateExtensions())
{
if(ext.CanProvideHomePage)
{
if(ext.Name.Equals(Config.HomePageExtension))
{
info.Change(ext);
}
}
}
}
info.Changed += (sender, e) =>
{
if(info.HasHomePage)
{
Config.HomePageExtension = info.HomePage.Name;
Config.Save();
}
else
{
Config.HomePageExtension = "";
Config.Save();
}
};
Downloader.RouteAdd("/api{p}","Other","Just a redirect to /api/endpoints.html", (request, response, action) =>
{
request.RedirectIt(response, "/api/endpoints.html");
@ -158,11 +332,11 @@ namespace TYTD
/* Other */
Downloader.RouteAdd("/","Other","Home page", (HttpAction)Index);
Downloader.RouteAdd("/", "Other", "Home page", (HttpAction)Index, "GET");
Downloader.RouteAdd("/extensions.html","Other","Extensions URL", (HttpAction)Extensions);
Downloader.RouteAdd("/{Path}","Other","Website Files", (HttpAction)RootPath);
Downloader.RouteAdd("/{Path}","Other","Upload file over put",(HttpAction)UploadFilePut,"PUT");
Console.CancelKeyPress += (sender, e) => { ApiLoader.Dispose();var date = DateTime.Now.ToString("yyyyMMdd_HHmmss");Directory.CreateDirectory(Path.Combine("config","queues-close")); File.WriteAllText(Path.Combine("config", "queues-close", $"{date}.json"), Downloader.GetQueue()); Console.WriteLine("TYTD has Closed"); Environment.Exit(0); };
Downloader.RouteAdd("/{Path}","Admin","Upload file over put",(HttpAction)UploadFilePut,"PUT");
Console.CancelKeyPress += (sender, e) => { ApiLoader.Dispose();var date = DateTime.Now.ToString("yyyyMMdd_HHmmss");Directory.CreateDirectory(Path.Combine("config","queues-close")); File.WriteAllText(Path.Combine("config", "queues-close", $"{date}.json"), Downloader.GetQueue()); Console.WriteLine("TYTD has Closed"); ApiLoader.StopApp(); };
Console.WriteLine("Almost Ready To Listen");
@ -170,15 +344,124 @@ namespace TYTD
if (arg.Length > 0)
{
HttpServer.ListenAsync(arg[0], CancellationToken.None, Route.OnHttpRequestAsync).Wait();
HttpServer.ListenAsync(arg[0],cancel, Route.OnHttpRequestAsync).Wait();
}
else
{
HttpServer.ListenAsync(3250, CancellationToken.None, Route.OnHttpRequestAsync).Wait();
}
HttpServer.ListenAsync(3250,cancel, Route.OnHttpRequestAsync).Wait();
}
if(ApiLoader.Restart)
{
var fileName = Assembly.GetExecutingAssembly().Location;
StringBuilder args = new StringBuilder();
foreach(var arg0 in arg)
{
args.Append($"\"{arg0}\"");
}
System.Diagnostics.Process.Start(fileName,args.ToString());
}
}
public class Configuration
{
public string AdminUserName { get; set; }
public string AdminPassword { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string HomePageExtension { get; set; }
public void Save()
{
File.WriteAllText("config/configuration.json", JsonConvert.SerializeObject(this));
}
}
public static Configuration OpenConfig()
{
Directory.CreateDirectory("config");
if (File.Exists("config/configuration.json"))
{
return JsonConvert.DeserializeObject<Configuration>(File.ReadAllText("config/configuration.json"));
}
return new Configuration();
}
public static bool EmptyAuthorization(this Configuration config)
{
return string.IsNullOrWhiteSpace(config.UserName) && string.IsNullOrWhiteSpace(config.Password);
}
public static bool EmptyAuthorizationAdmin(this Configuration config)
{
return string.IsNullOrWhiteSpace(config.AdminUserName) && string.IsNullOrWhiteSpace(config.AdminPassword);
}
public static bool ValidAuthAdmin(this Configuration config, HttpListenerRequest req)
{
if (req.Headers.AllKeys.Contains("Authorization"))
{
string[] authorization = req.Headers["Authorization"].Split(' ');
//authorization_basic
if (authorization[0] == "Basic")
{
string userPass = Encoding.UTF8.GetString(Convert.FromBase64String(authorization[1]));
return userPass.Equals($"{config.AdminUserName}:{config.AdminPassword}", StringComparison.Ordinal);
}
}
return false;
}
public static bool ValidAuth(this Configuration config,HttpListenerRequest req)
{
if (req.Headers.AllKeys.Contains("Authorization"))
{
string[] authorization=req.Headers["Authorization"].Split(' ');
//authorization_basic
if(authorization[0]=="Basic")
{
string userPass=Encoding.UTF8.GetString(Convert.FromBase64String(authorization[1]));
return userPass.Equals($"{config.UserName}:{config.Password}",StringComparison.Ordinal);
}
}
return false;
}
internal static Configuration Config=OpenConfig();
internal static bool AuthorizedAdmin(HttpListenerRequest req, HttpListenerResponse resp, Dictionary<string, string> args)
{
if(Config.EmptyAuthorizationAdmin())
{
return true;
}
if(Config.ValidAuthAdmin(req))
{
return true;
}
resp.WithHeader("WWW-Authenticate", "Basic realm=\"TYTD_ADMIN\"").WithCode(HttpStatusCode.Unauthorized).AsText("Unauthorized");
return false;
}
internal static bool Authorized(HttpListenerRequest req, HttpListenerResponse resp, Dictionary<string, string> args)
{
if (Config.EmptyAuthorization())
{
return true;
}
if (Config.ValidAuth(req))
{
return true;
}
if(!Config.EmptyAuthorizationAdmin())
{
if(Config.ValidAuthAdmin(req))
{
return true;
}
}
resp.WithHeader("WWW-Authenticate", "Basic realm=\"TYTD_APP\"").WithCode(HttpStatusCode.Unauthorized).AsText("Unauthorized");
return false;
}
public static void AddEscapedHtml<T>(this Dictionary<T,string> dict,T key,string value)
{
@ -289,7 +572,7 @@ namespace TYTD
}
public static void Redownload(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
foreach (var item in Directory.GetFiles(Downloader.DL.GetPath(true, "Info"), "*.json"))
foreach (var item in Directory.GetFiles("Info", "*.json"))
{
string id =Path.GetFileNameWithoutExtension(item);
if(!File.Exists(Path.Combine("NotConverted",$"{id}.mp4")))
@ -311,7 +594,7 @@ namespace TYTD
return;
}
string res_str = new[]{"Converted","NotConverted","Audio"}[res];
foreach (var item in Directory.GetFiles(Downloader.DL.GetPath(true, "Info"), "*.json"))
foreach (var item in Directory.GetFiles( "Info", "*.json"))
{
string id = Path.GetFileNameWithoutExtension(item);
if (!File.Exists(Path.Combine(res_str, $"{id}.mp4")))
@ -324,7 +607,7 @@ namespace TYTD
}
public static void Watch(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
var txt = Templating.RenderFile(Path.Combine(webSitePath, "watch_page.thtml"), args); //populate template
var txt = Templating.RenderFile(Path.Combine("WebSite", "watch_page.thtml"), args); //populate template
rp.AsText(txt);
}
#endregion
@ -911,7 +1194,7 @@ namespace TYTD
#region Storage
public static void StorageGetDirectories(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string path = Downloader.DL.GetPath(true, System.Web.HttpUtility.UrlDecode(args["Path"]));
string path = System.Web.HttpUtility.UrlDecode(args["Path"]);
if (Directory.Exists(path))
{
@ -925,7 +1208,7 @@ namespace TYTD
}
public static void StorageGetFiles(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string path = Downloader.DL.GetPath(true, System.Web.HttpUtility.UrlDecode(args["Path"]));
string path = System.Web.HttpUtility.UrlDecode(args["Path"]);
if (Directory.Exists(path))
{
@ -939,14 +1222,14 @@ namespace TYTD
}
public static void StorageDirectoryExists(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string path = Downloader.DL.GetPath(true, System.Web.HttpUtility.UrlDecode(args["Path"]));
string path =System.Web.HttpUtility.UrlDecode(args["Path"]);
string json = Directory.Exists(path) ? "true" : "false";
rp.AsText(json, "text/plain");
}
public static void StorageFileExists(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string path = Downloader.DL.GetPath(true, System.Web.HttpUtility.UrlDecode(args["Path"]));
string path =System.Web.HttpUtility.UrlDecode(args["Path"]);
string json = File.Exists(path) ? "true" : "false";
rp.AsText(json, "text/plain");
@ -959,7 +1242,7 @@ namespace TYTD
}
else
{
string path = Downloader.DL.GetPath(true, System.Web.HttpUtility.UrlDecode(args["Path"]));
string path = System.Web.HttpUtility.UrlDecode(args["Path"]);
if (Directory.Exists(path))
{
string indexHtml = Path.Combine(path, "index.html");
@ -969,7 +1252,7 @@ namespace TYTD
}
else
{
string dir = Path.Combine(webSitePath, "err", "dir.html");
string dir = Path.Combine("WebSite", "err", "dir.html");
StringBuilder b = new StringBuilder();
var f = Directory.GetLastWriteTime(Path.GetDirectoryName(path));
string parentModified = $"{f.ToShortDateString()} {f.ToShortTimeString()}";
@ -1009,7 +1292,7 @@ namespace TYTD
VideoId? vid = VideoId.TryParse(System.Web.HttpUtility.UrlDecode(args["Id"]));
if (vid.HasValue)
{
string path = Downloader.DL.GetPath(true, "NotConverted",vid.Value +".mp4");
string path = $"NotConverted/{vid.Value}.mp4";
rp.AddHeader("Content-Disposition", GetVideoContentDisposition(vid.Value).ToString());
rp.AsFile(rq, path);
}
@ -1035,7 +1318,7 @@ namespace TYTD
else
{
string[] m = new string[] { "Converted", "NotConverted", "Audio" };
string path = Downloader.DL.GetPath(true, m[res], vid.Value + ".mp4");
string path = $"{m[res]}/{vid.Value}.mp4";
rp.AddHeader("Content-Disposition", GetVideoContentDisposition(vid.Value).ToString());
rp.AsFile(rq, path);
}
@ -1065,7 +1348,7 @@ namespace TYTD
public static string GetVideoName(string id)
{
string name = id + ".mp4";
string path = Downloader.DL.GetPath(true, "Info", id + ".json");
string path = $"Info/{id}.json";
if (File.Exists(path))
{
string info=File.ReadAllText(path);
@ -1089,14 +1372,74 @@ namespace TYTD
{
var files = rq.ParseBody(args);
foreach (var f in files.Values)
f.Save(Path.Combine(webSitePath, f.FileName));
f.Save(Path.Combine("WebSite", f.FileName));
rp.AsText("uploaded", "text/plain");
}
#endregion
#region Other
public static void SetFrontEnd(HttpListenerRequest req,HttpListenerResponse resp,Dictionary<string,string> args)
{
if(AuthorizedAdmin(req,resp,args))
{
req.ParseBody(args);
if(args.ContainsKey("frontend"))
{
string value=args["frontend"];
if (string.IsNullOrWhiteSpace(value))
{
info.Change(null);
}
else {
foreach (var ext in ApiLoader.EnumerateExtensions())
{
if(ext.CanProvideHomePage)
{
if(value.Equals(ext.Name))
{
info.Change(ext);
}
}
}
}
}
resp.AsRedirect("../");
}
}
public static void ChangeFrontEnd(HttpListenerRequest req,HttpListenerResponse resp,Dictionary<string,string> args)
{
if (AuthorizedAdmin(req, resp, args))
{
Dictionary<string, string> arg_ = new Dictionary<string, string>();
if (info.HasHomePage)
{
arg_.Add("DefaultSelected", "");
}
else
{
arg_.Add("DefaultSelected", "selected");
}
StringBuilder b = new StringBuilder();
foreach (var ext in ApiLoader.EnumerateExtensions())
{
if (ext.CanProvideHomePage)
{
string selected = ext == info.HomePage ? " selected" : "";
string htmlCode = $"<option value=\"{ext.Name}\"{selected}>{ext.Name}</option>";
b.Append(htmlCode);
}
}
arg_.Add("Frontends", b.ToString());
string r=ApiLoader.RenderFileOrDefault("WebPage/err/change_frontend_ui.html", "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Select Home Page</title></head><body><h1>Select Home Page</h1><form action=\"../api/SetHomePage\" method=\"POST\"><select name=\"frontend\"><option value=\"\" {DefaultSelected}>Default</option>{Frontends}</select><input type=\"submit\" value=\"Set\"></form></body></html>", arg_);
resp.AsText(r);
}
// /err/change_frontend_ui.html
}
public static void Index(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string r = ApiLoader.ReadAllTextOrDefault(Path.Combine(webSitePath, "index.html"), "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>TYTD</title></head><body><h1>TYTD</h1><form action=\"./api/endpoint\" method=\"POST\"><input type=\"text\" name=\"url\"><select name=\"resolution\"><option value=\"1\" selected>SD</option><option value=\"0\">HD</option><option value=\"2\">Audio</option></select><input type=\"submit\" value=\"Add To Downloader\"></form>Existing Videos: <form action=\"./api/SearchVideos/\" method=\"POST\"><input type=\"search\" name=\"query\"><input type=\"submit\" value=\"Search\"></form><br><a href=\"./api/Progress.html\">Get Progress</a><br><a href=\"./api/QueueListPage/\">List Queue</a><br><a href=\"./api/ListPlaylists/\">List Playlists</a><br></body></html>");
string r = ApiLoader.ReadAllTextOrDefault( "WebSite/index.html", "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>TYTD</title></head><body><h1>TYTD</h1><form action=\"./api/endpoint\" method=\"POST\"><input type=\"text\" name=\"url\"><select name=\"resolution\"><option value=\"1\" selected>SD</option><option value=\"0\">HD</option><option value=\"2\">Audio</option></select><input type=\"submit\" value=\"Add To Downloader\"></form>Existing Videos: <form action=\"./api/SearchVideos/\" method=\"POST\"><input type=\"search\" name=\"query\"><input type=\"submit\" value=\"Search\"></form><br><a href=\"./api/Progress.html\">Get Progress</a><br><a href=\"./api/QueueListPage/\">List Queue</a><br><a href=\"./api/ListPlaylists/\">List Playlists</a><br></body></html>");
rp.AsText( r);
}
@ -1104,10 +1447,31 @@ namespace TYTD
{
rp.AsText(ApiLoader.Page);
}
private static void UploadStorageFilePut(HttpListenerRequest request,HttpListenerResponse resp,Dictionary<string,string> args)
{
string path = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
bool exists = File.Exists(path);
using (var instr = request.InputStream)
{
using (var outStr = File.Create(path))
{
instr.CopyTo(outStr);
}
}
if (exists)
{
resp.WithCode(HttpStatusCode.NoContent);
}
else
{
resp.WithCode(HttpStatusCode.Created);
}
}
private static void UploadFilePut(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments)
{
string p = System.Web.HttpUtility.UrlDecode(arguments["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
string path = Path.Combine(webSitePath, p);
string path = Path.Combine("WebSite", p);
bool exists = File.Exists(path);
using (var instr = request.InputStream)
{
@ -1173,7 +1537,7 @@ namespace TYTD
if (arguments["operation"] == "create_personal_playlist")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path = $"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = new List<(string Id, Resolution Resolution)>();
@ -1184,7 +1548,7 @@ namespace TYTD
else if (arguments["operation"] == "create_personal_playlist_res")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path=$"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = new List<(string Id, Resolution Resolution)>();
@ -1202,7 +1566,7 @@ namespace TYTD
else if (arguments["operation"] == "add_to_personal_playlist")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path = $"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = JsonConvert.DeserializeObject<List<(string Id, Resolution Resolution)>>(File.ReadAllText(path));
@ -1214,7 +1578,7 @@ namespace TYTD
else if (arguments["operation"] == "add_to_personal_playlist_res")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path = $"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = JsonConvert.DeserializeObject<List<(string Id, Resolution Resolution)>>(File.ReadAllText(path));
@ -1231,7 +1595,7 @@ namespace TYTD
else if (arguments["operation"] == "insert_to_personal_playlist")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path =$"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = JsonConvert.DeserializeObject<List<(string Id, Resolution Resolution)>>(File.ReadAllText(path));
@ -1249,7 +1613,7 @@ namespace TYTD
else if (arguments["operation"] == "remove_from_personal_playlist")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path =$"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = JsonConvert.DeserializeObject<List<(string Id, Resolution Resolution)>>(File.ReadAllText(path));
@ -1267,7 +1631,7 @@ namespace TYTD
else if (arguments["operation"] == "insert_to_personal_playlist_res")
{
string myName = arguments["name"];
string path = Downloader.DL.GetPath(true, "PersonalPlaylist", $"{myName}.json");
string path =$"PersonalPlaylist/{myName}.json";
string[] ids = System.Web.HttpUtility.UrlDecode(arguments["ids"]).Split(',');
var list = JsonConvert.DeserializeObject<List<(string Id, Resolution Resolution)>>(File.ReadAllText(path));
@ -1332,7 +1696,7 @@ namespace TYTD
else
{
string[] m = new string[] { "Converted", "NotConverted", "Audio" };
string path = Downloader.DL.GetPath(true, m[res], vid.Value + ".mp4");
string path = $"{m[res]}/{vid.Value}.mp4";
response.AddHeader("Content-Disposition", GetVideoContentDisposition(vid.Value).ToString());
response.AsFile(request, path);
hasOtherResponse = true;
@ -1348,7 +1712,7 @@ namespace TYTD
else
{
string path = Downloader.DL.GetPath(true, "NotConverted", vid.Value + ".mp4");
string path = $"NotConverted/{vid.Value}.mp4";
response.AddHeader("Content-Disposition", GetVideoContentDisposition(vid.Value).ToString());
response.AsFile(request, path);
hasOtherResponse = true;
@ -1427,18 +1791,49 @@ namespace TYTD
}
public static void RootPath(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{
string p = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries)[0];
string path = Path.Combine(webSitePath, p);
string[] p0 = System.Web.HttpUtility.UrlDecode(args["Path"]).Split(new char[] { '?' }, StringSplitOptions.RemoveEmptyEntries);
string p = p0[0];
args.Clear();
if (p0.Length >= 2)
{
foreach (var item in p0[1].Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries))
{
var sub = item.Split(new char[] { '=' });
if (sub.Length == 2)
{
if (!args.ContainsKey(sub[0]))
args.Add(sub[0], sub[1]);
}
else
{
if (!args.ContainsKey(sub[0]))
args.Add(sub[0], "");
}
}
}
string path =$"WebSite/{p}";
if (Directory.Exists(path))
{
string indexHtml = Path.Combine(path, "index.html");
//bool j=false;
if(info.HasHomePage)
{
if(info.HomePage.OnHomePage(indexHtml,rq,rp,args))
{
return;
}
}
if (File.Exists(indexHtml))
{
path = indexHtml;
}
else
{
string dir = Path.Combine(webSitePath,"err", "dir.html");
string dir = "WebSite/err/dir.html";
StringBuilder b = new StringBuilder();
var f= Directory.GetLastWriteTime(Path.GetDirectoryName(path));
string parentModified = $"{f.ToShortDateString()} {f.ToShortTimeString()}";
@ -1469,6 +1864,14 @@ namespace TYTD
return;
}
}
if (info.HasHomePage)
{
if (info.HomePage.OnHomePage(p, rq, rp, args))
{
return;
}
}
@ -1478,8 +1881,9 @@ namespace TYTD
public static bool Route_Before(HttpListenerRequest request, HttpListenerResponse response)
{
Dictionary<string, string> args = new Dictionary<string, string>();
response.WithCORS();
return false;
return !Authorized(request, response,args);
}
public static void RedirectIt(this HttpListenerRequest req,HttpListenerResponse resp,string path="/")
{
@ -1507,4 +1911,5 @@ namespace TYTD
}
}
}

View File

@ -1,3 +1,7 @@
# Tesses YouTube Downloader
Download YouTube Videos
# Download The Binaries
[Latest Version](https://downloads.tesses.cf/apps/tytd/binaries/tytd-binary-latest.tar.gz)
[All Versions](https://downloads.tesses.cf/apps/tytd/binaries/)

View File

@ -1,18 +1,30 @@
using System;
using TYTD.Server.Models;
using TYTD.Server.Functions;
using System.Threading;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Reflection;
using System.Linq;
using System.Text;
using System.Threading;
using Newtonsoft.Json;
using SimpleHttp;
using TYTD.Server.Functions;
using TYTD.Server.Models;
namespace TYTD
{
public abstract class Api : IDisposable
{
public virtual bool OnHomePage(string path,HttpListenerRequest req,HttpListenerResponse resp,Dictionary<string,string> args)
{
return false;
}
public virtual bool OnTemplatePage(string path,out string template_string)
{
template_string = "";
return false;
}
public bool CanProvideHomePage { get; protected set; }
public virtual void OnStart()
{
Console.WriteLine("Extension Loaded");
@ -113,14 +125,118 @@ namespace TYTD
public bool Cancel { get; set; }
}
public class ApiHomePageInfo
{
public event EventHandler Changed;
public ApiHomePageInfo()
{
HasHomePage = false;
HomePage = null;
}
public ApiHomePageInfo(Api api)
{
HasHomePage = api != null;
HomePage = api;
}
public void Change(Api api)
{
HasHomePage = api != null;
HomePage = api;
if(Changed != null)
{
Changed.Invoke(this, EventArgs.Empty);
}
}
public bool HasHomePage { get; private set; }
public Api HomePage { get; private set; }
}
public static class ApiLoader
{
public static void CopyDir(string src, string dest,bool canoverride=false)
{
Directory.CreateDirectory(dest);
//Console.WriteLine($"Created directory {dest}"); ;
foreach (var dir in Directory.EnumerateDirectories(src))
{
CopyDir(dir, Path.Combine(dest, Path.GetFileName(dir)));
}
foreach (var file in Directory.EnumerateFiles(src))
{
if(File.Exists(Path.Combine(dest, Path.GetFileName(file))))
{
if(canoverride)
{
File.Delete(Path.Combine(dest, Path.GetFileName(file)));
}
else { continue; }
}
File.Copy(file, Path.Combine(dest, Path.GetFileName(file)));
//Console.WriteLine($"Copied {file} -> {Path.Combine(dest, Path.GetFileName(file))}");
}
//Console.WriteLine($"Copied directory {src} -> {dest}");
}
public static void UninstallExtension(string name)
{
Directory.Delete($"config/apidll/{name}",true);
Directory.Delete($"config/apistore/{name}", true);
File.Delete($"config/apiicons/{name}.png");
}
public static (ext_conf conf,string name) InstallExtension(string archive)
{
if(Directory.Exists($"{archive}_contents"))
{
Directory.Delete($"{archive}_contents", true);
}
ZipFile.ExtractToDirectory(archive, $"{archive}_contents");
//we need to read manifest json
string manifest = $"{archive}_contents/manifest.json";
ext_conf conf = JsonConvert.DeserializeObject<ext_conf>(File.ReadAllText(manifest));
string extName = Path.GetFileName(conf.binPath);
Directory.CreateDirectory($"config/apidll/{extName}");
Directory.CreateDirectory($"config/apistore/{extName}");
Directory.CreateDirectory("config/apiicons");
File.Copy($"{archive}_contents/{conf.icon}", $"config/apiicons/{extName}.png");
string parDirOf = Path.GetDirectoryName($"{archive}_contents/{conf.binPath}");
CopyDir(parDirOf, $"config/apidll/{extName}", true);
CopyDir($"{archive}_contents/files", $"config/apistore/{extName}", true);
Directory.Delete($"{archive}_contents");
return (conf,extName);
}
static bool start_term=false;
public static bool StartTermination { get { return start_term; } set { start_term = value; if (start_term) { _cancel.Cancel(); } } }
public static bool Restart { get; set; }
public static void StopApp()
{
Restart = false;
StartTermination = true;
}
public static void RestartApp()
{
Restart = true;
StartTermination = true;
}
public static string RenderFileOrDefault(string file,string defaultData,Dictionary<string,string> arg)
{
return Templating.RenderString(ReadAllTextOrDefault(file, defaultData), arg);
}
public static string ReadAllTextOrDefault(string file,string defaultData)
{
if(_info.HasHomePage)
{
//starts with website so remove WebSite\
string path = file.Substring(7);
string data;
if(_info.HomePage.OnTemplatePage(path,out data))
{
return data;
}
}
if (File.Exists(file))
{
return File.ReadAllText(file);
@ -206,8 +322,17 @@ namespace TYTD
}
}
public static void Init()
public static IEnumerable<Api> EnumerateExtensions()
{
return apis;
}
static CancellationTokenSource _cancel;
private static ApiHomePageInfo _info;
public static CancellationToken Init(ApiHomePageInfo info)
{
_cancel = new CancellationTokenSource();
_info = info;
StringBuilder b = new StringBuilder();
string root = Path.Combine(Environment.CurrentDirectory,"config", "apidll");
string appconfroot = Path.Combine(Environment.CurrentDirectory,"config", "apistore");
@ -224,10 +349,29 @@ namespace TYTD
}
Dictionary<string, string> templating = new Dictionary<string, string>();
templating.Add("Items", b.ToString());
string combined= Path.Combine("WebSite", "extensions.html");
string combined= "WebSite/extensions.html";
info.Changed += (sender, e) => {
//it will change immediately
string template = "<!DOCTYPE html><head><title>Extensions</title></head><body><h1>Extensions</h1><table><thead><tr><th>Name</th><th>Urls</th></tr></thead><tbody>{Items}</tbody></table></body></html>";
template = ReadAllTextOrDefault(combined, template);
Page = Templating.RenderString(template, templating);
};
return _cancel.Token;
}
}
public class ext_conf
{
public string binPath { get; set; }
public string name { get; set; }
public string icon { get; set; }
public string desc { get; set; }
public bool hasHomePageOverride { get; set; }
}
}

View File

@ -487,28 +487,7 @@ namespace TYTD.Server.Functions
}
return true;
}
private string gStorageLocation()
{
if (File.Exists("loc.txt"))
{
string loc = File.ReadAllText("loc.txt");
try
{
Directory.CreateDirectory(loc);
if (Directory.Exists(loc))
{
return loc;
}
} catch (Exception ex)
{
Console.WriteLine(ex.Message);
_ = ex;
}
}
return Environment.CurrentDirectory;
}
public string StorageLocation { get { return gStorageLocation(); } }
// public string StorageLocation { get { return gStorageLocation(); } }
private void _DownloadVideos(SavedVideoObject[] items)
{
@ -536,11 +515,11 @@ namespace TYTD.Server.Functions
public static Func<YoutubeClient,VideoId, Task<StreamManifest>> GetManifest;
private async Task DownloadHDVideo(SavedVideoObject v,CancellationToken token)
{
string mypath = GetPath(true, "Converted", v.Video.Id + "-vidonly.bkp");
string mypathaudio = GetPath(true, "Audio", v.Video.Id + "incomplete.mp4");
string mypathCompleteAudio = GetPath(true, "Audio", v.Video.Id + ".mp4");
string mypathComplete = GetPath(true, "Converted", v.Video.Id + ".mp4");
string mypathIncompleteConverting = GetPath(true, "Converted", "conv.mkv");
string mypath = Path.Combine("Converted", v.Video.Id + "-vidonly.bkp");
string mypathaudio = Path.Combine( "Audio", v.Video.Id + "incomplete.mp4");
string mypathCompleteAudio = Path.Combine( "Audio", v.Video.Id + ".mp4");
string mypathComplete = Path.Combine("Converted", v.Video.Id + ".mp4");
string mypathIncompleteConverting = Path.Combine( "Converted", "conv.mkv");
if (Continue(mypathComplete))
{
@ -596,6 +575,10 @@ namespace TYTD.Server.Functions
do
{
read = await srcStrm.ReadAsync(buffer, 0, buffer.Length,token);
if(ApiLoader.StartTermination)
{
return;
}
if (token.IsCancellationRequested)
{
cancelSrc.Item.Dispose();
@ -746,8 +729,8 @@ namespace TYTD.Server.Functions
}
private async Task DownloadSDVideo(SavedVideoObject v, CancellationToken token)
{
string mypath2 = GetPath(true, "NotConverted", v.Video.Id + "incomplete.mp4");
string mypath2Complete = GetPath(true, "NotConverted", v.Video.Id + ".mp4");
string mypath2 = Path.Combine("NotConverted", v.Video.Id + "incomplete.mp4");
string mypath2Complete = Path.Combine( "NotConverted", v.Video.Id + ".mp4");
if (Continue(mypath2Complete))
{
@ -794,6 +777,10 @@ namespace TYTD.Server.Functions
do
{
read = await srcStrm.ReadAsync(buffer, 0, buffer.Length, token);
if(ApiLoader.StartTermination)
{
return;
}
if (token.IsCancellationRequested)
{
cancelSrc.Item.Dispose();
@ -848,8 +835,8 @@ namespace TYTD.Server.Functions
}
private async Task DownloadAudio(SavedVideoObject v, CancellationToken token)
{
string mypath3 = GetPath(true, "Audio", v.Video.Id + "incomplete.mp4");
string mypath3Complete = GetPath(true, "Audio", v.Video.Id + ".mp4");
string mypath3 = Path.Combine( "Audio", v.Video.Id + "incomplete.mp4");
string mypath3Complete = Path.Combine("Audio", v.Video.Id + ".mp4");
if (Continue(mypath3Complete))
{
var s2 = await GetManifest(ytc, v.Video.Id);
@ -896,6 +883,10 @@ namespace TYTD.Server.Functions
do
{
read = await srcStrm.ReadAsync(buffer, 0, buffer.Length,token);
if (ApiLoader.StartTermination)
{
return;
}
if (token.IsCancellationRequested)
{
cancelSrc.Item.Dispose();
@ -978,7 +969,7 @@ namespace TYTD.Server.Functions
}
int fileI = 1;
P.Saved.Title = name;
name = GetPath(true, "Download", name);
name = Path.Combine("Download", name);
string filename = name;
while (FileExists(name, ref filename, ref fileI)) { }
long Len2 = long.MaxValue;
@ -1144,7 +1135,10 @@ namespace TYTD.Server.Functions
{
do
{
if (ApiLoader.StartTermination)
{
return;
}
await DownloadItem(cancelSrc.Item.Token);
}
@ -1154,7 +1148,7 @@ namespace TYTD.Server.Functions
{
try
{
string p = GetPath(true, "Thumbnails", w.ToString() + 'x' + h.ToString(), id + ".jpg");
string p = Path.Combine( "Thumbnails", w.ToString() + 'x' + h.ToString(), id + ".jpg");
if (!File.Exists(p))
{
ffmpeg.download_thumbnail(tnail, p);
@ -1171,7 +1165,7 @@ namespace TYTD.Server.Functions
{
try
{
string p = GetPath(true, "Thumbnails", w.ToString() + 'x' + h.ToString(), id + ".jpg");
string p = Path.Combine("Thumbnails", w.ToString() + 'x' + h.ToString(), id + ".jpg");
if (!File.Exists(p))
{
using (var f = File.Create(p))
@ -1385,7 +1379,7 @@ namespace TYTD.Server.Functions
{
DownloadUser(name, Resolution.NoConvert);
}
public string GetPath(bool createParent,params string[] _path)
/*public string GetPath(bool createParent,params string[] _path)
{
if (createParent)
@ -1413,7 +1407,7 @@ namespace TYTD.Server.Functions
array2[0] = StorageLocation;
Array.Copy(_path, 0, array2, 1,_path.Length);
return Path.Combine(array2);
}
}*/
public static Downloader DL = new Downloader();
}

View File

@ -23,7 +23,7 @@ namespace TYTD.Server.Functions
public static void on_video_done(string id,int res)
{
string path_to_video_id = Path.Combine(Downloader.DL.StorageLocation,"Info",$"{id}.json");
string path_to_video_id = Path.Combine("Info",$"{id}.json");
Directory.CreateDirectory("config");
string vdone= Path.Combine(Environment.CurrentDirectory, "config", "done");
@ -60,13 +60,13 @@ namespace TYTD.Server.Functions
}
}
}
//internal static async Task download_thumb2(string )
internal static void download_thumbnail(string tnail, string p2)
{
using (var p = new Process())
{
p.StartInfo.FileName = "/bin/bash";
p.StartInfo.Arguments = $"\"{Downloader.DL.GetPath(true, "thumbs")}\" \"{tnail}\" \"{p2}\"";
p.StartInfo.Arguments = $"\"config/thumbs\" \"{tnail}\" \"{p2}\"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

View File

@ -86,18 +86,19 @@ namespace TYTD.Server.Models
case InfoType.FileDownload:
return new SavedVideoObject[] { new SavedVideoObject(Data) };
case InfoType.ClosedCaptions:
string path = Functions.Downloader.DL.GetPath(true, "ClosedCaptions", Data);
string path = $"ClosedCaptions/{Data}";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
var cc0 = await Functions.Downloader.DL.ytc.Videos.ClosedCaptions.GetManifestAsync(Data);
string trackInfo = Functions.Downloader.DL.GetPath(true, "ClosedCaptions", Data,"track_info.json");
string trackInfo = $"ClosedCaptions/{Data}/track_info.json";
File.WriteAllText(trackInfo, JsonConvert.SerializeObject(cc0.Tracks));
foreach (var track in cc0.Tracks)
{
string trackType = track.IsAutoGenerated ? "auto" : "manu";
string langFileName = $"{trackType}_{track.Language.Code}.srt";
string track2 = Functions.Downloader.DL.GetPath(true, "ClosedCaptions", Data,langFileName);
string track2 = $"ClosedCaptions/{Data}/{langFileName}";
await Functions.Downloader.DL.ytc.Videos.ClosedCaptions.DownloadAsync(track, track2);
await Task.Delay(10);
}
@ -106,7 +107,7 @@ namespace TYTD.Server.Models
break;
case InfoType.Video:
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", Data + ".json");
string infPath = $"Info/{Data}.json";
SavedVideoObject sv;
bool exist = File.Exists(infPath);
if (exist)
@ -141,11 +142,11 @@ namespace TYTD.Server.Models
List<string> vo = new List<string>();
SavedPlaylist pl = await SavedPlaylist.FromPlaylistId(res, Functions.Downloader.DL.ytc, Data, (e, f) => { vo.Add(e); }, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Playlist", Data + ".json");
string infpath = $"Playlist/{Data}.json";
File.WriteAllText(infpath, JsonConvert.SerializeObject(pl));
foreach(var str in vo)
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", str + ".json");
string infPath = $"Info/{str}.json";
SavedVideoObject sv;
bool exist = File.Exists(infPath);
if (exist)
@ -195,14 +196,14 @@ namespace TYTD.Server.Models
{
var c = Functions.Downloader.DL.ytc.Channels.GetAsync(Data).GetAwaiter().GetResult();
SavedChannel c2 = SavedChannel.FromChannel(c, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Channel", Data + ".json");
string infpath = $"Channel/{Data}.json";
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
Functions.Downloader.DL.ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) =>
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", v.Id + ".json");
string infPath = $"Info/{v.Id}.json";
bool exist = File.Exists(infPath);
if (exist)
@ -258,14 +259,14 @@ namespace TYTD.Server.Models
{
var c = Functions.Downloader.DL.ytc.Channels.GetByUserAsync(Data).GetAwaiter().GetResult();
SavedChannel c2 = SavedChannel.FromChannel(c, Functions.Downloader.DL._DownloadThumbnail);
string infpath = Functions.Downloader.DL.GetPath(true, "Channel", Data + ".json");
string infpath = $"Channel/{Data}.json";
File.WriteAllText(infpath, JsonConvert.SerializeObject(c2));
try
{
Functions.Downloader.DL.ytc.Channels.GetUploadsAsync(c.Id).ForEachAsync(async (v) =>
{
string infPath = Functions.Downloader.DL.GetPath(true, "Info", v.Id + ".json");
string infPath = $"Info/{v.Id}.json";
bool exist = File.Exists(infPath);
if (exist)

View File

@ -108,6 +108,10 @@
<Reference Include="Hyperlinq">
<HintPath>..\packages\Hyperlinq.1.0.7\lib\net40-client\Hyperlinq.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression.ZipFile">
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyClass.cs" />

Binary file not shown.

View File

@ -1 +1 @@
4109925d72e51f8e54758eee44e6f087ed4fc279
26643813a9972b2be5fd1ee18aabc6455f9a285b

View File

@ -392,3 +392,135 @@
/home/mike/tytd-server/TYTD.Api/obj/Release/TYTD.Api.csproj.CopyComplete
/home/mike/tytd-server/TYTD.Api/obj/Release/TYTD.Api.dll
/home/mike/tytd-server/TYTD.Api/bin/Release/Hyperlinq.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/TYTD.Api.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.InteropServices.RuntimeInformation.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Cryptography.Algorithms.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ValueTuple.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Microsoft.Win32.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/netstandard.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.AppContext.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Collections.Concurrent.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Collections.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Collections.NonGeneric.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Collections.Specialized.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ComponentModel.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ComponentModel.EventBasedAsync.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ComponentModel.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ComponentModel.TypeConverter.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Console.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Data.Common.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.Contracts.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.Debug.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.FileVersionInfo.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.Process.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.StackTrace.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.TextWriterTraceListener.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.Tools.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.TraceSource.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Diagnostics.Tracing.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Drawing.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Dynamic.Runtime.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Globalization.Calendars.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Globalization.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Globalization.Extensions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.Compression.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.Compression.ZipFile.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.FileSystem.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.FileSystem.DriveInfo.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.FileSystem.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.FileSystem.Watcher.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.IsolatedStorage.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.MemoryMappedFiles.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.Pipes.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.IO.UnmanagedMemoryStream.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Linq.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Linq.Expressions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Linq.Parallel.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Linq.Queryable.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Http.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.NameResolution.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.NetworkInformation.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Ping.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Requests.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Security.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.Sockets.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.WebHeaderCollection.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.WebSockets.Client.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Net.WebSockets.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.ObjectModel.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Reflection.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Reflection.Extensions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Reflection.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Resources.Reader.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Resources.ResourceManager.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Resources.Writer.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.CompilerServices.VisualC.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Extensions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Handles.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.InteropServices.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Numerics.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Serialization.Formatters.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Serialization.Json.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Serialization.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.Serialization.Xml.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Claims.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Cryptography.Csp.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Cryptography.Encoding.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Cryptography.Primitives.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Cryptography.X509Certificates.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.Principal.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Security.SecureString.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encoding.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encoding.Extensions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.RegularExpressions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Overlapped.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Tasks.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Tasks.Parallel.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Thread.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.ThreadPool.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Timer.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.ReaderWriter.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.XDocument.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.XmlDocument.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.XmlSerializer.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.XPath.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Xml.XPath.XDocument.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/AngleSharp.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/AsyncEnumerable.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/CookiesTxtParser.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Hyperlinq.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Microsoft.Bcl.AsyncInterfaces.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/MimeTypesMap.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Newtonsoft.Json.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/SimpleHTTP.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Buffers.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Memory.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Numerics.Vectors.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.CompilerServices.Unsafe.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encoding.CodePages.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encodings.Web.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Json.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Tasks.Extensions.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/YoutubeExplode.dll
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Newtonsoft.Json.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Buffers.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Numerics.Vectors.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Runtime.CompilerServices.Unsafe.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Memory.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encoding.CodePages.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/AngleSharp.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Encodings.Web.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Threading.Tasks.Extensions.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/Microsoft.Bcl.AsyncInterfaces.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/System.Text.Json.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/YoutubeExplode.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/AsyncEnumerable.xml
/home/ddlovato/git/tytd-server/TYTD.Api/bin/Release/SimpleHTTP.xml
/home/ddlovato/git/tytd-server/TYTD.Api/obj/Release/TYTD.Api.csproj.CoreCompileInputs.cache
/home/ddlovato/git/tytd-server/TYTD.Api/obj/Release/TYTD.Api.csproj.CopyComplete
/home/ddlovato/git/tytd-server/TYTD.Api/obj/Release/TYTD.Api.dll
/home/ddlovato/git/tytd-server/TYTD.Api/obj/Release/TYTD.Api.csprojAssemblyReference.cache

Binary file not shown.

View File

@ -10,6 +10,7 @@
<package id="Simple-HTTP" version="1.0.6" targetFramework="net47" />
<package id="System.Buffers" version="4.5.1" targetFramework="net47" />
<package id="System.IO" version="4.3.0" targetFramework="net47" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net47" />
<package id="System.Memory" version="4.5.4" targetFramework="net47" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net47" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net47" />

Binary file not shown.

@ -1 +0,0 @@
Subproject commit 040bc5e152eab9bd52da34b97d1a614d971dff61

Binary file not shown.

7
create-tar-binary.sh Executable file
View File

@ -0,0 +1,7 @@
export version=$( cat version.txt )
export path="/run/user/1000/gvfs/sftp:host=192.168.0.147,user=root/var/www/downloads_page/apps/tytd/binaries"
cd bin/Release/
tar -cvzf "$path"/tytd-binary-$version.tar.gz .
cp "$path"/tytd-binary-$version.tar.gz "$path"/tytd-binary-latest.tar.gz
cd ../..

File diff suppressed because one or more lines are too long

View File

@ -1,315 +0,0 @@
{
"protocol_version" : "0.0.6",
"configuration" : {
"version" : "(6.12.0.122) (tarball)",
"tlc" : "__thread",
"sigsgev" : "altstack",
"notifications" : "epoll",
"architecture" : "amd64",
"disabled_features" : "none",
"smallconfig" : "disabled",
"bigarrays" : "disabled",
"softdebug" : "enabled",
"interpreter" : "enabled",
"llvm_support" : "610",
"suspend" : "hybrid"
},
"memory" : {
"minor_gc_time" : "11806297971",
"major_gc_time" : "48644374",
"minor_gc_count" : "149297",
"major_gc_count" : "58",
"major_gc_time_concurrent" : "154359880"
},
"threads" : [
{
"is_managed" : true,
"offset_free_hash" : "0x12ecaa89f",
"offset_rich_hash" : "0x12ecaa921",
"crashed" : true,
"native_thread_id" : "0x7f6018793700",
"thread_info_addr" : "0x7f6014000b60",
"thread_name" : "Finalizer",
"ctx" : {
"IP" : "0x7f601afb9a61",
"SP" : "0x7f60187922b0",
"BP" : "0x7f6018792820"
},
"managed_frames" : [
{
"is_managed" : "false",
"native_address" : "unregistered"
}
,
{
"is_managed" : "true",
"guid" : "ED39F21B-9E93-43DC-BD44-2A17AD356A9F",
"token" : "0x00000",
"native_offset" : "0x0",
"filename" : "glib-sharp.dll",
"sizeofimage" : "0x1e000",
"timestamp" : "0x0",
"il_offset" : "0x0000b"
}
,
{
"is_managed" : "true",
"guid" : "ED39F21B-9E93-43DC-BD44-2A17AD356A9F",
"token" : "0x6000142",
"native_offset" : "0x0",
"filename" : "glib-sharp.dll",
"sizeofimage" : "0x1e000",
"timestamp" : "0x0",
"il_offset" : "0x00014"
}
,
{
"is_managed" : "true",
"guid" : "7AAB76E8-7BCE-48A4-B45C-F7FA613CB70C",
"token" : "0x60041bd",
"native_offset" : "0x0",
"filename" : "gtk-sharp.dll",
"sizeofimage" : "0x164000",
"timestamp" : "0x0",
"il_offset" : "0x00030"
}
,
{
"is_managed" : "true",
"guid" : "7AAB76E8-7BCE-48A4-B45C-F7FA613CB70C",
"token" : "0x60008e2",
"native_offset" : "0x0",
"filename" : "gtk-sharp.dll",
"sizeofimage" : "0x164000",
"timestamp" : "0x0",
"il_offset" : "0x00000"
}
,
{
"is_managed" : "true",
"guid" : "609E8E7D-556D-4B16-BD60-BCA491697A49",
"token" : "0x6000300",
"native_offset" : "0x0",
"filename" : "Xwt.Gtk.dll",
"sizeofimage" : "0x54000",
"timestamp" : "0x5d30afe3",
"il_offset" : "0x00007"
}
,
{
"is_managed" : "true",
"guid" : "609E8E7D-556D-4B16-BD60-BCA491697A49",
"token" : "0x6000088",
"native_offset" : "0x0",
"filename" : "Xwt.Gtk.dll",
"sizeofimage" : "0x54000",
"timestamp" : "0x5d30afe3",
"il_offset" : "0x00002"
}
,
{
"is_managed" : "true",
"guid" : "533173D2-4DAE-4608-99D2-B10975534BB0",
"token" : "0x00000",
"native_offset" : "0x0",
"filename" : "mscorlib.dll",
"sizeofimage" : "0x472000",
"timestamp" : "0x99dbfea7",
"il_offset" : "0x0002a"
}
],
"unmanaged_frames" : [
{
"is_managed" : "false",
"native_address" : "0x55db49a534c9",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c39319",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c3a655",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c4382c",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49aa92a7",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49aa94b9",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49a557af",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49aa2b13",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601afb9a61",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601afced4a",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f6012aa10f3",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f6012a78301",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f6012a5f3ae",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "true",
"guid" : "ED39F21B-9E93-43DC-BD44-2A17AD356A9F",
"token" : "0x00000",
"native_offset" : "0x0",
"filename" : "glib-sharp.dll",
"sizeofimage" : "0x1e000",
"timestamp" : "0x0",
"il_offset" : "0x00000"
}
]
},
{
"is_managed" : false,
"offset_free_hash" : "0x0",
"offset_rich_hash" : "0x0",
"crashed" : false,
"native_thread_id" : "0x7f601af3efc0",
"thread_info_addr" : "0x55db4b39f280",
"thread_name" : "GUI Thread",
"ctx" : {
"IP" : "0x7f601b493618",
"SP" : "0x7ffe8121c8c0",
"BP" : "0x55db5296bb00"
},
"unmanaged_frames" : [
{
"is_managed" : "false",
"native_address" : "0x55db49a534c9",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c39319",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c3a655",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c436c7",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49aa85b5",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601b4953c0",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601b493618",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601b493743",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49c8529c",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49a226ff",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49a29f88",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49a18f1c",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x7f601af670b3",
"native_offset" : "0x00000"
}
,
{
"is_managed" : "false",
"native_address" : "0x55db49a1953a",
"native_offset" : "0x00000"
}
]
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
8f38b4bfd3e4101cea207f521c4ab951a53995e7
e3eba772fa8089a24bf256884284d266adbd5661

View File

@ -707,3 +707,139 @@
/home/mike/tytd-server/bin/Release/System.Text.Encoding.CodePages.xml
/home/mike/tytd-server/bin/Release/PlaylistsNET.dll
/home/mike/tytd-server/bin/Release/Hyperlinq.dll
/home/ddlovato/git/tytd-server/bin/Release/youtube-downloader.exe
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.InteropServices.RuntimeInformation.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Cryptography.Algorithms.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ValueTuple.dll
/home/ddlovato/git/tytd-server/bin/Release/Microsoft.Win32.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/netstandard.dll
/home/ddlovato/git/tytd-server/bin/Release/System.AppContext.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Collections.Concurrent.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Collections.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Collections.NonGeneric.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Collections.Specialized.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ComponentModel.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ComponentModel.EventBasedAsync.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ComponentModel.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ComponentModel.TypeConverter.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Console.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Data.Common.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.Contracts.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.Debug.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.FileVersionInfo.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.Process.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.StackTrace.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.TextWriterTraceListener.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.Tools.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.TraceSource.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Diagnostics.Tracing.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Drawing.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Dynamic.Runtime.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Globalization.Calendars.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Globalization.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Globalization.Extensions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.Compression.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.Compression.ZipFile.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.FileSystem.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.FileSystem.DriveInfo.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.FileSystem.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.FileSystem.Watcher.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.IsolatedStorage.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.MemoryMappedFiles.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.Pipes.dll
/home/ddlovato/git/tytd-server/bin/Release/System.IO.UnmanagedMemoryStream.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Linq.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Linq.Expressions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Linq.Parallel.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Linq.Queryable.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Http.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.NameResolution.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.NetworkInformation.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Ping.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Requests.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Security.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.Sockets.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.WebHeaderCollection.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.WebSockets.Client.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Net.WebSockets.dll
/home/ddlovato/git/tytd-server/bin/Release/System.ObjectModel.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Reflection.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Reflection.Extensions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Reflection.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Resources.Reader.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Resources.ResourceManager.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Resources.Writer.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.CompilerServices.VisualC.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Extensions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Handles.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.InteropServices.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Numerics.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Serialization.Formatters.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Serialization.Json.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Serialization.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.Serialization.Xml.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Claims.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Cryptography.Csp.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Cryptography.Encoding.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Cryptography.Primitives.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Cryptography.X509Certificates.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.Principal.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Security.SecureString.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encoding.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encoding.Extensions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.RegularExpressions.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Overlapped.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Tasks.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Tasks.Parallel.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Thread.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.ThreadPool.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Timer.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.ReaderWriter.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.XDocument.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.XmlDocument.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.XmlSerializer.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.XPath.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Xml.XPath.XDocument.dll
/home/ddlovato/git/tytd-server/bin/Release/AngleSharp.dll
/home/ddlovato/git/tytd-server/bin/Release/AsyncEnumerable.dll
/home/ddlovato/git/tytd-server/bin/Release/CookiesTxtParser.dll
/home/ddlovato/git/tytd-server/bin/Release/Hyperlinq.dll
/home/ddlovato/git/tytd-server/bin/Release/Microsoft.Bcl.AsyncInterfaces.dll
/home/ddlovato/git/tytd-server/bin/Release/MimeTypesMap.dll
/home/ddlovato/git/tytd-server/bin/Release/Newtonsoft.Json.dll
/home/ddlovato/git/tytd-server/bin/Release/PlaylistsNET.dll
/home/ddlovato/git/tytd-server/bin/Release/SimpleBase.dll
/home/ddlovato/git/tytd-server/bin/Release/SimpleHTTP.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Buffers.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Memory.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Numerics.Vectors.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.CompilerServices.Unsafe.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encoding.CodePages.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encodings.Web.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Json.dll
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Tasks.Extensions.dll
/home/ddlovato/git/tytd-server/bin/Release/TYTD.Api.dll
/home/ddlovato/git/tytd-server/bin/Release/YoutubeExplode.dll
/home/ddlovato/git/tytd-server/bin/Release/Newtonsoft.Json.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Buffers.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Numerics.Vectors.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Runtime.CompilerServices.Unsafe.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Memory.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encoding.CodePages.xml
/home/ddlovato/git/tytd-server/bin/Release/AngleSharp.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Encodings.Web.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Threading.Tasks.Extensions.xml
/home/ddlovato/git/tytd-server/bin/Release/Microsoft.Bcl.AsyncInterfaces.xml
/home/ddlovato/git/tytd-server/bin/Release/System.Text.Json.xml
/home/ddlovato/git/tytd-server/bin/Release/YoutubeExplode.xml
/home/ddlovato/git/tytd-server/bin/Release/SimpleHTTP.xml
/home/ddlovato/git/tytd-server/bin/Release/AsyncEnumerable.xml
/home/ddlovato/git/tytd-server/bin/Release/SimpleBase.pdb
/home/ddlovato/git/tytd-server/obj/x86/Release/youtube-downloader.csprojAssemblyReference.cache
/home/ddlovato/git/tytd-server/obj/x86/Release/youtube-downloader.csproj.CoreCompileInputs.cache
/home/ddlovato/git/tytd-server/obj/x86/Release/youtube-downloader.csproj.CopyComplete
/home/ddlovato/git/tytd-server/obj/x86/Release/youtube-downloader.exe

View File

@ -13,6 +13,7 @@
<package id="Simple-HTTP" version="1.0.6" targetFramework="net47" />
<package id="System.Buffers" version="4.5.1" targetFramework="net47" />
<package id="System.IO" version="4.3.0" targetFramework="net47" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net47" />
<package id="System.Memory" version="4.5.4" targetFramework="net47" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net47" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net47" />

1
version.txt Normal file
View File

@ -0,0 +1 @@
2.0.0

View File

@ -118,10 +118,15 @@
<Reference Include="Hyperlinq">
<HintPath>packages\Hyperlinq.1.0.7\lib\net40-client\Hyperlinq.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression.ZipFile">
<HintPath>packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Broadcast.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />