1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Missing uses EpisodeResource now

This commit is contained in:
Mark McDowall 2013-04-30 17:25:33 -07:00
parent 9d5cb6f3e0
commit 0da2047ca5
8 changed files with 13 additions and 41 deletions

View File

@ -46,11 +46,6 @@ public static void InitializeAutomapper()
//Episode //Episode
Mapper.CreateMap<Episode, EpisodeResource>(); Mapper.CreateMap<Episode, EpisodeResource>();
//Missing
Mapper.CreateMap<Episode, MissingResource>()
.ForMember(dest => dest.SeriesTitle, opt => opt.MapFrom(src => src.Series.Title))
.ForMember(dest => dest.EpisodeTitle, opt => opt.MapFrom(src => src.Title));
} }
} }
} }

View File

@ -3,6 +3,7 @@
using System.Linq; using System.Linq;
using AutoMapper; using AutoMapper;
using Nancy; using Nancy;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Extensions; using NzbDrone.Api.Extensions;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -25,7 +26,9 @@ private Response GetMissingEpisodes()
Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials); Boolean.TryParse(PrimitiveExtensions.ToNullSafeString(Request.Query.IncludeSpecials), out includeSpecials);
var episodes = _episodeService.EpisodesWithoutFiles(includeSpecials); var episodes = _episodeService.EpisodesWithoutFiles(includeSpecials);
return Mapper.Map<List<Episode>, List<MissingResource>>(episodes).AsResponse();
//TODO: Include the Series Title
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
} }
} }
} }

View File

@ -1,17 +0,0 @@
using System;
using System.Linq;
namespace NzbDrone.Api.Missing
{
public class MissingResource
{
public Int32 SeriesId { get; set; }
public String SeriesTitle { get; set; }
public Int32 EpisodeId { get; set; }
public String EpisodeTitle { get; set; }
public Int32 SeasonNumber { get; set; }
public Int32 EpisodeNumber { get; set; }
public DateTime? AirDate { get; set; }
public String Overview { get; set; }
}
}

View File

@ -101,7 +101,6 @@
<Compile Include="Mapping\MappingValidation.cs" /> <Compile Include="Mapping\MappingValidation.cs" />
<Compile Include="Mapping\ResourceMappingException.cs" /> <Compile Include="Mapping\ResourceMappingException.cs" />
<Compile Include="Mapping\ValueInjectorExtensions.cs" /> <Compile Include="Mapping\ValueInjectorExtensions.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" /> <Compile Include="Missing\MissingModule.cs" />
<Compile Include="NzbDroneRestModule.cs" /> <Compile Include="NzbDroneRestModule.cs" />
<Compile Include="Resolvers\EndTimeResolver.cs" /> <Compile Include="Resolvers\EndTimeResolver.cs" />

View File

@ -1,8 +1,8 @@
"use strict"; "use strict";
define(['app', 'Missing/MissingModel'], function () { define(['app', 'Series/EpisodeModel'], function () {
NzbDrone.Missing.MissingCollection = Backbone.Collection.extend({ NzbDrone.Missing.MissingCollection = Backbone.Collection.extend({
url : NzbDrone.Constants.ApiRoot + '/missing', url : NzbDrone.Constants.ApiRoot + '/missing',
model : NzbDrone.Missing.MissingModel, model : NzbDrone.Series.EpisodeModel,
comparator: function (model) { comparator: function (model) {
return model.get('airDate'); return model.get('airDate');
} }

View File

@ -1,5 +1,5 @@
<td><a href="/series/details/{{seriesId}}">{{seriesTitle}}</a></td> <td><a href="/series/details/{{seriesId}}">{{seriesTitle}}</a></td>
<td>{{seasonNumber}}x{{paddedEpisodeNumber}}</td> <td>{{seasonNumber}}x{{paddedEpisodeNumber}}</td>
<td name="episodeTitle"></td> <td name="title"></td>
<td><span title="{{formatedDateString}}" data-date="{{airDate}}">{{bestDateString}}</span></td> <td><span title="{{formatedDateString}}" data-date="{{airDate}}">{{bestDateString}}</span></td>
<td><i class="icon-search x-search" title="Search for Episode"></i></td> <td><i class="icon-search x-search" title="Search for Episode"></i></td>

View File

@ -1,13 +0,0 @@
"use strict";
define(['app'], function () {
NzbDrone.Missing.MissingModel = Backbone.Model.extend({
mutators: {
bestDateString : function () {
return bestDateString(this.get('airDate'));
},
paddedEpisodeNumber: function () {
return this.get('episodeNumber');
}
}
});
});

View File

@ -3,7 +3,12 @@ define(['app'], function () {
NzbDrone.Series.EpisodeModel = Backbone.Model.extend({ NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
mutators: { mutators: {
bestDateString : function () {
return bestDateString(this.get('airDate'));
},
paddedEpisodeNumber: function () {
return this.get('episodeNumber');
}
}, },
defaults: { defaults: {