Made /api/Redownload not add Completed videos to queue

This commit is contained in:
Mike Nolan 2022-02-28 09:53:19 -06:00
parent 2155d045ef
commit e6c095b125
6 changed files with 18 additions and 4 deletions

View File

@ -7,7 +7,7 @@
<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="280" Column="42" /> <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="122" Column="350" /> <File FileName="Program.cs" Line="122" Column="88" />
<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

@ -264,18 +264,32 @@ namespace TYTD
foreach (var item in Directory.GetFiles(Downloader.DL.GetPath(true, "Info"), "*.json")) foreach (var item in Directory.GetFiles(Downloader.DL.GetPath(true, "Info"), "*.json"))
{ {
string id =Path.GetFileNameWithoutExtension(item); string id =Path.GetFileNameWithoutExtension(item);
if(!File.Exists(Path.Combine("NotConverted",$"{id}.mp4")))
{
Downloader.DownloadVideo(id, Resolution.NoConvert); Downloader.DownloadVideo(id, Resolution.NoConvert);
} }
}
rq.RedirectIt(rp); rq.RedirectIt(rp);
} }
public static void RedownloadRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args) public static void RedownloadRes(HttpListenerRequest rq, HttpListenerResponse rp, Dictionary<string, string> args)
{ {
int res=int.Parse(args["R"]);
if(res > 2)
{
rq.RedirectIt(rp);
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(Downloader.DL.GetPath(true, "Info"), "*.json"))
{ {
string id = System.IO.Path.GetFileNameWithoutExtension(item); string id = Path.GetFileNameWithoutExtension(item);
Downloader.DownloadVideo(id, (Resolution)int.Parse(args["R"])); if (!File.Exists(Path.Combine(res_str, $"{id}.mp4")))
{
Downloader.DownloadVideo(id, (Resolution)res);
}
} }
rq.RedirectIt(rp); rq.RedirectIt(rp);

Binary file not shown.