Browse Source

live tv updates

Luke Pulverenti 11 years ago
parent
commit
e1e5d35434

+ 14 - 3
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.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)

+ 9 - 1
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.

+ 5 - 4
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.

+ 18 - 0
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()
         {

+ 12 - 12
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()
         {

+ 13 - 13
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>

+ 42 - 8
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,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;
             }

+ 8 - 0
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.Configuration
             EnableDashboardResponseCaching = true;
             EnableVideoImageExtraction = true;
 
+            EnableMovieChapterImageExtraction = true;
+            EnableEpisodeChapterImageExtraction = true;
+            EnableOtherVideoChapterImageExtraction = true;
+
 #if (DEBUG)
             EnableDeveloperTools = true;
 #endif

+ 18 - 0
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>();

+ 12 - 12
MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs

@@ -107,28 +107,28 @@ namespace MediaBrowser.Model.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 SeriesTimerInfoDto()
         {

+ 13 - 13
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.

+ 0 - 1
MediaBrowser.Providers/Music/AlbumInfoFromSongProvider.cs

@@ -140,7 +140,6 @@ namespace MediaBrowser.Providers.Music
                 }
             }
 
-
             providerInfo.FileStamp = GetComparisonData(songs);
 
             SetLastRefreshed(item, DateTime.UtcNow, providerInfo);

+ 10 - 6
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;
                     }
                 }

+ 38 - 29
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<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.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,

+ 40 - 2
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<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.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);
         }
 

+ 4 - 2
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",

+ 1 - 1
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>

+ 2 - 2
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" />

+ 1 - 1
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>

+ 2 - 2
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>