From e1e5d354345008e8d4ddc2dbbb99a68df4133280 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 18 Dec 2013 00:44:46 -0500 Subject: live tv updates --- MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 10 ++++- MediaBrowser.Controller/LiveTv/ILiveTvService.cs | 9 ++-- MediaBrowser.Controller/LiveTv/ProgramInfo.cs | 18 ++++++++ MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs | 24 +++++------ MediaBrowser.Controller/LiveTv/TimerInfo.cs | 26 +++++------ MediaBrowser.Controller/MediaInfo/FFMpegManager.cs | 50 ++++++++++++++++++---- 6 files changed, 99 insertions(+), 38 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 10dfc0843..8e711d28c 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -36,7 +36,15 @@ namespace MediaBrowser.Controller.LiveTv /// /// The cancellation token. /// Task{TimerInfo}. - Task GetNewTimerDefaults(CancellationToken cancellationToken); + Task GetNewTimerDefaults(CancellationToken cancellationToken); + + /// + /// Gets the new timer defaults. + /// + /// The program identifier. + /// The cancellation token. + /// Task{SeriesTimerInfoDto}. + Task GetNewTimerDefaults(string programId, CancellationToken cancellationToken); /// /// Deletes the recording. diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs index b88cadf23..2cd768a93 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvService.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvService.cs @@ -89,18 +89,19 @@ namespace MediaBrowser.Controller.LiveTv /// /// Gets the recording image asynchronous. /// - /// The channel identifier. + /// The recording identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetRecordingImageAsync(string channelId, CancellationToken cancellationToken); + Task GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken); /// /// Gets the program image asynchronous. /// + /// The program identifier. /// The channel identifier. /// The cancellation token. /// Task{ImageResponseInfo}. - Task GetProgramImageAsync(string channelId, CancellationToken cancellationToken); + Task GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken); /// /// Gets the recordings asynchronous. @@ -121,7 +122,7 @@ namespace MediaBrowser.Controller.LiveTv /// /// The cancellation token. /// Task{TimerInfo}. - Task GetNewTimerDefaultsAsync(CancellationToken cancellationToken); + Task GetNewTimerDefaultsAsync(CancellationToken cancellationToken); /// /// Gets the series timers asynchronous. diff --git a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs index 5cf8fb721..15b55f50e 100644 --- a/MediaBrowser.Controller/LiveTv/ProgramInfo.cs +++ b/MediaBrowser.Controller/LiveTv/ProgramInfo.cs @@ -102,6 +102,24 @@ namespace MediaBrowser.Controller.LiveTv /// Leave it null if the only way to determine is by requesting the image and handling the failure. /// public bool? HasImage { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is movie. + /// + /// true if this instance is movie; otherwise, false. + public bool IsMovie { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is sports. + /// + /// true if this instance is sports; otherwise, false. + public bool IsSports { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is series. + /// + /// true if this instance is series; otherwise, false. + public bool IsSeries { get; set; } public ProgramInfo() { diff --git a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs index b92ec4a43..6801cd7f9 100644 --- a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs @@ -78,28 +78,28 @@ namespace MediaBrowser.Controller.LiveTv public int Priority { get; set; } /// - /// Gets or sets the requested pre padding seconds. + /// Gets or sets the pre padding seconds. /// - /// The requested pre padding seconds. - public int RequestedPrePaddingSeconds { get; set; } + /// The pre padding seconds. + public int PrePaddingSeconds { get; set; } /// - /// Gets or sets the requested post padding seconds. + /// Gets or sets the post padding seconds. /// - /// The requested post padding seconds. - public int RequestedPostPaddingSeconds { get; set; } + /// The post padding seconds. + public int PostPaddingSeconds { get; set; } /// - /// Gets or sets the required pre padding seconds. + /// Gets or sets a value indicating whether this instance is pre padding required. /// - /// The required pre padding seconds. - public int RequiredPrePaddingSeconds { get; set; } + /// true if this instance is pre padding required; otherwise, false. + public bool IsPrePaddingRequired { get; set; } /// - /// Gets or sets the required post padding seconds. + /// Gets or sets a value indicating whether this instance is post padding required. /// - /// The required post padding seconds. - public int RequiredPostPaddingSeconds { get; set; } + /// true if this instance is post padding required; otherwise, false. + public bool IsPostPaddingRequired { get; set; } public SeriesTimerInfo() { diff --git a/MediaBrowser.Controller/LiveTv/TimerInfo.cs b/MediaBrowser.Controller/LiveTv/TimerInfo.cs index d5928959b..499b217b5 100644 --- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs +++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs @@ -59,29 +59,29 @@ namespace MediaBrowser.Controller.LiveTv public RecordingStatus Status { get; set; } /// - /// Gets or sets the requested pre padding seconds. + /// Gets or sets the pre padding seconds. /// - /// The requested pre padding seconds. - public int RequestedPrePaddingSeconds { get; set; } + /// The pre padding seconds. + public int PrePaddingSeconds { get; set; } /// - /// Gets or sets the requested post padding seconds. + /// Gets or sets the post padding seconds. /// - /// The requested post padding seconds. - public int RequestedPostPaddingSeconds { get; set; } + /// The post padding seconds. + public int PostPaddingSeconds { get; set; } /// - /// Gets or sets the required pre padding seconds. + /// Gets or sets a value indicating whether this instance is pre padding required. /// - /// The required pre padding seconds. - public int RequiredPrePaddingSeconds { get; set; } + /// true if this instance is pre padding required; otherwise, false. + public bool IsPrePaddingRequired { get; set; } /// - /// Gets or sets the required post padding seconds. + /// Gets or sets a value indicating whether this instance is post padding required. /// - /// The required post padding seconds. - public int RequiredPostPaddingSeconds { get; set; } - + /// true if this instance is post padding required; otherwise, false. + public bool IsPostPaddingRequired { get; set; } + /// /// Gets or sets the priority. /// diff --git a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs index 380a96387..e4f4e8bbb 100644 --- a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs +++ b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs @@ -1,7 +1,10 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Common.MediaInfo; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; @@ -20,7 +23,7 @@ namespace MediaBrowser.Controller.MediaInfo /// public class FFMpegManager { - private readonly IServerApplicationPaths _appPaths; + private readonly IServerConfigurationManager _config; private readonly IMediaEncoder _encoder; private readonly ILogger _logger; private readonly IItemRepository _itemRepo; @@ -32,18 +35,17 @@ namespace MediaBrowser.Controller.MediaInfo /// /// Initializes a new instance of the class. /// - /// The app paths. /// The encoder. /// The logger. /// The item repo. /// zipClient - public FFMpegManager(IServerApplicationPaths appPaths, IMediaEncoder encoder, ILogger logger, IItemRepository itemRepo, IFileSystem fileSystem) + public FFMpegManager(IMediaEncoder encoder, ILogger logger, IItemRepository itemRepo, IFileSystem fileSystem, IServerConfigurationManager config) { - _appPaths = appPaths; _encoder = encoder; _logger = logger; _itemRepo = itemRepo; _fileSystem = fileSystem; + _config = config; // TODO: Remove this static instance Instance = this; @@ -57,7 +59,7 @@ namespace MediaBrowser.Controller.MediaInfo { get { - return Path.Combine(_appPaths.DataPath, "chapter-images"); + return Path.Combine(_config.ApplicationPaths.DataPath, "chapter-images"); } } @@ -69,10 +71,43 @@ namespace MediaBrowser.Controller.MediaInfo { get { - return Path.Combine(_appPaths.CachePath, "subtitles"); + return Path.Combine(_config.ApplicationPaths.CachePath, "subtitles"); } } + /// + /// Determines whether [is eligible for chapter image extraction] [the specified video]. + /// + /// The video. + /// true if [is eligible for chapter image extraction] [the specified video]; otherwise, false. + private bool IsEligibleForChapterImageExtraction(Video video) + { + if (video is Movie) + { + if (!_config.Configuration.EnableMovieChapterImageExtraction) + { + return false; + } + } + else if (video is Episode) + { + if (!_config.Configuration.EnableEpisodeChapterImageExtraction) + { + return false; + } + } + else + { + if (!_config.Configuration.EnableOtherVideoChapterImageExtraction) + { + return false; + } + } + + // Can't extract images if there are no video streams + return video.DefaultVideoStreamIndex.HasValue; + } + /// /// The first chapter ticks /// @@ -90,8 +125,7 @@ namespace MediaBrowser.Controller.MediaInfo /// public async Task PopulateChapterImages(Video video, List chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken) { - // Can't extract images if there are no video streams - if (!video.DefaultVideoStreamIndex.HasValue) + if (!IsEligibleForChapterImageExtraction(video)) { return true; } -- cgit v1.2.3