episode detail is working but its a bit slow.
This commit is contained in:
parent
4a4e440ec0
commit
9a738e3a65
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Nancy;
|
||||
|
@ -17,12 +15,15 @@ namespace NzbDrone.Api.Episodes
|
|||
: base("/episodes")
|
||||
{
|
||||
_episodeService = episodeService;
|
||||
Get["/{seriesId}"] = x => GetEpisodesForSeries(x.SeriesId);
|
||||
Get["/"] = x => GetEpisodesForSeries();
|
||||
}
|
||||
|
||||
private Response GetEpisodesForSeries(int seriesId)
|
||||
private Response GetEpisodesForSeries()
|
||||
{
|
||||
var episodes = _episodeService.GetEpisodeBySeries(seriesId);
|
||||
var seriesId = (int)Request.Query.SeriesId;
|
||||
var seasonNumber = (int)Request.Query.SeasonNumber;
|
||||
|
||||
var episodes = _episodeService.GetEpisodesBySeason(seriesId, seasonNumber);
|
||||
return Mapper.Map<List<Episode>, List<EpisodeResource>>(episodes).AsResponse();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,24 +122,24 @@
|
|||
<Content Include="Routing.js" />
|
||||
<Content Include="Series\Delete\DeleteSeriesTemplate.html" />
|
||||
<Content Include="Series\Delete\DeleteSeriesView.js" />
|
||||
<Content Include="Series\Details\EpisodeCollection.js" />
|
||||
<Content Include="Series\Details\EpisodeItemTemplate.html" />
|
||||
<Content Include="Series\Details\EpisodeItemView.js" />
|
||||
<Content Include="Series\Details\EpisodeModel.js" />
|
||||
<Content Include="Series\Details\SeasonCollection.js" />
|
||||
<Content Include="Series\Details\SeasonCompositeTemplate.html" />
|
||||
<Content Include="Series\Details\SeasonCompositeView.js" />
|
||||
<Content Include="Series\Details\SeasonModel.js" />
|
||||
<Content Include="Series\Details\SeriesDetailsTemplate.html" />
|
||||
<Content Include="Series\Details\SeriesDetailsView.js" />
|
||||
<Content Include="Series\Edit\EditSeriesTemplate.html" />
|
||||
<Content Include="Series\Edit\EditSeriesView.js" />
|
||||
<Content Include="Series\EmptySeriesCollectionTemplate.html" />
|
||||
<Content Include="Series\EpisodeCollection.js" />
|
||||
<Content Include="Series\EpisodeModel.js" />
|
||||
<Content Include="Series\Index\EmptySeriesIndexTemplate.html" />
|
||||
<Content Include="Series\Index\SeriesIndexCollectionView.js" />
|
||||
<Content Include="Series\Index\SeriesIndexTemplate.html" />
|
||||
<Content Include="Series\Index\SeriesItemTemplate.html" />
|
||||
<Content Include="Series\Index\SeriesItemView.js" />
|
||||
<Content Include="Series\SeasonCollection.js" />
|
||||
<Content Include="Series\SeasonModel.js" />
|
||||
<Content Include="Series\SeriesCollection.js" />
|
||||
<Content Include="Series\SeriesCollectionTemplate.html" />
|
||||
<Content Include="Series\SeriesIndexCollectionView.js" />
|
||||
<Content Include="Series\SeriesItemTemplate.html" />
|
||||
<Content Include="Series\SeriesItemView.js" />
|
||||
<Content Include="Series\SeriesModel.js" />
|
||||
<Content Include="Shared\AutoComplete.js" />
|
||||
<Content Include="Shared\NotFoundTemplate.html" />
|
||||
|
|
|
@ -9,5 +9,7 @@
|
|||
<th>Controls</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
<tbody class="x-episodes">
|
||||
|
||||
</tbody>
|
||||
</table>
|
|
@ -6,7 +6,11 @@ define(['app', 'Series/Details/EpisodeItemView'], function () {
|
|||
template: 'Series/Details/SeasonCompositeTemplate',
|
||||
|
||||
initialize: function() {
|
||||
|
||||
this.collection =new NzbDrone.Series.EpisodeCollection();
|
||||
this.collection.fetch({data: {
|
||||
seriesId: this.model.get('seriesId'),
|
||||
seasonNumber:this.model.get('seasonNumber')
|
||||
}});
|
||||
}
|
||||
});
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
define(['app', 'Series/EpisodeModel'], function () {
|
||||
NzbDrone.Series.EpisodeCollection = Backbone.Collection.extend({
|
||||
url: NzbDrone.Constants.ApiRoot + '/episode',
|
||||
url: NzbDrone.Constants.ApiRoot + '/episodes',
|
||||
model: NzbDrone.Series.EpisodeModel
|
||||
});
|
||||
});
|
|
@ -64,7 +64,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
var episodes = Builder<Episode>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.Series = series)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
var episodes = Builder<Episode>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(e => e.Series = series)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.All()
|
||||
.With(e => e.Series = series)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.Series = series)
|
||||
.With(e => e.SeriesId = series.Id)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.SeasonNumber = 1)
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series2)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -243,7 +243,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.SeasonNumber = 1)
|
||||
.TheLast(6)
|
||||
.With(e => e.Series = series[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.Series = series[1])
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series[2])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
//WithEnableBacklogSearching();
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.Series = series[1])
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series[2])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.AirDate = DateTime.Today.AddDays(-31)) //31 Days
|
||||
.TheNext(5)
|
||||
.With(e => e.AirDate = DateTime.Today.AddDays(-35))
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.SeasonNumber = 1)
|
||||
.TheLast(6)
|
||||
.With(e => e.Series = series[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.Series = series[1])
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series[2])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
//WithEnableBacklogSearching();
|
||||
|
||||
|
@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.Series = series[1])
|
||||
.TheNext(5)
|
||||
.With(e => e.Series = series[2])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithEnableBacklogSearching();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
// ReSharper disable InconsistentNaming
|
||||
public class SeasonSearchJobTest : CoreTest
|
||||
{
|
||||
private IList<Episode> _episodes;
|
||||
private List<Episode> _episodes;
|
||||
|
||||
private ProgressNotification notification;
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.Ignored = false)
|
||||
.With(e => e.AirDate = DateTime.Today.AddDays(-1))
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(_episodes);
|
||||
|
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(e => e.AirDate = DateTime.Today.AddDays(-1))
|
||||
.TheLast(2)
|
||||
.With(e => e.AirDate = DateTime.Today.AddDays(2))
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(c => c.GetEpisodesBySeason(1, 1)).Returns(episodes);
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.All()
|
||||
.With(e => e.SeriesId = seriesId)
|
||||
.With(e => e.EpisodeFile = episodeFile)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Setup(v => v.GetFileByPath(filename))
|
||||
.Returns(() => null);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
|
@ -250,7 +250,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.Quality = Quality.SDTV)
|
||||
.Build())
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
With80MBFile();
|
||||
|
||||
|
@ -281,7 +281,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.With(e => e.EpisodeFile = Builder<EpisodeFile>.CreateNew()
|
||||
.With(f => f.Quality = Quality.Bluray720p)
|
||||
.Build())
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
//Mocks
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.With(e => e.SeriesId = fakeSeries.Id)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".avi"));
|
||||
|
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.With(e => e.SeriesId = fakeSeries.Id)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv"));
|
||||
|
@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.With(e => e.SeriesId = fakeSeries.Id)
|
||||
.With(e => e.SeasonNumber = 1)
|
||||
.With(e => e.EpisodeNumber = 1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
const string filename = @"30 Rock - S01E01 - TBD";
|
||||
var fi = new FileInfo(Path.Combine(@"C:\Test\TV\30 Rock\Season 01\", filename + ".mkv"));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
|
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.TheNext(1)
|
||||
.With(f => f.Id = 2)
|
||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(2)
|
||||
.All()
|
||||
|
@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.With(e => e.EpisodeFile = episodeFiles[0])
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.With(e => e.EpisodeFile = episodeFiles[0])
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
|
@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.With(e => e.EpisodeFile = episodeFiles[0])
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
|
@ -175,7 +175,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.TheNext(1)
|
||||
.With(f => f.Id = 2)
|
||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(3)
|
||||
.All()
|
||||
|
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.With(e => e.EpisodeFile = episodeFiles[0])
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
|
@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.TheNext(1)
|
||||
.With(f => f.Id = 2)
|
||||
.With(f => f.Path = @"C:\Test\Title2.avi")
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(3)
|
||||
.All()
|
||||
|
@ -233,7 +233,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.With(e => e.EpisodeFile = episodeFiles[0])
|
||||
.TheNext(1)
|
||||
.With(e => e.EpisodeFile = episodeFiles[1])
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
private SearchHistory _searchHistory;
|
||||
private ProgressNotification _notification;
|
||||
|
||||
private IList<Episode> _episodes;
|
||||
private List<Episode> _episodes;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
@ -50,7 +50,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
|
||||
_episodes = Builder<Episode>
|
||||
.CreateListOfSize(1)
|
||||
.Build();
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
|
||||
|
|
Binary file not shown.
|
@ -18,14 +18,14 @@ namespace NzbDrone.Core.Tv
|
|||
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber);
|
||||
Episode GetEpisode(int seriesId, DateTime date);
|
||||
List<Episode> GetEpisodeBySeries(int seriesId);
|
||||
IList<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
|
||||
IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult);
|
||||
IList<Episode> EpisodesWithoutFiles(bool includeSpecials);
|
||||
IList<Episode> GetEpisodesByFileId(int episodeFileId);
|
||||
IList<Episode> EpisodesWithFiles();
|
||||
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
|
||||
List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult);
|
||||
List<Episode> EpisodesWithoutFiles(bool includeSpecials);
|
||||
List<Episode> GetEpisodesByFileId(int episodeFileId);
|
||||
List<Episode> EpisodesWithFiles();
|
||||
void RefreshEpisodeInfo(Series series);
|
||||
void UpdateEpisode(Episode episode);
|
||||
IList<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber);
|
||||
List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber);
|
||||
void SetEpisodeIgnore(int episodeId, bool isIgnored);
|
||||
bool IsFirstOrLastEpisodeOfSeason(int seriesId, int seasonNumber, int episodeNumber);
|
||||
void SetPostDownloadStatus(List<int> episodeIds, PostDownloadStatusType postDownloadStatus);
|
||||
|
@ -78,12 +78,12 @@ namespace NzbDrone.Core.Tv
|
|||
return _episodeRepository.GetEpisodes(seriesId).ToList();
|
||||
}
|
||||
|
||||
public IList<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber)
|
||||
public List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
|
||||
}
|
||||
|
||||
public IList<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult)
|
||||
public List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult)
|
||||
{
|
||||
var result = new List<Episode>();
|
||||
|
||||
|
@ -161,17 +161,17 @@ namespace NzbDrone.Core.Tv
|
|||
return result;
|
||||
}
|
||||
|
||||
public IList<Episode> EpisodesWithoutFiles(bool includeSpecials)
|
||||
public List<Episode> EpisodesWithoutFiles(bool includeSpecials)
|
||||
{
|
||||
return _episodeRepository.EpisodesWithoutFiles(includeSpecials);
|
||||
}
|
||||
|
||||
public IList<Episode> GetEpisodesByFileId(int episodeFileId)
|
||||
public List<Episode> GetEpisodesByFileId(int episodeFileId)
|
||||
{
|
||||
return _episodeRepository.GetEpisodeByFileId(episodeFileId);
|
||||
}
|
||||
|
||||
public IList<Episode> EpisodesWithFiles()
|
||||
public List<Episode> EpisodesWithFiles()
|
||||
{
|
||||
return _episodeRepository.EpisodesWithFiles();
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ namespace NzbDrone.Core.Tv
|
|||
_episodeRepository.Update(episode);
|
||||
}
|
||||
|
||||
public IList<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber)
|
||||
public List<int> GetEpisodeNumbersBySeason(int seriesId, int seasonNumber)
|
||||
{
|
||||
return GetEpisodesBySeason(seriesId, seasonNumber).Select(c => c.Id).ToList();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
@ -91,7 +92,7 @@ namespace NzbDrone.Update.Test
|
|||
[Test]
|
||||
public void should_kill_nzbdrone_process_if_running()
|
||||
{
|
||||
var proccesses = Builder<ProcessInfo>.CreateListOfSize(2).Build();
|
||||
var proccesses = Builder<ProcessInfo>.CreateListOfSize(2).Build().ToList();
|
||||
|
||||
Mocker.GetMock<ProcessProvider>()
|
||||
.Setup(c => c.GetProcessByName(ProcessProvider.NzbDroneProccessName))
|
||||
|
|
Loading…
Reference in New Issue