1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 01:38:24 +00:00

Merge branch 'markus101'

Conflicts:
	NzbDrone.Core.Test/SeriesProviderTest.cs
This commit is contained in:
kay.one 2011-06-18 01:36:05 -07:00
commit d55e2606ad
9 changed files with 29 additions and 21 deletions

View file

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

View file

@ -38,6 +38,8 @@ public class ParserTest : TestBase
[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(@"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)
{
var result = Parser.ParseEpisodeInfo(postTitle);
@ -152,7 +154,7 @@ public void episode_multipart_parse(string postTitle, string title, int season,
[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.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)
{
var result = Parser.ParseEpisodeInfo(postTitle);

View file

@ -292,9 +292,6 @@
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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.

View file

@ -46,7 +46,7 @@ public static class Parser
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);
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);
/// <summary>

View file

@ -38,12 +38,12 @@ public virtual Episode GetEpisode(long id)
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)
{
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)

View file

@ -119,7 +119,15 @@ public virtual Series FindSeries(string title)
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)

View file

@ -13,11 +13,14 @@ public class HistoryController : Controller
{
private readonly HistoryProvider _historyProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly SeriesProvider _seriesProvider;
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider)
public HistoryController(HistoryProvider historyProvider, EpisodeProvider episodeProvider,
SeriesProvider seriesProvider)
{
_historyProvider = historyProvider;
_episodeProvider = episodeProvider;
_seriesProvider = seriesProvider;
}
//
@ -43,17 +46,14 @@ public ActionResult Purge()
[GridAction]
public ActionResult _AjaxBinding()
{
//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 historyDb = _historyProvider.AllItems();
var history = new List<HistoryModel>();
foreach (var item in historyDb)
{
var episode = _episodeProvider.GetEpisode(item.EpisodeId);
var series = _seriesProvider.GetSeries(item.SeriesId);
history.Add(new HistoryModel
{
@ -62,7 +62,7 @@ public ActionResult _AjaxBinding()
EpisodeNumber = episode.EpisodeNumber,
EpisodeTitle = episode.Title,
EpisodeOverview = episode.Overview,
SeriesTitle = episode.Series.Title,
SeriesTitle = series.Title,
NzbTitle = item.NzbTitle,
Quality = item.Quality.ToString(),
IsProper = item.IsProper,

View file

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