Skip to content

Commit

Permalink
add an extra check when determining if a tv show is already available…
Browse files Browse the repository at this point in the history
… (also check if it starts with the show name returned from the tv db)
  • Loading branch information
Drewster727 committed Apr 15, 2016
1 parent 4c6c0ae commit 1fbe29a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PlexRequests.Services/PlexAvailabilityChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ public List<PlexTvShow> GetPlexTvShows()

public bool IsTvShowAvailable(PlexTvShow[] plexShows, string title, string year)
{
return plexShows.Any(x => x.Title.Equals(title, StringComparison.CurrentCultureIgnoreCase) && x.ReleaseYear.Equals(year, StringComparison.CurrentCultureIgnoreCase));
return plexShows.Any(x =>
(x.Title.Equals(title, StringComparison.CurrentCultureIgnoreCase) || x.Title.StartsWith(title, StringComparison.CurrentCultureIgnoreCase)) &&
x.ReleaseYear.Equals(year, StringComparison.CurrentCultureIgnoreCase));
}

public List<PlexAlbum> GetPlexAlbums()
Expand Down

2 comments on commit 1fbe29a

@tidusjar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why StartsWith? Is this likely to bring back false positives?

@Drewster727
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's potential for that, but only if the year is the same as the one we're checking. One example for going with startswith is "House of Cards" -- it was originally a show in the UK, so it shows up in plex as "House of Cards (US)" -- I'm sure there are others like this.

Please sign in to comment.