Merge branch 'markus101'

Conflicts:
	NzbDrone.Core.Test/SeriesProviderTest.cs
pull/6/head
kay.one 14 years ago
commit d55e2606ad

@ -106,7 +106,6 @@ namespace NzbDrone.Core.Test
mocker.GetMock<DiskProvider>() mocker.GetMock<DiskProvider>()
.Setup(e => e.GetSize(fileName)).Returns(size).Verifiable(); .Setup(e => e.GetSize(fileName)).Returns(size).Verifiable();
//Act //Act
var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName); var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);

@ -38,6 +38,8 @@ namespace NzbDrone.Core.Test
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)] [TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
[TestCase(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)] [TestCase(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
[TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)] [TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
[TestCase("Adventure.Inc.S03E19.DVDRip.\"XviD\"-OSiTV", "Adventure.Inc", 3, 19)]
[TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
public void episode_parse(string postTitle, string title, int season, int episode) public void episode_parse(string postTitle, string title, int season, int episode)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
@ -152,7 +154,7 @@ namespace NzbDrone.Core.Test
[TestCase("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)] [TestCase("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
[TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)] [TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
[TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)] [TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
[TestCase("The Tonight Show with Jay Leno - 2011-06-16 - Larry David, \"Bachelorette\" Ashley Hebert, Pitbull with Ne-Yo", "The Tonight Show with Jay Leno", 2011, 3, 13)] [TestCase("The Tonight Show with Jay Leno - 2011-06-16 - Larry David, \"Bachelorette\" Ashley Hebert, Pitbull with Ne-Yo", "The Tonight Show with Jay Leno", 2011, 6, 16)]
public void episode_daily_parse(string postTitle, string title, int year, int month, int day) public void episode_daily_parse(string postTitle, string title, int year, int month, int day)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);

@ -292,9 +292,6 @@
<ItemGroup> <ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" /> <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

@ -46,7 +46,7 @@ namespace NzbDrone.Core
private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|(?:(?<=[^0-9]+)|\b)(?!(?:19\d{2}|20\d{2}))\d+(?=[^0-9ip]+|\b)", private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|(?:(?<=[^0-9]+)|\b)(?!(?:19\d{2}|20\d{2}))\d+(?=[^0-9ip]+|\b)",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\<|\>|\?|\*|\:|\|", private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\<|\>|\?|\*|\:|\||""",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
/// <summary> /// <summary>

@ -38,12 +38,12 @@ namespace NzbDrone.Core.Providers
public virtual Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber) public virtual Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber)
{ {
return _database.Single<Episode>("WHERE SeriesId = @0 AND SeasonNumber = @2 AND EpisodeNumber = @3", seriesId, seasonNumber, episodeNumber); return _database.Single<Episode>("WHERE SeriesId = @0 AND SeasonNumber = @1 AND EpisodeNumber = @2", seriesId, seasonNumber, episodeNumber);
} }
public virtual Episode GetEpisode(int seriesId, DateTime date) public virtual Episode GetEpisode(int seriesId, DateTime date)
{ {
return _database.Single<Episode>("WHERE SeriesId = @0 AND AirDate = @2", seriesId, date.Date); return _database.Single<Episode>("WHERE SeriesId = @0 AND AirDate = @1", seriesId, date.Date);
} }
public virtual IList<Episode> GetEpisodeBySeries(long seriesId) public virtual IList<Episode> GetEpisodeBySeries(long seriesId)

@ -119,7 +119,15 @@ namespace NzbDrone.Core.Providers
return GetSeries(seriesId.Value); return GetSeries(seriesId.Value);
} }
return _database.FirstOrDefault<Series>("WHERE CleanTitle = @0", normalizeTitle); var series = _database.FirstOrDefault<Series>("WHERE CleanTitle = @0", normalizeTitle);
if (series != null)
{
series.QualityProfile = _qualityProvider.Get(series.QualityProfileId);
return series;
}
return null;
} }
public virtual void UpdateSeries(Series series) public virtual void UpdateSeries(Series series)

