updating files

This commit is contained in:
Mike Nolan 2022-02-19 02:54:43 -06:00
parent 7f9182879f
commit abd9f31797
11 changed files with 38 additions and 25 deletions

View File

@ -1,13 +1,13 @@
<Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True"> <Properties StartupConfiguration="{E26F8159-6B4B-4660-A7A4-D0333DFEF0DD}|Default" NuGet.AddPackagesDialog.IncludePrerelease="True">
<MonoDevelop.Ide.Workbench ActiveDocument="Program.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="Program.cs">
<Files> <Files>
<File FileName="TYTD.Api/Server/Models/InfoType.cs" Line="143" Column="11" /> <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/Functions/Downloader.cs" Line="18" Column="1" />
<File FileName="TYTD.Api/Server/Models/SavedMedia.cs" Line="1" Column="1" /> <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/SavedVideo.cs" Line="8" Column="1" />
<File FileName="TYTD.Api/Server/Models/InfomationQueueItem.cs" Line="125" Column="50" /> <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="TYTD.Api/Server/Functions/ffmpeg.cs" Line="5" Column="15" />
<File FileName="Program.cs" Line="936" Column="14" /> <File FileName="Program.cs" Line="122" Column="350" />
<File FileName="TYTD.Api/MyClass.cs" Line="80" Column="14" /> <File FileName="TYTD.Api/MyClass.cs" Line="80" Column="14" />
<File FileName="TYTD.Api/Server/Models/SavedChannel.cs" Line="6" Column="10" /> <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/SavedPlaylist.cs" Line="7" Column="1" />

View File

