diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index 11476aa..ae46840 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -842,8 +842,14 @@ public void AddSelectedGenreProperty(string Genres, string sTitle, Utils.Selecte FanartAvailable = FanartAvailable || picFound; } + public void AddSelectedMoviePropertys() + { + AddSelectedMoviePropertys(string.Empty); + } + public void AddSelectedMoviePropertys(string SelectedItem) { + // Movies string strIMDBID = Utils.GetProperty("#imdbnumber"); if (string.IsNullOrEmpty(strIMDBID)) { @@ -856,57 +862,62 @@ public void AddSelectedMoviePropertys(string SelectedItem) // Trakt does not clear the #Trakt.Movie.ImdbId value so exit function when Trakt page and SelectedItem is null, or ClearArt will turn up when it should not if (SelectedItem == "TraktIsNull") + { return; - + } if (string.IsNullOrEmpty(strIMDBID)) { strIMDBID = Utils.GetProperty("#Trakt.Movie.ImdbId"); } - string strTVDBID = Utils.GetProperty("#Trakt.Show.TvdbId"); - if (string.IsNullOrEmpty(strTVDBID)) - { - strTVDBID = Utils.GetProperty("#TVSeries.Series.ID"); - } - //if (string.IsNullOrEmpty(strTVDBID)) - //{ - // // TV Series ID - // strTVDBID = UtilsTVSeries.GetTVSeriesID(50); - //} - if (!string.IsNullOrEmpty(strIMDBID)) { + bool picFound = Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesPoster); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.animated.selected.thumb", - Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesPoster) ? Utils.GetAnimatedFileName(strIMDBID, null, null, Utils.Animated.MoviesPoster) : string.Empty); + picFound ? Utils.GetAnimatedFileName(strIMDBID, null, null, Utils.Animated.MoviesPoster) : string.Empty); + picFound = Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesBackground); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.animated.selected.background", - Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesBackground) ? Utils.GetAnimatedFileName(strIMDBID, null, null, Utils.Animated.MoviesBackground) : string.Empty); + picFound ? Utils.GetAnimatedFileName(strIMDBID, null, null, Utils.Animated.MoviesBackground) : string.Empty); + picFound = Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearArt); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.clearart.selected", - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearArt) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesClearArt) : string.Empty); + picFound ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesClearArt) : string.Empty); + picFound = Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearLogo); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.clearlogo.selected", - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearLogo) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesClearLogo) : string.Empty); + picFound ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesClearLogo) : string.Empty); + picFound = Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesBanner); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.banner.selected", - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) : string.Empty); + picFound ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) : string.Empty); + picFound = Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("movie.cd.selected", - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt) : string.Empty); - FanartAvailable = FanartAvailable || - Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesPoster) || - Utils.AnimatedFileExists(strIMDBID, null, null, Utils.Animated.MoviesBackground) || - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearArt) || - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesClearLogo) || - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) || - Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt); + picFound ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt) : string.Empty); + } + + // TV Series + string strTVDBID = Utils.GetProperty("#Trakt.Show.TvdbId"); + if (string.IsNullOrEmpty(strTVDBID)) + { + strTVDBID = Utils.GetProperty("#TVSeries.Series.ID"); } + if (!string.IsNullOrEmpty(strTVDBID)) { + bool picFound = Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("series.clearart.selected", - Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) : string.Empty); + picFound ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) : string.Empty); + picFound = Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo); + FanartAvailable = FanartAvailable || picFound; Utils.SetProperty("series.clearlogo.selected", - Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo) ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo) : string.Empty); - FanartAvailable = FanartAvailable || - Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) || - Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo); + picFound ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo) : string.Empty); } + if (string.IsNullOrEmpty(strIMDBID) && string.IsNullOrEmpty(strTVDBID)) { ClearSelectedMoviePropertys(); diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index c440517..01964bf 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -2525,10 +2525,10 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA SelectedItem = GetArtistLeftOfMinusSign(SelectedItem); } else if (iActiveWindow == 2003 || // Dialog Video Info - iActiveWindow == 6 || // My Video - iActiveWindow == 25 || // My Video Title - iActiveWindow == 614 || // Dialog Video Artist Info - iActiveWindow == 28 || // My Video Play List + iActiveWindow == 6 || // My Video + iActiveWindow == 25 || // My Video Title + iActiveWindow == 614 || // Dialog Video Artist Info + iActiveWindow == 28 || // My Video Play List iActiveWindow == 99555 // My Video Importer ) { @@ -2584,15 +2584,15 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA } } } - else if (iActiveWindow == 96742) // Moving Pictures + else if (iActiveWindow == 96742) // Moving Pictures { SelectedItem = Utils.GetProperty("#MovingPictures.SelectedMovie.title"); SelectedStudios = Utils.GetProperty("#MovingPictures.SelectedMovie.studios"); SelectedGenre = Utils.GetProperty("#MovingPictures.SelectedMovie.genres"); // logger.Debug("*** "+SelectedItem+" - "+SelectedStudios+" - "+SelectedGenre); } - else if (iActiveWindow == 9811 || // TVSeries - iActiveWindow == 9813) // TVSeries Playlist + else if (iActiveWindow == 9811 || // TVSeries + iActiveWindow == 9813) // TVSeries Playlist { SelectedItem = UtilsTVSeries.GetTVSeriesAttributes(ref SelectedGenre, ref SelectedStudios); if (string.IsNullOrWhiteSpace(SelectedItem)) @@ -2625,7 +2625,7 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA isMusicVideo = true; } } - else if (iActiveWindow == 25650) // Radio Time + else if (iActiveWindow == 25650) // Radio Time { SelectedItem = Utils.GetProperty("#RadioTime.Selected.Subtext"); // Artist - Track || TODO for: Artist - Album - Track SelectedItem = GetArtistLeftOfMinusSign(SelectedItem, true); @@ -2653,18 +2653,18 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA catch { } } else if (iActiveWindow == 87266 || // Trakt Trending Movies - iActiveWindow == 87700 || // Trakt Calendar Movies - iActiveWindow == 87101 || // Trakt Popular Movies - iActiveWindow == 87263 || // Trakt Recommendations Movies - iActiveWindow == 87605 || // Trakt Anticipated Movies - iActiveWindow == 87607 || // Trakt Box Office - iActiveWindow == 87265 || // Trakt Trending Series - iActiveWindow == 87102 || // Trakt Popular Series - iActiveWindow == 87262 || // Trakt Recommendations Series - iActiveWindow == 87259 || // Trakt Calendar Series - iActiveWindow == 87606 || // Trakt Anticipated Series - iActiveWindow == 87281 || // Trakt Series Seasons - iActiveWindow == 87282) // Trakt Series Episodes + iActiveWindow == 87700 || // Trakt Calendar Movies + iActiveWindow == 87101 || // Trakt Popular Movies + iActiveWindow == 87263 || // Trakt Recommendations Movies + iActiveWindow == 87605 || // Trakt Anticipated Movies + iActiveWindow == 87607 || // Trakt Box Office + iActiveWindow == 87265 || // Trakt Trending Series + iActiveWindow == 87102 || // Trakt Popular Series + iActiveWindow == 87262 || // Trakt Recommendations Series + iActiveWindow == 87259 || // Trakt Calendar Series + iActiveWindow == 87606 || // Trakt Anticipated Series + iActiveWindow == 87281 || // Trakt Series Seasons + iActiveWindow == 87282) // Trakt Series Episodes { SelectedItem = Utils.GetProperty("#selecteditem"); // Remove ClearArt on Trakt Folders @@ -2672,16 +2672,16 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA if (window != null) { var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); - if (selectedListItem != null) // (selectedListItem != null || selectedListItem.IsFolder) + if (selectedListItem != null) { if (selectedListItem.IsFolder) + { + GUIControl cntl = window.GetControl(50); + if (cntl is GUIFacadeControl) { - GUIControl cntl = window.GetControl(50); - if (cntl is GUIFacadeControl) - { - SelectedItem = string.Empty; - } + SelectedItem = string.Empty; } + } } else { @@ -2691,7 +2691,9 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA } } else + { SelectedItem = Utils.GetProperty("#selecteditem"); + } SelectedAlbum = (string.IsNullOrWhiteSpace(SelectedAlbum) ? null : SelectedAlbum); SelectedGenre = (string.IsNullOrWhiteSpace(SelectedGenre) ? null : SelectedGenre.Replace(" / ", "|").Replace(", ", "|")); diff --git a/FanartHandler/UtilsTVSeries.cs b/FanartHandler/UtilsTVSeries.cs index 5804ecf..4d79caf 100644 --- a/FanartHandler/UtilsTVSeries.cs +++ b/FanartHandler/UtilsTVSeries.cs @@ -209,32 +209,41 @@ internal static string GetTVSeriesID(string tvSeriesName) // -> TV Series ID .. return result; } - internal static string GetTVSeriesID(int ControlID) // -> TV Series ID ... + internal static string GetTVSeriesID() // -> Selected TV Series ID ... { if (!Utils.TVSeriesEnabled) { return string.Empty; } + if (Utils.iActiveWindow != 9811 && // TVSeries Utils.iActiveWindow != 9813) // TVSeries Playlist { return string.Empty; } - var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); - GUIControl cntl = window.GetControl(50); - if (cntl != null && cntl is GUIFacadeControl) + + try { - GUIListItem selectedListItem = (cntl as GUIFacadeControl).SelectedListItem; - if (selectedListItem != null) - { - DBSeries series = selectedListItem.TVTag as DBSeries; - if (series != null) + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + GUIControl cntl = window.GetControl(50); // 50 - GUIFacadeControl + if (cntl != null && cntl is GUIFacadeControl) + { + GUIListItem selectedListItem = (cntl as GUIFacadeControl).SelectedListItem; + if (selectedListItem != null) { - return series[DBOnlineSeries.cID]; + DBSeries series = selectedListItem.TVTag as DBSeries; + if (series != null) + { + return series[DBOnlineSeries.cID]; + } } - } + } } - return string.Empty; + catch (Exception ex) + { + logger.Error("GetTVSeriesID: " + ex); + } + return string.Empty; } internal static string GetTVSeriesAttributes(GUIListItem currentitem, ref string sGenre, ref string sStudio) // -> TV Series name ...