From 04160a61c9d4b125a4250bc5d1082d80e19e3cdf Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Fri, 22 Aug 2014 22:27:14 +0200 Subject: [PATCH 1/3] Fixed: Update Quality parser for Anime Elysium group. --- src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs | 1 + src/NzbDrone.Core/Parser/QualityParser.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index bd8d56fdf..f2946c59e 100644 --- a/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -164,6 +164,7 @@ public void should_parse_webdl1080p_quality(string title, bool proper) [TestCase("[Kaylith] Isshuukan Friends Specials - 01 [BD 720p AAC][B7EEE164].mkv", false)] [TestCase("WEEDS.S03E01-06.DUAL.Blu-ray.AC3.-HELLYWOOD.avi", false)] [TestCase("WEEDS.S03E01-06.DUAL.720p.Blu-ray.AC3.-HELLYWOOD.avi", false)] + [TestCase("[Elysium]Lucky.Star.01(BD.720p.AAC.DA)[0BB96AD8].mkv", false)] public void should_parse_bluray720p_quality(string title, bool proper) { ParseAndVerifyQuality(title, Quality.Bluray720p, proper); diff --git a/src/NzbDrone.Core/Parser/QualityParser.cs b/src/NzbDrone.Core/Parser/QualityParser.cs index 36fa12447..7222e625e 100644 --- a/src/NzbDrone.Core/Parser/QualityParser.cs +++ b/src/NzbDrone.Core/Parser/QualityParser.cs @@ -39,7 +39,7 @@ public class QualityParser private static readonly Regex OtherSourceRegex = new Regex(@"(?HD[-_. ]TV)|(?SD[-_. ]TV)", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080)|(?<=\[|\(|\s)bd(?=\s|\)|\])", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex AnimeBlurayRegex = new Regex(@"bd(?:720|1080)|(?<=[-_. (\[])bd(?=[-_. )\]])", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex HighDefPdtvRegex = new Regex(@"hr[-_. ]ws", RegexOptions.Compiled | RegexOptions.IgnoreCase); From bd60133274c7db9e0c4da5cd63ecda648ffa41a0 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 23 Aug 2014 09:40:34 +0200 Subject: [PATCH 2/3] Fixed: Framerate in mediainfo is now parsed culture invariant. --- src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs index 83c5debac..ed019d72e 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaInfo/VideoFileInfoReader.cs @@ -4,6 +4,7 @@ using NLog; using NzbDrone.Common; using NzbDrone.Common.Disk; +using System.Globalization; namespace NzbDrone.Core.MediaFiles.MediaInfo { @@ -59,7 +60,7 @@ public MediaInfoModel GetMediaInfo(string filename) Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "Width"), out width); Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "Height"), out height); Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "BitRate"), out videoBitRate); - Decimal.TryParse(mediaInfo.Get(StreamKind.Video, 0, "FrameRate"), out videoFrameRate); + Decimal.TryParse(mediaInfo.Get(StreamKind.Video, 0, "FrameRate"), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out videoFrameRate); //Runtime Int32.TryParse(mediaInfo.Get(StreamKind.Video, 0, "PlayTime"), out videoRuntime); From ded6e966e3ceceb89fa760a249154883531fe48c Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Tue, 19 Aug 2014 00:24:44 +0200 Subject: [PATCH 3/3] New: Episode quality badges are now styled differently for episodes that haven't met quality cutoff yet. --- .../EpisodeFiles/EpisodeFileModule.cs | 8 +++++- .../EpisodeFiles/EpisodeFileResource.cs | 2 ++ src/NzbDrone.Api/Episodes/EpisodeModule.cs | 26 ++++++++++++++++--- .../Episodes/EpisodeModuleWithSignalR.cs | 2 +- src/NzbDrone.Api/Episodes/EpisodeResource.cs | 3 ++- src/UI/Cells/EpisodeStatusCell.js | 8 +++++- src/UI/Cells/cells.less | 6 +++++ 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs index 7a87ff338..98af26a4a 100644 --- a/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs +++ b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileModule.cs @@ -11,6 +11,7 @@ using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Tv; +using NzbDrone.Core.DecisionEngine; namespace NzbDrone.Api.EpisodeFiles { @@ -20,18 +21,21 @@ public class EpisodeModule : NzbDroneRestModuleWithSignalR(); resource.Path = Path.Combine(series.Path, episodeFile.RelativePath); + resource.QualityCutoffNotMet = _qualityUpgradableSpecification.CutoffNotMet(series.Profile.Value, episodeFile.Quality); + return resource; } diff --git a/src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs index 696e367eb..594f4f5b1 100644 --- a/src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs +++ b/src/NzbDrone.Api/EpisodeFiles/EpisodeFileResource.cs @@ -14,5 +14,7 @@ public class EpisodeFileResource : RestResource public DateTime DateAdded { get; set; } public String SceneName { get; set; } public QualityModel Quality { get; set; } + + public Boolean QualityCutoffNotMet { get; set; } } } diff --git a/src/NzbDrone.Api/Episodes/EpisodeModule.cs b/src/NzbDrone.Api/Episodes/EpisodeModule.cs index 96ddf161a..3dbb16064 100644 --- a/src/NzbDrone.Api/Episodes/EpisodeModule.cs +++ b/src/NzbDrone.Api/Episodes/EpisodeModule.cs @@ -2,17 +2,23 @@ using NzbDrone.Api.REST; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Tv; +using NzbDrone.Api.Mapping; +using NzbDrone.Core.DecisionEngine; namespace NzbDrone.Api.Episodes { - public class EpisodeModule : EpisodeModuleWithSignalR + public class EpisodeModule : EpisodeModuleWithSignalR { + private readonly ISeriesService _seriesService; private readonly IEpisodeService _episodeService; + private readonly IQualityUpgradableSpecification _qualityUpgradableSpecification; - public EpisodeModule(ICommandExecutor commandExecutor, IEpisodeService episodeService) + public EpisodeModule(ICommandExecutor commandExecutor, ISeriesService seriesService, IEpisodeService episodeService, IQualityUpgradableSpecification qualityUpgradableSpecification) : base(episodeService, commandExecutor) { + _seriesService = seriesService; _episodeService = episodeService; + _qualityUpgradableSpecification = qualityUpgradableSpecification; GetResourceAll = GetEpisodes; UpdateResource = SetMonitored; @@ -27,7 +33,21 @@ private List GetEpisodes() throw new BadRequestException("seriesId is missing"); } - return ToListResource(() => _episodeService.GetEpisodeBySeries(seriesId.Value)); + var series = _seriesService.GetSeries(seriesId.Value); + + var resources = new List(); + foreach (var episode in _episodeService.GetEpisodeBySeries(seriesId.Value)) + { + var resource = episode.InjectTo(); + if (episode.EpisodeFile.IsLoaded) + { + resource.EpisodeFile.QualityCutoffNotMet = _qualityUpgradableSpecification.CutoffNotMet(series.Profile.Value, episode.EpisodeFile.Value.Quality); + } + + resources.Add(resource); + } + + return resources; } private void SetMonitored(EpisodeResource episodeResource) diff --git a/src/NzbDrone.Api/Episodes/EpisodeModuleWithSignalR.cs b/src/NzbDrone.Api/Episodes/EpisodeModuleWithSignalR.cs index e25d1bd6b..a1ba8b57f 100644 --- a/src/NzbDrone.Api/Episodes/EpisodeModuleWithSignalR.cs +++ b/src/NzbDrone.Api/Episodes/EpisodeModuleWithSignalR.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Api.Episodes { public abstract class EpisodeModuleWithSignalR : NzbDroneRestModuleWithSignalR, - IHandle, + IHandle, IHandle { private readonly IEpisodeService _episodeService; diff --git a/src/NzbDrone.Api/Episodes/EpisodeResource.cs b/src/NzbDrone.Api/Episodes/EpisodeResource.cs index b3a7d1058..50d274143 100644 --- a/src/NzbDrone.Api/Episodes/EpisodeResource.cs +++ b/src/NzbDrone.Api/Episodes/EpisodeResource.cs @@ -1,5 +1,6 @@ using System; using Newtonsoft.Json; +using NzbDrone.Api.EpisodeFiles; using NzbDrone.Api.REST; using NzbDrone.Core.MediaFiles; @@ -15,7 +16,7 @@ public class EpisodeResource : RestResource public String AirDate { get; set; } public DateTime? AirDateUtc { get; set; } public String Overview { get; set; } - public EpisodeFile EpisodeFile { get; set; } + public EpisodeFileResource EpisodeFile { get; set; } public Boolean HasFile { get; set; } public Boolean Monitored { get; set; } diff --git a/src/UI/Cells/EpisodeStatusCell.js b/src/UI/Cells/EpisodeStatusCell.js index 494be0195..84272bfc1 100644 --- a/src/UI/Cells/EpisodeStatusCell.js +++ b/src/UI/Cells/EpisodeStatusCell.js @@ -52,7 +52,13 @@ define( title += ' - {0}'.format(size); } - this.$el.html('{1}'.format(title, quality.quality.name)); + if (this.episodeFile.get('qualityCutoffNotMet')) { + this.$el.html('{1}'.format(title, quality.quality.name)); + } + else { + this.$el.html('{1}'.format(title, quality.quality.name)); + } + return; } diff --git a/src/UI/Cells/cells.less b/src/UI/Cells/cells.less index e4517edf5..0f915fc94 100644 --- a/src/UI/Cells/cells.less +++ b/src/UI/Cells/cells.less @@ -86,6 +86,12 @@ td.episode-status-cell, td.quality-cell { font-size: 9px; } + .badge-inverse { + background-color: #eee; + border: 1px solid @badge-bg; + color: @badge-bg; + } + .progress { height : 10px; margin-top : 5px;