aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-18 00:44:46 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-18 00:44:46 -0500
commite1e5d354345008e8d4ddc2dbbb99a68df4133280 (patch)
tree3d7fff49a735cda9062e64f374dc7bf4e1df8108 /MediaBrowser.Controller
parent0b53ab76ebb26e2f93cdce4bb68dcdb4cf67d08d (diff)
live tv updates
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvManager.cs10
-rw-r--r--MediaBrowser.Controller/LiveTv/ILiveTvService.cs9
-rw-r--r--MediaBrowser.Controller/LiveTv/ProgramInfo.cs18
-rw-r--r--MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs24
-rw-r--r--MediaBrowser.Controller/LiveTv/TimerInfo.cs26
-rw-r--r--MediaBrowser.Controller/MediaInfo/FFMpegManager.cs50
6 files changed, 99 insertions, 38 deletions
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
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{TimerInfo}.</returns>
- Task<TimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken);
+ Task<SeriesTimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the new timer defaults.
+ /// </summary>
+ /// <param name="programId">The program identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task{SeriesTimerInfoDto}.</returns>
+ Task<SeriesTimerInfoDto> GetNewTimerDefaults(string programId, CancellationToken cancellationToken);
/// <summary>
/// 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
/// <summary>
/// Gets the recording image asynchronous.
/// </summary>
- /// <param name="channelId">The channel identifier.</param>
+ /// <param name="recordingId">The recording identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
- Task<ImageResponseInfo> GetRecordingImageAsync(string channelId, CancellationToken cancellationToken);
+ Task<ImageResponseInfo> GetRecordingImageAsync(string recordingId, CancellationToken cancellationToken);
/// <summary>
/// Gets the program image asynchronous.
/// </summary>
+ /// <param name="programId">The program identifier.</param>
/// <param name="channelId">The channel identifier.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{ImageResponseInfo}.</returns>
- Task<ImageResponseInfo> GetProgramImageAsync(string channelId, CancellationToken cancellationToken);
+ Task<ImageResponseInfo> GetProgramImageAsync(string programId, string channelId, CancellationToken cancellationToken);
/// <summary>
/// Gets the recordings asynchronous.
@@ -121,7 +122,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{TimerInfo}.</returns>
- Task<TimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken);
+ Task<SeriesTimerInfo> GetNewTimerDefaultsAsync(CancellationToken cancellationToken);
/// <summary>
/// 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.
/// </summary>
public bool? HasImage { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is movie.
+ /// </summary>
+ /// <value><c>true</c> if this instance is movie; otherwise, <c>false</c>.</value>
+ public bool IsMovie { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is sports.
+ /// </summary>
+ /// <value><c>true</c> if this instance is sports; otherwise, <c>false</c>.</value>
+ public bool IsSports { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is series.
+ /// </summary>
+ /// <value><c>true</c> if this instance is series; otherwise, <c>false</c>.</value>
+ 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; }
/// <summary>
- /// Gets or sets the requested pre padding seconds.
+ /// Gets or sets the pre padding seconds.
/// </summary>
- /// <value>The requested pre padding seconds.</value>
- public int RequestedPrePaddingSeconds { get; set; }
+ /// <value>The pre padding seconds.</value>
+ public int PrePaddingSeconds { get; set; }
/// <summary>
- /// Gets or sets the requested post padding seconds.
+ /// Gets or sets the post padding seconds.
/// </summary>
- /// <value>The requested post padding seconds.</value>
- public int RequestedPostPaddingSeconds { get; set; }
+ /// <value>The post padding seconds.</value>
+ public int PostPaddingSeconds { get; set; }
/// <summary>
- /// Gets or sets the required pre padding seconds.
+ /// Gets or sets a value indicating whether this instance is pre padding required.
/// </summary>
- /// <value>The required pre padding seconds.</value>
- public int RequiredPrePaddingSeconds { get; set; }
+ /// <value><c>true</c> if this instance is pre padding required; otherwise, <c>false</c>.</value>
+ public bool IsPrePaddingRequired { get; set; }
/// <summary>
- /// Gets or sets the required post padding seconds.
+ /// Gets or sets a value indicating whether this instance is post padding required.
/// </summary>
- /// <value>The required post padding seconds.</value>
- public int RequiredPostPaddingSeconds { get; set; }
+ /// <value><c>true</c> if this instance is post padding required; otherwise, <c>false</c>.</value>
+ 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; }
/// <summary>
- /// Gets or sets the requested pre padding seconds.
+ /// Gets or sets the pre padding seconds.
/// </summary>
- /// <value>The requested pre padding seconds.</value>
- public int RequestedPrePaddingSeconds { get; set; }
+ /// <value>The pre padding seconds.</value>
+ public int PrePaddingSeconds { get; set; }
/// <summary>
- /// Gets or sets the requested post padding seconds.
+ /// Gets or sets the post padding seconds.
/// </summary>
- /// <value>The requested post padding seconds.</value>
- public int RequestedPostPaddingSeconds { get; set; }
+ /// <value>The post padding seconds.</value>
+ public int PostPaddingSeconds { get; set; }
/// <summary>
- /// Gets or sets the required pre padding seconds.
+ /// Gets or sets a value indicating whether this instance is pre padding required.
/// </summary>
- /// <value>The required pre padding seconds.</value>
- public int RequiredPrePaddingSeconds { get; set; }
+ /// <value><c>true</c> if this instance is pre padding required; otherwise, <c>false</c>.</value>
+ public bool IsPrePaddingRequired { get; set; }
/// <summary>
- /// Gets or sets the required post padding seconds.
+ /// Gets or sets a value indicating whether this instance is post padding required.
/// </summary>
- /// <value>The required post padding seconds.</value>
- public int RequiredPostPaddingSeconds { get; set; }
-
+ /// <value><c>true</c> if this instance is post padding required; otherwise, <c>false</c>.</value>
+ public bool IsPostPaddingRequired { get; set; }
+
/// <summary>
/// Gets or sets the priority.
/// </summary>
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
/// </summary>
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
/// <summary>
/// Initializes a new instance of the <see cref="FFMpegManager" /> class.
/// </summary>
- /// <param name="appPaths">The app paths.</param>
/// <param name="encoder">The encoder.</param>
/// <param name="logger">The logger.</param>
/// <param name="itemRepo">The item repo.</param>
/// <exception cref="System.ArgumentNullException">zipClient</exception>
- 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,11 +71,44 @@ namespace MediaBrowser.Controller.MediaInfo
{
get
{
- return Path.Combine(_appPaths.CachePath, "subtitles");
+ return Path.Combine(_config.ApplicationPaths.CachePath, "subtitles");
}
}
/// <summary>
+ /// Determines whether [is eligible for chapter image extraction] [the specified video].
+ /// </summary>
+ /// <param name="video">The video.</param>
+ /// <returns><c>true</c> if [is eligible for chapter image extraction] [the specified video]; otherwise, <c>false</c>.</returns>
+ 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;
+ }
+
+ /// <summary>
/// The first chapter ticks
/// </summary>
private static readonly long FirstChapterTicks = TimeSpan.FromSeconds(15).Ticks;
@@ -90,8 +125,7 @@ namespace MediaBrowser.Controller.MediaInfo
/// <exception cref="System.ArgumentNullException"></exception>
public async Task<bool> PopulateChapterImages(Video video, List<ChapterInfo> 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;
}