The Free Software Media System - Server Backend & API
live tv updates
Luke Pulverentie1e5d3543450
diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.csindex 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<TimerInfoDto>+ public class GetDefaultTimer : IReturn<SeriesTimerInfoDto>{+ [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.LiveTvpublic 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.csindex 10dfc08430..8e711d28c9 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.csindex b88cadf238..2cd768a937 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.csindex 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./// </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.csindex b92ec4a430..6801cd7f9e 100644--- a/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs+++ b/MediaBrowser.Controller/LiveTv/SeriesTimerInfo.cs@@ -78,28 +78,28 @@ namespace MediaBrowser.Controller.LiveTvpublic 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.csindex d5928959b7..499b217b5e 100644--- a/MediaBrowser.Controller/LiveTv/TimerInfo.cs+++ b/MediaBrowser.Controller/LiveTv/TimerInfo.cs@@ -59,29 +59,29 @@ namespace MediaBrowser.Controller.LiveTvpublic 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.csindex 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/// </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 instanceInstance = 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");}}+ /// <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>@@ -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;}diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex 14231f3add..62688cdc4c 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -234,6 +234,10 @@ namespace MediaBrowser.Model.Configuration/// <value>The encoding quality.</value>public EncodingQuality EncodingQuality { get; set; }+ public bool EnableMovieChapterImageExtraction { get; set; }+ public bool EnableEpisodeChapterImageExtraction { get; set; }+ public bool EnableOtherVideoChapterImageExtraction { get; set; }+/// <summary>/// Initializes a new instance of the <see cref="ServerConfiguration" /> class./// </summary>@@ -247,6 +251,10 @@ namespace MediaBrowser.Model.ConfigurationEnableDashboardResponseCaching = true;EnableVideoImageExtraction = true;+ EnableMovieChapterImageExtraction = true;+ EnableEpisodeChapterImageExtraction = true;+ EnableOtherVideoChapterImageExtraction = true;+#if (DEBUG)EnableDeveloperTools = true;#endifdiff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.csindex 4febb29619..0c4eb28c56 100644--- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs@@ -114,6 +114,24 @@ namespace MediaBrowser.Model.LiveTv/// <value>The user data.</value>public UserItemDataDto UserData { 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 ProgramInfoDto(){Genres = new List<string>();diff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.csindex fd61b87228..a8c6a2e37a 100644--- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs@@ -107,28 +107,28 @@ namespace MediaBrowser.Model.LiveTvpublic 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 SeriesTimerInfoDto(){diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.csindex f6db58c052..fc7306a627 100644--- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs@@ -86,30 +86,30 @@ namespace MediaBrowser.Model.LiveTv/// </summary>/// <value>The external series timer identifier.</value>public string ExternalSeriesTimerId { 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 duration ms.diff --git a/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs b/MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.csindex 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.csindex 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.csindex 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.LiveTvChannelId = 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.LiveTvName = 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.LiveTvdto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");}+ dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);++ return dto;+ }++ public DayPattern? GetDayPattern(List<DayOfWeek> 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.LiveTvAspectRatio = 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.LiveTvStartDate = 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.LiveTvEndDate = 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.csindex 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.LiveTvreturn results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.CurrentCulture));}- public async Task<TimerInfoDto> GetNewTimerDefaults(CancellationToken cancellationToken)+ public async Task<SeriesTimerInfoDto> 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<SeriesTimerInfoDto> GetNewTimerDefaults(string programId, CancellationToken cancellationToken)+ {+ var info = await GetNewTimerDefaults(cancellationToken).ConfigureAwait(false);++ var program = await GetProgram(programId, cancellationToken).ConfigureAwait(false);++ info.Days = new List<DayOfWeek>+ {+ 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.LiveTvvar 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.LiveTvvar 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.jsindex 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.configindex 12f78c773a..659c5db1e4 100644--- a/MediaBrowser.WebDashboard/packages.config+++ b/MediaBrowser.WebDashboard/packages.config@@ -1,4 +1,4 @@<?xml version="1.0" encoding="utf-8"?><packages>- <package id="MediaBrowser.ApiClient.Javascript" version="3.0.209" targetFramework="net45" />+ <package id="MediaBrowser.ApiClient.Javascript" version="3.0.210" targetFramework="net45" /></packages>\ No newline at end of filediff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspecindex ef156a2bfb..563d08caa4 100644--- a/Nuget/MediaBrowser.Common.Internal.nuspec+++ b/Nuget/MediaBrowser.Common.Internal.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common.Internal</id>- <version>3.0.276</version>+ <version>3.0.278</version><title>MediaBrowser.Common.Internal</title><authors>Luke</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.276" />+ <dependency id="MediaBrowser.Common" version="3.0.278" /><dependency id="NLog" version="2.1.0" /><dependency id="SimpleInjector" version="2.4.0" /><dependency id="sharpcompress" version="0.10.2" />diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex 58ab614258..10889c801b 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.276</version>+ <version>3.0.278</version><title>MediaBrowser.Common</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex b94e775525..96e9241abc 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.276</version>+ <version>3.0.278</version><title>Media Browser.Server.Core</title><authors>Media Browser Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Media Browser Server.</description><copyright>Copyright © Media Browser 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.276" />+ <dependency id="MediaBrowser.Common" version="3.0.278" /></dependencies></metadata><files>