@ -119,7 +119,7 @@ namespace TYTD
Route.Add("/extensions.html", (HttpAction)Extensions); Route.Add("/extensions.html", (HttpAction)Extensions);
Route.Add("/{Path}", (HttpAction)RootPath); Route.Add("/{Path}", (HttpAction)RootPath);
Route.Add("/{Path}",(HttpAction)UploadFilePut,"PUT"); Route.Add("/{Path}",(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()); e.Cancel = false; }; 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); };
Console.WriteLine("Almost Ready To Listen"); Console.WriteLine("Almost Ready To Listen");
@ -164,40 +164,44 @@ namespace TYTD
{ {
Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddItemRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddItemRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"])); Downloader.DownloadItem(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddFile(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments) public static void AddFile(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments)
{ {
Downloader.DownloadFile(arguments["Url"]); Downloader.DownloadFile(arguments["Url"]);
response.AsText("<script>history.back();</script>\n");
} }
public static void AddCaptions(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments) public static void AddCaptions(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments)
{ {
Downloader.DownloadCaptions(arguments["Id"]); Downloader.DownloadCaptions(arguments["Id"]);
response.AsText("<script>history.back();</script>\n");
} }
#endregion #endregion
#region Video #region Video
public static void AddVideoInfo(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddVideoInfo(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadVideoInfo(System.Web.HttpUtility.UrlDecode(args["Id"]), Resolution.NoConvert); Downloader.DownloadVideoInfo(System.Web.HttpUtility.UrlDecode(args["Id"]), Resolution.NoConvert);
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddVideo(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddVideo(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadVideo(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadVideo(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddVideoRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddVideoRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadVideo(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"])); Downloader.DownloadVideo(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void Redownload(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void Redownload(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
@ -206,7 +210,7 @@ namespace TYTD
string id =Path.GetFileNameWithoutExtension(item); string id =Path.GetFileNameWithoutExtension(item);
Downloader.DownloadVideo(id, Resolution.NoConvert); Downloader.DownloadVideo(id, Resolution.NoConvert);
} }
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void RedownloadRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void RedownloadRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
@ -216,7 +220,7 @@ namespace TYTD
string id = System.IO.Path.GetFileNameWithoutExtension(item); string id = System.IO.Path.GetFileNameWithoutExtension(item);
Downloader.DownloadVideo(id, (Resolution)int.Parse(args["R"])); Downloader.DownloadVideo(id, (Resolution)int.Parse(args["R"]));
} }
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void Watch(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void Watch(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
@ -228,18 +232,18 @@ namespace TYTD
public static void AddPlaylistOnly(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddPlaylistOnly(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadPlaylistOnly(System.Web.HttpUtility.UrlDecode(args["Id"]), Resolution.NoConvert); Downloader.DownloadPlaylistOnly(System.Web.HttpUtility.UrlDecode(args["Id"]), Resolution.NoConvert);
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddPlaylist(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddPlaylist(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadPlaylist(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadPlaylist(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddPlaylistRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddPlaylistRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadPlaylist(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"])); Downloader.DownloadPlaylist(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void PersonalPlaylist(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void PersonalPlaylist(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
@ -390,36 +394,36 @@ namespace TYTD
{ {
Downloader.DownloadChannelOnly(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadChannelOnly(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddChannel(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddChannel(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadChannel(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadChannel(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddChannelRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddChannelRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadChannel(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"])); Downloader.DownloadChannel(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
#endregion #endregion
#region User #region User
public static void AddUserOnly(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddUserOnly(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadUserOnly(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadUserOnly(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddUser(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddUser(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadUser(System.Web.HttpUtility.UrlDecode(args["Id"])); Downloader.DownloadUser(System.Web.HttpUtility.UrlDecode(args["Id"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void AddUserRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void AddUserRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.DownloadUser(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"])); Downloader.DownloadUser(System.Web.HttpUtility.UrlDecode(args["Id"]), (Resolution)int.Parse(args["R"]));
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
#endregion #endregion
#region Queue And Progress #region Queue And Progress
@ -431,7 +435,7 @@ namespace TYTD
public static void QueueMove(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void QueueMove(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
Downloader.ModQueue(args["To"], args["From"]); Downloader.ModQueue(args["To"], args["From"]);
rp.AsText("<script>history.back();</script>"); rp.AsText("<script>history.back();</script>\n");
} }
public static void QueueMove2(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments) public static void QueueMove2(HttpListenerRequest request, HttpListenerResponse response, Dictionary<string, string> arguments)
{ {
@ -450,7 +454,7 @@ namespace TYTD
Downloader.RedownloadIt = true; Downloader.RedownloadIt = true;
Downloader.DL.cancelSrc.Item.Cancel(); Downloader.DL.cancelSrc.Item.Cancel();
} }
rp.AsText("<script>history.back();</script>\n");
} }
public static void Cancel(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void Cancel(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
@ -460,7 +464,7 @@ namespace TYTD
Downloader.RedownloadIt = false; Downloader.RedownloadIt = false;
Downloader.DL.cancelSrc.Item.Cancel(); Downloader.DL.cancelSrc.Item.Cancel();
} }
rp.AsText("<script>history.back();</script>\n");
} }
#endregion #endregion
#region Storage #region Storage

View File

@ -99,7 +99,9 @@ namespace TYTD.Server.Models
string langFileName = $"{trackType}_{track.Language.Code}.srt"; string langFileName = $"{trackType}_{track.Language.Code}.srt";
string track2 = Functions.Downloader.DL.GetPath(true, "ClosedCaptions", Data,langFileName); string track2 = Functions.Downloader.DL.GetPath(true, "ClosedCaptions", Data,langFileName);
await Functions.Downloader.DL.ytc.Videos.ClosedCaptions.DownloadAsync(track, track2); await Functions.Downloader.DL.ytc.Videos.ClosedCaptions.DownloadAsync(track, track2);
await Task.Delay(10);
} }
} }
break; break;
case InfoType.Video: case InfoType.Video:
@ -115,6 +117,7 @@ namespace TYTD.Server.Models
foreach(var tn in sv.Video.Thumbnails) foreach(var tn in sv.Video.Thumbnails)
{ {
Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3); Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3);
await Task.Delay(10);
} }
} }
else{ else{
@ -153,6 +156,7 @@ namespace TYTD.Server.Models
foreach (var tn in sv.Video.Thumbnails) foreach (var tn in sv.Video.Thumbnails)
{ {
Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3); Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3);
await Task.Delay(10);
} }
} }
else else
@ -161,7 +165,7 @@ namespace TYTD.Server.Models
{ {
var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(str); var vinfo = await Functions.Downloader.DL.ytc.Videos.GetAsync(str);
await Task.Delay(10);
sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail); sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
}catch(Exception ex) }catch(Exception ex)
{ {
@ -209,6 +213,7 @@ namespace TYTD.Server.Models
foreach (var tn in sv.Video.Thumbnails) foreach (var tn in sv.Video.Thumbnails)
{ {
Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3); Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3);
await Task.Delay(10);
} }
video.Add(sv); video.Add(sv);
} }
@ -271,6 +276,7 @@ namespace TYTD.Server.Models
foreach (var tn in sv.Video.Thumbnails) foreach (var tn in sv.Video.Thumbnails)
{ {
Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3); Functions.Downloader.DL._DownloadThumbnail2(tn.Item1, tn.Item2, sv.Video.Id, tn.Item3);
await Task.Delay(10);
} }
video.Add(sv); video.Add(sv);
} }
@ -283,6 +289,7 @@ namespace TYTD.Server.Models
SavedVideoObject sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail); SavedVideoObject sv = SavedVideo.CreateFrom(res, vinfo, Functions.Downloader.DL._DownloadThumbnail);
video.Add(sv); video.Add(sv);
await Task.Delay(10);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Dasync.Collections; using Dasync.Collections;
@ -26,6 +27,7 @@ namespace TYTD.Server.Models
foreach (var thumb in pl.Thumbnails) foreach (var thumb in pl.Thumbnails)
{ {
downloadThumbnail(thumb.Resolution.Width, thumb.Resolution.Height,id, thumb.Url); downloadThumbnail(thumb.Resolution.Width, thumb.Resolution.Height,id, thumb.Url);
await Task.Delay(10);
} }
try try
{ {
@ -34,7 +36,7 @@ namespace TYTD.Server.Models
addToQueue(v.Id, res); addToQueue(v.Id, res);
pl2.Videos.Add(v.Id); pl2.Videos.Add(v.Id);
Thread.Sleep(10);
}); });
}catch(Exception ex) }catch(Exception ex)
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.