diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index e7b348eb7e..80c9313e57 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -75,8 +75,10 @@ namespace MediaBrowser.Api.LiveTv [Route("/LiveTv/Timers/Defaults", "GET")] [Api(Description = "Gets default values for a new timer")] - public class GetDefaultTimer : IReturn + public class GetDefaultTimer : IReturn { + [ApiMember(Name = "ProgramId", Description = "Optional, to attach default values based on a program.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] + public string ProgramId { get; set; } } [Route("/LiveTv/Timers", "GET")] @@ -326,9 +328,18 @@ namespace MediaBrowser.Api.LiveTv public object Get(GetDefaultTimer request) { - var result = _liveTvManager.GetNewTimerDefaults(CancellationToken.None).Result; + if (string.IsNullOrEmpty(request.ProgramId)) + { + var result = _liveTvManager.GetNewTimerDefaults(CancellationToken.None).Result; - return ToOptimizedResult(result); + return ToOptimizedResult(result); + } + else + { + var result = _liveTvManager.GetNewTimerDefaults(request.ProgramId, CancellationToken.None).Result; + + return ToOptimizedResult(result); + } } public object Get(GetProgram request) diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 10dfc08430..8e711d28c9 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 b88cadf238..2cd768a937 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 5cf8fb721d..15b55f50eb 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 b92ec4a430..6801cd7f9e 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 d5928959b7..499b217b5e 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 380a96387e..e4f4e8bbb7 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; } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 14231f3add..62688cdc4c 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -234,6 +234,10 @@ namespace MediaBrowser.Model.Configuration /// The encoding quality. public EncodingQuality EncodingQuality { get; set; } + public bool EnableMovieChapterImageExtraction { get; set; } + public bool EnableEpisodeChapterImageExtraction { get; set; } + public bool EnableOtherVideoChapterImageExtraction { get; set; } + /// /// Initializes a new instance of the class. /// @@ -247,6 +251,10 @@ namespace MediaBrowser.Model.Configuration EnableDashboardResponseCaching = true; EnableVideoImageExtraction = true; + EnableMovieChapterImageExtraction = true; + EnableEpisodeChapterImageExtraction = true; + EnableOtherVideoChapterImageExtraction = true; + #if (DEBUG) EnableDeveloperTools = true; #endif diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs index 4febb29619..0c4eb28c56 100644 --- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs @@ -114,6 +114,24 @@ namespace MediaBrowser.Model.LiveTv /// The user data. public UserItemDataDto UserData { 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 ProgramInfoDto() { Genres = new List(); diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs index fd61b87228..a8c6a2e37a 100644 --- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs @@ -107,28 +107,28 @@ namespace MediaBrowser.Model.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 SeriesTimerInfoDto() { diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index f6db58c052..fc7306a627 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -86,30 +86,30 @@ namespace MediaBrowser.Model.LiveTv /// /// The external series timer identifier. public string ExternalSeriesTimerId { get; set; } - - /// - /// Gets or sets the requested pre padding seconds. - /// - /// The requested pre padding seconds. - public int RequestedPrePaddingSeconds { get; set; } /// - /// Gets or sets the requested post padding seconds. + /// Gets or sets the pre padding seconds. /// - /// The requested post padding seconds. - public int RequestedPostPaddingSeconds { get; set; } + /// The pre padding seconds. + public int PrePaddingSeconds { get; set; } /// - /// Gets or sets the required pre padding seconds. + /// Gets or sets the post padding seconds. /// - /// The required pre padding seconds. - public int RequiredPrePaddingSeconds { get; set; } + /// The post padding seconds. + public int PostPaddingSeconds { get; set; } /// - /// Gets or sets the required post padding seconds. + /// Gets or sets a value indicating whether this instance is pre padding required. /// - /// The required post padding seconds. - public int RequiredPostPaddingSeconds { get; set; } + /// true if this instance is pre padding required; otherwise, false. + public bool IsPrePaddingRequired { get; set; } + + /// + /// Gets or sets a value indicating whether this instance is post padding required. + /// + /// true if this instance is post padding required; otherwise, false. + public bool IsPostPaddingRequired { get; set; } /// /// Gets or sets the duration ms. diff --git a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs index c4b4af97ff..47799b8f3c 100644 --- a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs +++ b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs @@ -140,7 +140,6 @@ namespace MediaBrowser.Providers.Music } } - providerInfo.FileStamp = GetComparisonData(songs); SetLastRefreshed(item, DateTime.UtcNow, providerInfo); diff --git a/MediaBrowser.Providers/Music/LastfmHelper.cs b/MediaBrowser.Providers/Music/LastfmHelper.cs index 3301d5584c..df02cee5b9 100644 --- a/MediaBrowser.Providers/Music/LastfmHelper.cs +++ b/MediaBrowser.Providers/Music/LastfmHelper.cs @@ -81,16 +81,20 @@ namespace MediaBrowser.Providers.Music } // Only grab the date here if the album doesn't already have one, since id3 tags are preferred - if (!item.PremiereDate.HasValue) - { - DateTime release; + DateTime release; - if (DateTime.TryParse(data.releasedate, out release)) + if (DateTime.TryParse(data.releasedate, out release)) + { + // Lastfm sends back null as sometimes 1901, other times 0 + if (release.Year > 1901) { - // Lastfm sends back null as sometimes 1901, other times 0 - if (release.Year > 1901) + if (!item.PremiereDate.HasValue) { item.PremiereDate = release; + } + + if (!item.ProductionYear.HasValue) + { item.ProductionYear = release.Year; } } diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs index ea85238879..a58722c322 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -1,6 +1,4 @@ -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; @@ -10,6 +8,9 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Logging; using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.LiveTv { @@ -43,10 +44,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv ChannelId = GetInternalChannelId(service.Name, info.ChannelId, info.ChannelName).ToString("N"), Status = info.Status, SeriesTimerId = string.IsNullOrEmpty(info.SeriesTimerId) ? null : GetInternalSeriesTimerId(service.Name, info.SeriesTimerId).ToString("N"), - RequestedPostPaddingSeconds = info.RequestedPostPaddingSeconds, - RequestedPrePaddingSeconds = info.RequestedPrePaddingSeconds, - RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds, - RequiredPrePaddingSeconds = info.RequiredPrePaddingSeconds, + PrePaddingSeconds = info.PrePaddingSeconds, + PostPaddingSeconds = info.PostPaddingSeconds, + IsPostPaddingRequired = info.IsPostPaddingRequired, + IsPrePaddingRequired = info.IsPrePaddingRequired, ExternalChannelId = info.ChannelId, ExternalSeriesTimerId = info.SeriesTimerId, ServiceName = service.Name, @@ -76,10 +77,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv Name = info.Name, StartDate = info.StartDate, ExternalId = info.Id, - RequestedPostPaddingSeconds = info.RequestedPostPaddingSeconds, - RequestedPrePaddingSeconds = info.RequestedPrePaddingSeconds, - RequiredPostPaddingSeconds = info.RequiredPostPaddingSeconds, - RequiredPrePaddingSeconds = info.RequiredPrePaddingSeconds, + PrePaddingSeconds = info.PrePaddingSeconds, + PostPaddingSeconds = info.PostPaddingSeconds, + IsPostPaddingRequired = info.IsPostPaddingRequired, + IsPrePaddingRequired = info.IsPrePaddingRequired, Days = info.Days, Priority = info.Priority, RecordAnyChannel = info.RecordAnyChannel, @@ -100,33 +101,38 @@ namespace MediaBrowser.Server.Implementations.LiveTv dto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N"); } + dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days); + + return dto; + } + + public DayPattern? GetDayPattern(List days) + { DayPattern? pattern = null; - if (info.Days != null && info.Days.Count > 0) + if (days.Count > 0) { - if (info.Days.Count == 7) + if (days.Count == 7) { pattern = DayPattern.Daily; } - else if (info.Days.Count == 2) + else if (days.Count == 2) { - if (info.Days.Contains(DayOfWeek.Saturday) && info.Days.Contains(DayOfWeek.Sunday)) + if (days.Contains(DayOfWeek.Saturday) && days.Contains(DayOfWeek.Sunday)) { pattern = DayPattern.Weekends; } } - else if (info.Days.Count == 5) + else if (days.Count == 5) { - if (info.Days.Contains(DayOfWeek.Monday) && info.Days.Contains(DayOfWeek.Tuesday) && info.Days.Contains(DayOfWeek.Wednesday) && info.Days.Contains(DayOfWeek.Thursday) && info.Days.Contains(DayOfWeek.Friday)) + if (days.Contains(DayOfWeek.Monday) && days.Contains(DayOfWeek.Tuesday) && days.Contains(DayOfWeek.Wednesday) && days.Contains(DayOfWeek.Thursday) && days.Contains(DayOfWeek.Friday)) { pattern = DayPattern.Weekdays; } } } - dto.DayPattern = pattern; - - return dto; + return pattern; } public RecordingInfoDto GetRecordingInfoDto(RecordingInfo info, ILiveTvService service, User user = null) @@ -228,7 +234,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv AspectRatio = program.AspectRatio, IsRepeat = program.IsRepeat, EpisodeTitle = program.EpisodeTitle, - ChannelName = program.ChannelName + ChannelName = program.ChannelName, + IsMovie = program.IsMovie, + IsSeries = program.IsSeries, + IsSports = program.IsSports }; if (user != null) @@ -306,10 +315,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv StartDate = dto.StartDate, Status = dto.Status, SeriesTimerId = dto.ExternalSeriesTimerId, - RequestedPostPaddingSeconds = dto.RequestedPostPaddingSeconds, - RequestedPrePaddingSeconds = dto.RequestedPrePaddingSeconds, - RequiredPostPaddingSeconds = dto.RequiredPostPaddingSeconds, - RequiredPrePaddingSeconds = dto.RequiredPrePaddingSeconds, + PrePaddingSeconds = dto.PrePaddingSeconds, + PostPaddingSeconds = dto.PostPaddingSeconds, + IsPostPaddingRequired = dto.IsPostPaddingRequired, + IsPrePaddingRequired = dto.IsPrePaddingRequired, Priority = dto.Priority }; @@ -354,10 +363,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv EndDate = dto.EndDate, Name = dto.Name, StartDate = dto.StartDate, - RequestedPostPaddingSeconds = dto.RequestedPostPaddingSeconds, - RequestedPrePaddingSeconds = dto.RequestedPrePaddingSeconds, - RequiredPostPaddingSeconds = dto.RequiredPostPaddingSeconds, - RequiredPrePaddingSeconds = dto.RequiredPrePaddingSeconds, + PrePaddingSeconds = dto.PrePaddingSeconds, + PostPaddingSeconds = dto.PostPaddingSeconds, + IsPostPaddingRequired = dto.IsPostPaddingRequired, + IsPrePaddingRequired = dto.IsPrePaddingRequired, Days = dto.Days, Priority = dto.Priority, RecordAnyChannel = dto.RecordAnyChannel, diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index b9dfc1b48f..06ed4e2009 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -459,11 +459,41 @@ namespace MediaBrowser.Server.Implementations.LiveTv return results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.CurrentCulture)); } - public async Task GetNewTimerDefaults(CancellationToken cancellationToken) + public async Task GetNewTimerDefaults(CancellationToken cancellationToken) { var info = await ActiveService.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); - return _tvDtoService.GetTimerInfoDto(info, ActiveService); + var obj = _tvDtoService.GetSeriesTimerInfoDto(info, ActiveService); + + obj.Id = obj.ExternalId = string.Empty; + + return obj; + } + + public async Task GetNewTimerDefaults(string programId, CancellationToken cancellationToken) + { + var info = await GetNewTimerDefaults(cancellationToken).ConfigureAwait(false); + + var program = await GetProgram(programId, cancellationToken).ConfigureAwait(false); + + info.Days = new List + { + program.StartDate.ToLocalTime().DayOfWeek + }; + + info.DayPattern = _tvDtoService.GetDayPattern(info.Days); + + info.Name = program.Name; + info.ChannelId = program.ChannelId; + info.ChannelName = program.ChannelName; + info.EndDate = program.EndDate; + info.StartDate = program.StartDate; + info.Name = program.Name; + info.Overview = program.Overview; + info.ProgramId = program.Id; + info.ExternalProgramId = program.ExternalId; + + return info; } public async Task CreateTimer(TimerInfoDto timer, CancellationToken cancellationToken) @@ -472,6 +502,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv var info = await _tvDtoService.GetTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false); + // Set priority from default values + var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); + info.Priority = defaultValues.Priority; + await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false); } @@ -481,6 +515,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv var info = await _tvDtoService.GetSeriesTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false); + // Set priority from default values + var defaultValues = await service.GetNewTimerDefaultsAsync(cancellationToken).ConfigureAwait(false); + info.Priority = defaultValues.Priority; + await service.CreateSeriesTimerAsync(info, cancellationToken).ConfigureAwait(false); } diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index a42c27949e..e260a0a050 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -545,9 +545,11 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; - self.getNewLiveTvTimerDefaults = function () { + self.getNewLiveTvTimerDefaults = function (options) { - var url = self.getUrl("LiveTv/Timers/Defaults"); + options = options || {}; + + var url = self.getUrl("LiveTv/Timers/Defaults", options); return self.ajax({ type: "GET", diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index 12f78c773a..659c5db1e4 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index ef156a2bfb..563d08caa4 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.276 + 3.0.278 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 58ab614258..10889c801b 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.276 + 3.0.278 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index b94e775525..96e9241abc 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.276 + 3.0.278 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - +