diff --git a/NzbDrone.Api/AutomapperBootstraper.cs b/NzbDrone.Api/AutomapperBootstraper.cs index 100be68d1..230306aaf 100644 --- a/NzbDrone.Api/AutomapperBootstraper.cs +++ b/NzbDrone.Api/AutomapperBootstraper.cs @@ -48,14 +48,14 @@ namespace NzbDrone.Api //Upcoming Mapper.CreateMap() .ForMember(dest => dest.SeriesTitle, opt => opt.MapFrom(src => src.Series.Title)) - .ForMember(dest => dest.EpisodeTitle, opt => opt.MapFrom(src => src.Title)) - .ForMember(dest => dest.AirTime, opt => opt.ResolveUsing()); + .ForMember(dest => dest.EpisodeTitle, opt => opt.MapFrom(src => src.Title)); //Calendar Mapper.CreateMap() .ForMember(dest => dest.SeriesTitle, opt => opt.MapFrom(src => src.Series.Title)) .ForMember(dest => dest.EpisodeTitle, opt => opt.MapFrom(src => src.Title)) - .ForMember(dest => dest.AirTime, opt => opt.ResolveUsing()); + .ForMember(dest => dest.Start, opt => opt.MapFrom(src => src.AirDate)) + .ForMember(dest => dest.End, opt => opt.ResolveUsing()); } } } \ No newline at end of file diff --git a/NzbDrone.Api/Calendar/CalendarModule.cs b/NzbDrone.Api/Calendar/CalendarModule.cs index af45bccf6..649b67f8c 100644 --- a/NzbDrone.Api/Calendar/CalendarModule.cs +++ b/NzbDrone.Api/Calendar/CalendarModule.cs @@ -23,7 +23,9 @@ namespace NzbDrone.Api.Calendar private Response Calendar() { var year = DateTime.Now.Year; - var month = DateTime.Now.Month; + //Todo: This is just for testing + //var month = DateTime.Now.Month; + var month = 1; var yearQuery = Request.Query.Year; var monthQuery = Request.Query.Month; diff --git a/NzbDrone.Api/Calendar/CalendarResource.cs b/NzbDrone.Api/Calendar/CalendarResource.cs index 4500f4f80..787afeae4 100644 --- a/NzbDrone.Api/Calendar/CalendarResource.cs +++ b/NzbDrone.Api/Calendar/CalendarResource.cs @@ -13,7 +13,8 @@ namespace NzbDrone.Api.Calendar public String EpisodeTitle { get; set; } public Int32 SeasonNumber { get; set; } public Int32 EpisodeNumber { get; set; } - public DateTime? AirTime { get; set; } + public DateTime Start { get; set; } + public DateTime End { get; set; } public Int32 Status { get; set; } public String Overview { get; set; } } diff --git a/NzbDrone.Api/NzbDrone.Api.csproj b/NzbDrone.Api/NzbDrone.Api.csproj index cf8d58e6b..10a6bf43b 100644 --- a/NzbDrone.Api/NzbDrone.Api.csproj +++ b/NzbDrone.Api/NzbDrone.Api.csproj @@ -118,7 +118,7 @@ - + diff --git a/NzbDrone.Api/Resolvers/AirTimeResolver.cs b/NzbDrone.Api/Resolvers/AirTimeResolver.cs deleted file mode 100644 index e98a2f06b..000000000 --- a/NzbDrone.Api/Resolvers/AirTimeResolver.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using NzbDrone.Api.QualityProfiles; -using NzbDrone.Core.Repository.Quality; -using NzbDrone.Core.Tv; - -namespace NzbDrone.Api.Resolvers -{ - public class AirTimeResolver : ValueResolver - { - protected override DateTime? ResolveCore(Episode source) - { - if(String.IsNullOrWhiteSpace(source.Series.AirTime) || !source.AirDate.HasValue) - return source.AirDate; - - return source.AirDate.Value.Add(Convert.ToDateTime(source.Series.AirTime).TimeOfDay) - .AddHours(source.Series.UtcOffset * -1); - } - } -} diff --git a/NzbDrone.Api/Resolvers/EndTimeResolver.cs b/NzbDrone.Api/Resolvers/EndTimeResolver.cs new file mode 100644 index 000000000..224f61bab --- /dev/null +++ b/NzbDrone.Api/Resolvers/EndTimeResolver.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using AutoMapper; +using NzbDrone.Api.QualityProfiles; +using NzbDrone.Core.Repository.Quality; +using NzbDrone.Core.Tv; + +namespace NzbDrone.Api.Resolvers +{ + public class EndTimeResolver : ValueResolver + { + protected override DateTime ResolveCore(Episode source) + { + return source.AirDate.Value.AddMinutes(source.Series.Runtime); + } + } +} diff --git a/NzbDrone.Backbone/Calendar/CalendarCollectionTemplate.html b/NzbDrone.Backbone/Calendar/CalendarCollectionTemplate.html index bee12bddf..2eab9aca0 100644 --- a/NzbDrone.Backbone/Calendar/CalendarCollectionTemplate.html +++ b/NzbDrone.Backbone/Calendar/CalendarCollectionTemplate.html @@ -1 +1,3 @@ -
\ No newline at end of file +
+
+
\ No newline at end of file diff --git a/NzbDrone.Backbone/Calendar/CalendarCollectionView.js b/NzbDrone.Backbone/Calendar/CalendarCollectionView.js index 2657d863a..431b28f19 100644 --- a/NzbDrone.Backbone/Calendar/CalendarCollectionView.js +++ b/NzbDrone.Backbone/Calendar/CalendarCollectionView.js @@ -3,33 +3,34 @@ define(['app', 'Calendar/CalendarItemView'], function (app) { NzbDrone.Calendar.CalendarCollectionView = Backbone.Marionette.CompositeView.extend({ itemView: NzbDrone.Calendar.CalendarItemView, + itemViewContainer: '#fakeContainer', template: 'Calendar/CalendarCollectionTemplate', - itemViewContainer: 'table', ui: { calendar: '#calendar' }, - initialize: function () { - this.collection = new NzbDrone.Calendar.CalendarCollection(); - this.collection.fetch(); - this.collection.bind('reset', this.addAll); + initialize: function (context, collection) { + this.collection = collection; }, - render: function() { - this.ui.calendar.fullCalendar({ + onRender: function() { + $(this.ui.calendar).fullCalendar({ header: { left: 'prev,next today', center: 'title', - right: 'month,basicWeek,basicDay', + right: 'month,basicWeek', ignoreTimezone: false }, - selectable: true, - selectHelper: true, - editable: true + buttonText: { + prev: '', + next: '' + } }); + + $(this.ui.calendar).fullCalendar('addEventSource', this.collection.toJSON()); }, addAll: function(){ - this.el.fullCalendar('addEventSource', this.collection.toJSON()); + $(this.ui.calendar).fullCalendar('addEventSource', this.collection.toJSON()); } }); }); \ No newline at end of file diff --git a/NzbDrone.Backbone/Calendar/CalendarModel.js b/NzbDrone.Backbone/Calendar/CalendarModel.js index 7b043513d..300c04d77 100644 --- a/NzbDrone.Backbone/Calendar/CalendarModel.js +++ b/NzbDrone.Backbone/Calendar/CalendarModel.js @@ -1,7 +1,12 @@ define(['app'], function (app) { NzbDrone.Calendar.CalendarModel = Backbone.Model.extend({ mutators: { - + title: function () { + return this.get('seriesTitle') + ' - ' + this.get('seasonNumber') + 'x' + this.get('episodeNumber').pad(2); + }, + allDay: function(){ + return false; + } }, defaults: { status: 0 diff --git a/NzbDrone.Backbone/Controller.js b/NzbDrone.Backbone/Controller.js index 3ed2a9641..8f1293e13 100644 --- a/NzbDrone.Backbone/Controller.js +++ b/NzbDrone.Backbone/Controller.js @@ -21,7 +21,9 @@ calendar: function (action, query) { this.setTitle('Calendar'); - NzbDrone.mainRegion.show(new NzbDrone.Calendar.CalendarCollectionView(this, action, query)); + var calendarCollection = new NzbDrone.Calendar.CalendarCollection(); + calendarCollection.fetch(); + NzbDrone.mainRegion.show(new NzbDrone.Calendar.CalendarCollectionView(this, calendarCollection, action, query)); }, notFound: function () { diff --git a/NzbDrone.Backbone/Index.html b/NzbDrone.Backbone/Index.html index 9c5cafbc7..51ba65d29 100644 --- a/NzbDrone.Backbone/Index.html +++ b/NzbDrone.Backbone/Index.html @@ -51,7 +51,6 @@

  • Settings

  • System

  • Donate
  • - @@ -93,6 +92,7 @@ + diff --git a/NzbDrone.Backbone/JsLibraries/fullcalendar.js b/NzbDrone.Backbone/JsLibraries/fullcalendar.js index 99e25e38f..eb72a039e 100644 --- a/NzbDrone.Backbone/JsLibraries/fullcalendar.js +++ b/NzbDrone.Backbone/JsLibraries/fullcalendar.js @@ -253,6 +253,7 @@ function Calendar(element, options, eventSources) { function initialRender() { + element.html(''); tm = options.theme ? 'ui' : 'fc'; element.addClass('fc'); if (options.isRTL) { diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs index fa13af32e..8d7892e51 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_DeleteInvalidEpisodes.cs @@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests var fakeEpisode = Builder.CreateNew() .With(e => e.SeriesId = seriesId) - .With(e => e.TvDbEpisodeId = null) + .With(e => e.TvDbEpisodeId = 0) .Build(); WithRealDb(); diff --git a/NzbDrone.Core/Tv/Episode.cs b/NzbDrone.Core/Tv/Episode.cs index 25402ade7..a2af4491f 100644 --- a/NzbDrone.Core/Tv/Episode.cs +++ b/NzbDrone.Core/Tv/Episode.cs @@ -7,7 +7,7 @@ namespace NzbDrone.Core.Tv { public class Episode : ModelBase { - public int? TvDbEpisodeId { get; set; } + public int TvDbEpisodeId { get; set; } public int SeriesId { get; set; } public int SeasonNumber { get; set; } @@ -26,7 +26,6 @@ namespace NzbDrone.Core.Tv //Todo: This should be UTC public DateTime? GrabDate { get; set; } - public bool HasFile { get { return EpisodeFile != null; } diff --git a/NzbDrone.Core/Tv/EpisodeService.cs b/NzbDrone.Core/Tv/EpisodeService.cs index 7d762dce9..7b470543d 100644 --- a/NzbDrone.Core/Tv/EpisodeService.cs +++ b/NzbDrone.Core/Tv/EpisodeService.cs @@ -235,6 +235,7 @@ namespace NzbDrone.Core.Tv } episodeToUpdate.SeriesId = series.OID; + episodeToUpdate.Series = series; episodeToUpdate.TvDbEpisodeId = episode.Id; episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; episodeToUpdate.SeasonNumber = episode.SeasonNumber; @@ -243,8 +244,14 @@ namespace NzbDrone.Core.Tv episodeToUpdate.Overview = episode.Overview.Truncate(3500); - if (episode.FirstAired.Year > 1900) + if(episode.FirstAired.Year > 1900) + { episodeToUpdate.AirDate = episode.FirstAired.Date; + + if (!String.IsNullOrWhiteSpace(series.AirTime)) + episodeToUpdate.AirDate = episodeToUpdate.AirDate.Value.Add(Convert.ToDateTime(series.AirTime).TimeOfDay) + .AddHours(series.UtcOffset * -1); + } else episodeToUpdate.AirDate = null; @@ -313,7 +320,7 @@ namespace NzbDrone.Core.Tv if (!tvdbEpisodes.Any()) return; - var seriesEpisodeIds = _episodeRepository.GetEpisodes(series.OID).Select(c => c.OID); + var seriesEpisodeIds = _episodeRepository.GetEpisodes(series.OID).Select(c => c.TvDbEpisodeId); var toBeDeleted = seriesEpisodeIds.Except(tvdbEpisodes.Select(e => e.Id)); diff --git a/NzbDrone.Core/Tv/SeasonRepository.cs b/NzbDrone.Core/Tv/SeasonRepository.cs index 89847c18d..65fe5f1af 100644 --- a/NzbDrone.Core/Tv/SeasonRepository.cs +++ b/NzbDrone.Core/Tv/SeasonRepository.cs @@ -33,7 +33,11 @@ namespace NzbDrone.Core.Tv public bool IsIgnored(int seriesId, int seasonNumber) { - return Queryable.Single(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber).Ignored; + var season = Queryable.SingleOrDefault(c => c.OID == seriesId && c.SeasonNumber == seasonNumber); + + if(season == null) return false; + + return season.Ignored; } public List GetSeasonBySeries(int seriesId) diff --git a/NzbDrone.Core/Tv/Series.cs b/NzbDrone.Core/Tv/Series.cs index ed71c7b1b..9acf8cabb 100644 --- a/NzbDrone.Core/Tv/Series.cs +++ b/NzbDrone.Core/Tv/Series.cs @@ -29,9 +29,8 @@ namespace NzbDrone.Core.Tv public string Overview { get; set; } - public DayOfWeek? AirsDayOfWeek { get; set; } + //public DayOfWeek? AirsDayOfWeek { get; set; } - [Column("AirTimes")] public String AirTime { get; set; } public string Language { get; set; } diff --git a/NzbDrone.Core/Tv/SeriesService.cs b/NzbDrone.Core/Tv/SeriesService.cs index 87d5c5b73..bf3157de5 100644 --- a/NzbDrone.Core/Tv/SeriesService.cs +++ b/NzbDrone.Core/Tv/SeriesService.cs @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Tv series.Title = tvDbSeries.SeriesName; series.AirTime = CleanAirsTime(tvDbSeries.AirsTime); - series.AirsDayOfWeek = tvDbSeries.AirsDayOfWeek; + //series.AirsDayOfWeek = tvDbSeries.AirsDayOfWeek; series.Overview = tvDbSeries.Overview; series.Status = tvDbSeries.Status; series.Language = tvDbSeries.Language != null ? tvDbSeries.Language.Abbriviation : string.Empty; diff --git a/NzbDrone.Web/MediaCover/Banners/1.jpg b/NzbDrone.Web/MediaCover/Banners/1.jpg new file mode 100644 index 000000000..05f3b253b Binary files /dev/null and b/NzbDrone.Web/MediaCover/Banners/1.jpg differ diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 444b34b1d..6cb47a29a 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -2,7 +2,6 @@ 1 False true - true UseDynamicAnalysis Disabled Disabled diff --git a/SqlCe/NzbDrone.SqlCe.dll b/SqlCe/NzbDrone.SqlCe.dll index 47c21596a..6147724b4 100644 Binary files a/SqlCe/NzbDrone.SqlCe.dll and b/SqlCe/NzbDrone.SqlCe.dll differ