diff --git a/NzbDrone.Common/IJsonSerializer.cs b/NzbDrone.Common/IJsonSerializer.cs index f43c9dd97..05f64b73a 100644 --- a/NzbDrone.Common/IJsonSerializer.cs +++ b/NzbDrone.Common/IJsonSerializer.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; namespace NzbDrone.Common @@ -20,25 +21,17 @@ namespace NzbDrone.Common public JsonSerializer() { - var setting = new JsonSerializerSettings + _jsonNetSerializer = new Newtonsoft.Json.JsonSerializer() { DateTimeZoneHandling = DateTimeZoneHandling.Utc, - NullValueHandling = NullValueHandling.Ignore, + NullValueHandling = NullValueHandling.Include, Formatting = Formatting.Indented, - DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate - }; - - _jsonNetSerializer = new Newtonsoft.Json.JsonSerializer() - { - DateTimeZoneHandling = setting.DateTimeZoneHandling, - NullValueHandling = setting.NullValueHandling, - Formatting = setting.Formatting, - DefaultValueHandling = setting.DefaultValueHandling, + DefaultValueHandling = DefaultValueHandling.Include, ContractResolver = new CamelCasePropertyNamesContractResolver() }; - } - + _jsonNetSerializer.Converters.Add(new StringEnumConverter { CamelCaseText = true }); + } public T Deserialize(string json) where T : class, new() { diff --git a/NzbDrone.Core/Datastore/Events/ModelEvent.cs b/NzbDrone.Core/Datastore/Events/ModelEvent.cs index 64016bbe8..8e7b9fcb7 100644 --- a/NzbDrone.Core/Datastore/Events/ModelEvent.cs +++ b/NzbDrone.Core/Datastore/Events/ModelEvent.cs @@ -17,9 +17,9 @@ namespace NzbDrone.Core.Datastore.Events public enum RepositoryAction { - Created, - Updated, - Deleted + Created = 1, + Updated = 2, + Deleted = 3 } } diff --git a/UI/AddSeries/New/AddNewSeriesView.js b/UI/AddSeries/New/AddNewSeriesView.js index 343187851..3f263c84e 100644 --- a/UI/AddSeries/New/AddNewSeriesView.js +++ b/UI/AddSeries/New/AddNewSeriesView.js @@ -11,12 +11,22 @@ define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'AddSeries/New/Sear regions: { searchResult: '#search-result' }, - collection: new NzbDrone.Series.SeriesCollection(), initialize: function () { + + this.collection = new NzbDrone.Series.SeriesCollection(); + + this.collection.parse = function (response) { + _.each(response, function (model) { + model.id = null; + }); + + return response; + }; + NzbDrone.AddSeries.New.AddNewSeriesContext = this; - NzbDrone.vent.on(NzbDrone.Events.SeriesAdded, function (options){ + NzbDrone.vent.on(NzbDrone.Events.SeriesAdded, function (options) { if (!options.existing) { NzbDrone.AddSeries.New.AddNewSeriesContext.ui.seriesSearch.val(''); diff --git a/UI/Mixins/backbone.signalr.mixin.js b/UI/Mixins/backbone.signalr.mixin.js index 43886aefa..ef0c0bcde 100644 --- a/UI/Mixins/backbone.signalr.mixin.js +++ b/UI/Mixins/backbone.signalr.mixin.js @@ -1,6 +1,6 @@ "use strict"; -Backbone.Collection.prototype.BindSignalR = function (options) { +_.extend(Backbone.Collection.prototype, {BindSignalR: function (options) { if (!options || !options.url) { console.assert(this.url, 'url must be provided or collection must have url'); @@ -34,14 +34,15 @@ Backbone.Collection.prototype.BindSignalR = function (options) { console.debug('{0} [{1}]'.format(options.url, _getStatus(change.newState))); }); - connection.received(function () { + connection.received(function (model) { + console.debug(model); self.fetch(); }); connection.start({ transport: ['longPolling'] }); return this; -}; +}}); diff --git a/UI/Series/Index/List/ItemTemplate.html b/UI/Series/Index/List/ItemTemplate.html index 05101f2e5..a32253d72 100644 --- a/UI/Series/Index/List/ItemTemplate.html +++ b/UI/Series/Index/List/ItemTemplate.html @@ -33,11 +33,11 @@ {{#if bestDateString}} {{bestDateString}} {{else}} - {{statusText}} + {{status}} {{/if}} Season {{seasonCount}} {{else}} - {{statusText}} + {{status}} {{seasonCount}} Seasons {{/if}} diff --git a/UI/Series/Index/Posters/ItemTemplate.html b/UI/Series/Index/Posters/ItemTemplate.html index 5653ddac0..67eda5628 100644 --- a/UI/Series/Index/Posters/ItemTemplate.html +++ b/UI/Series/Index/Posters/ItemTemplate.html @@ -26,7 +26,7 @@ {{#if bestDateString}} {{bestDateString}} {{else}} - {{statusText}} + {{status}} {{/if}} Season {{seasonCount}} {{else}} diff --git a/UI/Series/SeriesModel.js b/UI/Series/SeriesModel.js index 3c36a1d1b..d30557e4e 100644 --- a/UI/Series/SeriesModel.js +++ b/UI/Series/SeriesModel.js @@ -23,7 +23,7 @@ define(['app', 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/RootFo }, poster : function () { var poster = _.find(this.get('images'), function (image) { - return image.coverType === 1; + return image.coverType === 'poster'; }); if (poster) { @@ -47,14 +47,7 @@ define(['app', 'Quality/QualityProfileCollection', 'AddSeries/RootFolders/RootFo return "http://trakt.tv/show/" + this.get('titleSlug'); }, isContinuing : function () { - return this.get('status') === 0; - }, - statusText : function () { - if (this.get('status') === 0) { - return 'Continuing'; - } - - return 'Ended'; + return this.get('status') === 'continuing'; }, shortDate : function () { var date = this.get('nextAiring');