mirror of
https://github.com/jcreek/YouTubeChannelDownloader.git
synced 2026-07-13 03:03:46 +00:00
feat(*): Add main logic flow
This commit is contained in:
@@ -28,5 +28,24 @@ namespace YouTubeChannelDownloader
|
||||
|
||||
private static async Task Main(string[] args)
|
||||
{
|
||||
// Check every night if there's any new videos on the channel and download them
|
||||
// Could change the interval and channel via a config file or environment variables
|
||||
IReadOnlyList<YouTubeVideo> newVideos = await CheckForNewVideosAsync();
|
||||
|
||||
YoutubeExplode.Channels.Channel channel = await _youtube.Channels.GetAsync(_channelId);
|
||||
|
||||
Console.WriteLine($"There are {newVideos.Count} new videos to download from {channel.Title}");
|
||||
|
||||
foreach (YouTubeVideo video in newVideos)
|
||||
{
|
||||
Console.WriteLine($"Starting {channel.Title} - {video.PlaylistVideo.Title}");
|
||||
string pathString = await DownloadVideoAsync(video, channel.Title);
|
||||
await RecordSuccessfulVideoDownload(video, channel.Title);
|
||||
|
||||
// TODO? - set this up with a discard to run in a separate thread so more downloads can happen, need to be careful of error handling and logging
|
||||
TransferFileToNasShare(pathString);
|
||||
DeleteLocalFile(pathString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user