@ -13,11 +13,14 @@ namespace NzbDrone.Web.Controllers
{ {
private readonly HistoryProvider _historyProvider; private readonly HistoryProvider _historyProvider;
private readonly EpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly SeriesProvider _seriesProvider;
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider) public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider)
{ {
_historyProvider = historyProvider; _historyProvider = historyProvider;
_episodeProvider = episodeProvider; _episodeProvider = episodeProvider;
_seriesProvider = seriesProvider;
} }
// //
@ -43,17 +46,14 @@ namespace NzbDrone.Web.Controllers
[GridAction] [GridAction]
public ActionResult _AjaxBinding() public ActionResult _AjaxBinding()
{ {
var historyDb = _historyProvider.AllItems();
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
//https://github.com/subsonic/SubSonic-3.0/issues/263
var historyDb = _historyProvider.AllItems().ToList();
var history = new List<HistoryModel>(); var history = new List<HistoryModel>();
foreach (var item in historyDb) foreach (var item in historyDb)
{ {
var episode = _episodeProvider.GetEpisode(item.EpisodeId); var episode = _episodeProvider.GetEpisode(item.EpisodeId);
var series = _seriesProvider.GetSeries(item.SeriesId);
history.Add(new HistoryModel history.Add(new HistoryModel
{ {
@ -62,7 +62,7 @@ namespace NzbDrone.Web.Controllers
EpisodeNumber = episode.EpisodeNumber, EpisodeNumber = episode.EpisodeNumber,
EpisodeTitle = episode.Title, EpisodeTitle = episode.Title,
EpisodeOverview = episode.Overview, EpisodeOverview = episode.Overview,
SeriesTitle = episode.Series.Title, SeriesTitle = series.Title,
NzbTitle = item.NzbTitle, NzbTitle = item.NzbTitle,
Quality = item.Quality.ToString(), Quality = item.Quality.ToString(),
IsProper = item.IsProper, IsProper = item.IsProper,

@ -11,10 +11,12 @@ namespace NzbDrone.Web.Controllers
public class UpcomingController : Controller public class UpcomingController : Controller
{ {
private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider; private readonly UpcomingEpisodesProvider _upcomingEpisodesProvider;
private readonly SeriesProvider _seriesProvider;
public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider) public UpcomingController(UpcomingEpisodesProvider upcomingEpisodesProvider, SeriesProvider seriesProvider)
{ {
_upcomingEpisodesProvider = upcomingEpisodesProvider; _upcomingEpisodesProvider = upcomingEpisodesProvider;
_seriesProvider = seriesProvider;
} }
// //
@ -33,7 +35,7 @@ namespace NzbDrone.Web.Controllers
foreach (var item in upcomingDb) foreach (var item in upcomingDb)
{ {
var series = item.Series; var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel upcoming.Add(new UpcomingEpisodeModel
{ {
@ -59,7 +61,7 @@ namespace NzbDrone.Web.Controllers
foreach (var item in upcomingDb) foreach (var item in upcomingDb)
{ {
var series = item.Series; var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel upcoming.Add(new UpcomingEpisodeModel
{ {
@ -85,7 +87,7 @@ namespace NzbDrone.Web.Controllers
foreach (var item in upcomingDb) foreach (var item in upcomingDb)
{ {
var series = item.Series; var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel upcoming.Add(new UpcomingEpisodeModel
{ {
@ -111,7 +113,7 @@ namespace NzbDrone.Web.Controllers
foreach (var item in upcomingDb) foreach (var item in upcomingDb)
{ {
var series = item.Series; var series = _seriesProvider.GetSeries(item.SeriesId);
upcoming.Add(new UpcomingEpisodeModel upcoming.Add(new UpcomingEpisodeModel
{ {

Loading…
Cancel
Save