From dc986db8ccf1874189f7ddec058408c166628c84 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 15 Oct 2013 18:16:26 -0400 Subject: [PATCH] added ContainsEpisodeNumber helper on Episode --- .../Entities/TV/Episode.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index c6c426a68..14c655455 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -171,5 +171,25 @@ namespace MediaBrowser.Controller.Entities.TV return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000-") : "") + (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name; } + + /// + /// Determines whether [contains episode number] [the specified number]. + /// + /// The number. + /// true if [contains episode number] [the specified number]; otherwise, false. + public bool ContainsEpisodeNumber(int number) + { + if (IndexNumber.HasValue) + { + if (IndexNumberEnd.HasValue) + { + return number >= IndexNumber.Value && number <= IndexNumberEnd.Value; + } + + return IndexNumber.Value == number; + } + + return false; + } } }