mirror of
https://github.com/fergalmoran/podnoms.git
synced 2026-02-07 08:15:02 +00:00
31 lines
990 B
C#
31 lines
990 B
C#
using System.Threading.Tasks;
|
|
using NYoutubeDL;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using PodNoms.Api.Services.Jobs;
|
|
using PodNoms.Api.Services;
|
|
|
|
namespace PodNoms.Api.Services.Jobs {
|
|
public class UpdateYouTubeDlJob : IJob {
|
|
private readonly IMailSender _sender;
|
|
private readonly ILogger _logger;
|
|
|
|
public UpdateYouTubeDlJob(IMailSender sender, ILogger<UpdateYouTubeDlJob> logger) {
|
|
this._sender = sender;
|
|
this._logger = logger;
|
|
}
|
|
|
|
public async Task<bool> Execute() {
|
|
_logger.LogInformation("Updating YoutubeDL");
|
|
|
|
var yt = new YoutubeDL();
|
|
yt.Options.GeneralOptions.Update = true;
|
|
yt.Download("https://www.youtube.com/watch?v=OJ2wOKDzKyI");
|
|
|
|
var results = await _sender.SendEmailAsync("fergal.moran@gmail.com", "PodNoms: UpdateYouTubeDlJob completed", "As you were");
|
|
_logger.LogInformation($"{results}");
|
|
return true;
|
|
}
|
|
}
|
|
}
|