mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
moved jobs around again ;)
This commit is contained in:
parent
50674d388c
commit
568d4b8eeb
29 changed files with 70 additions and 121 deletions
54
NzbDrone.Core/Jobs/Implementations/ConvertEpisodeJob.cs
Normal file
54
NzbDrone.Core/Jobs/Implementations/ConvertEpisodeJob.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers.Converting;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.Jobs.Implementations
|
||||
{
|
||||
public class ConvertEpisodeJob : IJob
|
||||
{
|
||||
private readonly HandbrakeProvider _handbrakeProvider;
|
||||
private readonly AtomicParsleyProvider _atomicParsleyProvider;
|
||||
private readonly IEpisodeService _episodeService;
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public ConvertEpisodeJob(HandbrakeProvider handbrakeProvider, AtomicParsleyProvider atomicParsleyProvider,
|
||||
IEpisodeService episodeService)
|
||||
{
|
||||
_handbrakeProvider = handbrakeProvider;
|
||||
_atomicParsleyProvider = atomicParsleyProvider;
|
||||
_episodeService = episodeService;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Convert Episode"; }
|
||||
}
|
||||
|
||||
public TimeSpan DefaultInterval
|
||||
{
|
||||
get { return TimeSpan.FromTicks(0); }
|
||||
}
|
||||
|
||||
public void Start(ProgressNotification notification, dynamic options)
|
||||
{
|
||||
|
||||
if (options == null || options.EpisodeId <= 0)
|
||||
throw new ArgumentNullException(options);
|
||||
|
||||
Episode episode = _episodeService.GetEpisode((int)options.EpisodeId);
|
||||
notification.CurrentMessage = String.Format("Starting Conversion for {0}", episode);
|
||||
var outputFile = _handbrakeProvider.ConvertFile(episode, notification);
|
||||
|
||||
if (String.IsNullOrEmpty(outputFile))
|
||||
notification.CurrentMessage = String.Format("Conversion failed for {0}", episode);
|
||||
|
||||
_atomicParsleyProvider.RunAtomicParsley(episode, outputFile);
|
||||
|
||||
notification.CurrentMessage = String.Format("Conversion completed for {0}", episode);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue