internal static void CheckAndPlayFirstUnwatchedEpisode(TraktShowSummary show, bool jumpTo)
{
if (show == null) return;
CurrentMediaType = MediaType.Show;
CurrentShow = show;
// check for parental controls
if (PromptForPinCode)
{
if (!GUIUtils.ShowPinCodeDialog(TraktSettings.ParentalControlsPinCode))
{
TraktLogger.Warning("Parental controls pin code has not successfully been entered. Window ID = {0}", GUIWindowManager.ActiveWindow);
return;
}
}
TraktLogger.Info("Attempting to play episodes for tv show. TVDb ID = '{0}', IMDb ID = '{1}'", show.Ids.Tvdb.ToLogString(), show.Ids.Imdb.ToLogString());
bool handled = false;
// check if plugin is installed and enabled
if (TraktHelper.IsMPTVSeriesAvailableAndEnabled)
{
if (jumpTo)
{
TraktLogger.Info("Looking for tv shows in MP-TVSeries database");
if (TraktHandlers.TVSeries.SeriesExists(show.Ids.Tvdb.GetValueOrDefault()))
{
string loadingParameter = string.Format("seriesid:{0}", show.Ids.Tvdb.GetValueOrDefault());
GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.TVSeries, loadingParameter);
handled = true;
}
}
else
{
// Play episode if it exists
TraktLogger.Info("Checking if any episodes to watch in MP-TVSeries");
handled = TraktHandlers.TVSeries.PlayFirstUnwatchedEpisode(show.Ids.Tvdb.GetValueOrDefault());
}
}
if (TraktHelper.IsTrailersAvailableAndEnabled && handled == false)
{
TraktLogger.Info("There were no episodes found in local plugin databases. Attempting to search and/or play trailer(s) from the Trailers plugin");
ShowTVShowTrailersPluginMenu(show);
handled = true;
}
}