From f12e11a9045de9ec114b6120e5d0ae8d538560d6 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Sun, 21 Apr 2024 11:45:20 +1000 Subject: [PATCH 1/9] Update for Trakt to use FanartHandler ClearArt paths for Movies --- FanartHandler/FanartSelectedOther.cs | 22 ++++++++++++++++++++++ FanartHandler/Utils.cs | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index c3bd9c5..b190372 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -151,6 +151,15 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st } AddSelectedGenreProperty(SelectedGenre, SelectedItem, property); + // Trakt remove ClearArt for pages + if (SelectedItem == "Next Page" || + SelectedItem == "Previous Page" || + SelectedItem.StartsWith("Next ") && SelectedItem.EndsWith(" Days") || + SelectedItem.StartsWith("Previous ") && SelectedItem.EndsWith(" Days")) + { + IsSelectedVideo = true; + } + if (isVideo) { AddSelectedMoviePropertys(); @@ -304,6 +313,15 @@ public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventA Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie)) { IsSelectedVideo = true; + if (Utils.iActiveWindow == 87266 || // Trakt Trending Movies + Utils.iActiveWindow == 87700 || // Trakt Calendar Movies + Utils.iActiveWindow == 87101 || // Trakt Popular Movies + Utils.iActiveWindow == 87263 || // Trakt Recommendations Movies + Utils.iActiveWindow == 87605 || // Trakt Anticipated Movies + Utils.iActiveWindow == 87607) // Trakt Box Office + { + IsSelectedVideo = false; + } RefreshGenericSelectedProperties(Utils.SelectedType.Movie, ref CurrSelectedMovie, ref CurrSelectedMovieTitle); @@ -849,6 +867,10 @@ public void AddSelectedMoviePropertys() { strIMDBID = Utils.GetProperty("#myfilms.db.imdb_id.value"); } + if (string.IsNullOrEmpty(strIMDBID)) + { + strIMDBID = Utils.GetProperty("#Trakt.Movie.ImdbId"); + } if (!string.IsNullOrEmpty(strIMDBID)) { diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index 9fd7c47..06644c7 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -2568,7 +2568,7 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA } else if (iActiveWindow == 96742) // Moving Pictures { - SelectedItem = Utils.GetProperty("#selecteditem"); + SelectedItem = Utils.GetProperty("#MovingPictures.SelectedMovie.title"); SelectedStudios = Utils.GetProperty("#MovingPictures.SelectedMovie.studios"); SelectedGenre = Utils.GetProperty("#MovingPictures.SelectedMovie.genres"); // logger.Debug("*** "+SelectedItem+" - "+SelectedStudios+" - "+SelectedGenre); From 126aef93518bea27f84c4880d81c858f366e9fb3 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Sun, 21 Apr 2024 18:17:56 +1000 Subject: [PATCH 2/9] Clear Movie imdb value for page navigation to avoid clearart from appearing on page navigation when options selected --- FanartHandler/FanartSelectedOther.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index b190372..e4238d9 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -147,6 +147,7 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st if (!string.IsNullOrEmpty(selectedTitle)) { SelectedItem = selectedTitle; + Utils.SetProperty("#Trakt.Movie.ImdbId",""); } } AddSelectedGenreProperty(SelectedGenre, SelectedItem, property); From 95f534adef6144205e8b9d3f46b270ef85fe5e6a Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Sun, 21 Apr 2024 18:29:19 +1000 Subject: [PATCH 3/9] Clear Trakt movie imdb on page nav --- FanartHandler/FanartSelectedOther.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index e4238d9..a7249b2 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -159,6 +159,7 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st SelectedItem.StartsWith("Previous ") && SelectedItem.EndsWith(" Days")) { IsSelectedVideo = true; + Utils.SetProperty("#Trakt.Movie.ImdbId",""); } if (isVideo) From ba31a4d5f46322022cfa747a70779e7f1edb4cbd Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Sun, 21 Apr 2024 18:31:44 +1000 Subject: [PATCH 4/9] Fix mistake I just made --- FanartHandler/FanartSelectedOther.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index a7249b2..3279358 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -147,7 +147,6 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st if (!string.IsNullOrEmpty(selectedTitle)) { SelectedItem = selectedTitle; - Utils.SetProperty("#Trakt.Movie.ImdbId",""); } } AddSelectedGenreProperty(SelectedGenre, SelectedItem, property); From b7e3f4547b7a2a9eb4e220bfa658fc6240b10237 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Tue, 23 Apr 2024 00:03:44 +1000 Subject: [PATCH 5/9] Added TV Series ClearArt and fixed issues --- FanartHandler/FanartSelectedOther.cs | 55 +++++++++++++++++++++------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index 3279358..f5ee0cc 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -152,18 +152,25 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st AddSelectedGenreProperty(SelectedGenre, SelectedItem, property); // Trakt remove ClearArt for pages - if (SelectedItem == "Next Page" || - SelectedItem == "Previous Page" || - SelectedItem.StartsWith("Next ") && SelectedItem.EndsWith(" Days") || - SelectedItem.StartsWith("Previous ") && SelectedItem.EndsWith(" Days")) + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + if (window != null) { - IsSelectedVideo = true; - Utils.SetProperty("#Trakt.Movie.ImdbId",""); - } - - if (isVideo) - { - AddSelectedMoviePropertys(); + var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); + if (selectedListItem != null) + { + if (selectedListItem.IsFolder) + { + IsSelectedVideo = true; + ClearSelectedMoviePropertys(); + } + else + { + if (isVideo) + { + AddSelectedMoviePropertys(); + } + } + } } ResetRefreshTickCount(); @@ -319,7 +326,14 @@ public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventA Utils.iActiveWindow == 87101 || // Trakt Popular Movies Utils.iActiveWindow == 87263 || // Trakt Recommendations Movies Utils.iActiveWindow == 87605 || // Trakt Anticipated Movies - Utils.iActiveWindow == 87607) // Trakt Box Office + Utils.iActiveWindow == 87607 || // Trakt Box Office + Utils.iActiveWindow == 87265 || // Trakt Trending Series + Utils.iActiveWindow == 87102 || // Trakt Popular Series + Utils.iActiveWindow == 87262 || // Trakt Recommendations Series + Utils.iActiveWindow == 87259 || // Trakt Calendar Series + Utils.iActiveWindow == 87606 || // Trakt Anticipated Series + Utils.iActiveWindow == 87281 || // Trakt Series Seasons + Utils.iActiveWindow == 87282) // Trakt Series Episodes { IsSelectedVideo = false; } @@ -872,6 +886,11 @@ public void AddSelectedMoviePropertys() { 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(strIMDBID)) { @@ -889,7 +908,14 @@ public void AddSelectedMoviePropertys() Utils.SetProperty("movie.cd.selected", Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesCDArt) : string.Empty); } - else + if (!string.IsNullOrEmpty(strTVDBID)) + { + Utils.SetProperty("series.clearart.selected", + Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) : string.Empty); + Utils.SetProperty("series.clearlogo.selected", + Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo) ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearLogo) : string.Empty); + } + if (string.IsNullOrEmpty(strIMDBID) && string.IsNullOrEmpty(strTVDBID)) { ClearSelectedMoviePropertys(); } @@ -903,6 +929,9 @@ public void ClearSelectedMoviePropertys() Utils.SetProperty("movie.clearlogo.selected", string.Empty); Utils.SetProperty("movie.banner.selected", string.Empty); Utils.SetProperty("movie.cd.selected", string.Empty); + + Utils.SetProperty("series.clearart.selected", string.Empty); + Utils.SetProperty("series.clearlogo.selected", string.Empty); } private void EmptyMusicProperties(bool currClean = true) From cf5dfed0b1fb1988d4939387463cda4a25fee279 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Wed, 24 Apr 2024 22:46:14 +1000 Subject: [PATCH 6/9] Updated to fix TVSeries and more --- FanartHandler/FanartHandler.cs | 29 +++++++---- FanartHandler/FanartSelectedOther.cs | 72 ++++++++++++++-------------- FanartHandler/Utils.cs | 26 ++++++++++ 3 files changed, 83 insertions(+), 44 deletions(-) diff --git a/FanartHandler/FanartHandler.cs b/FanartHandler/FanartHandler.cs index cdcae1d..3731f9b 100644 --- a/FanartHandler/FanartHandler.cs +++ b/FanartHandler/FanartHandler.cs @@ -810,6 +810,7 @@ internal void Start() Utils.Check(FSelected.WindowsUsingFanartSelectedPictures.Count > 0) + " Pictures Fanart, " + Utils.Check(FSelected.WindowsUsingFanartSelectedScoreCenter.Count > 0) + " ScoreCenter Fanart"); logger.Debug(" " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedClearArtMusic.Count > 0) + " Music ClearArt, " + + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedClearArtMovie.Count > 0) + " Movie ClearArt, " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedGenreMusic.Count > 0) + " Music Genres, " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedLabelMusic.Count > 0) + " Music Labels"); logger.Debug(" " + Utils.Check(FSelectedOther.WindowsUsingFanartSelectedStudioMovie.Count > 0) + " Movie Studios, " + @@ -1643,6 +1644,7 @@ private void SetupWindowsUsingFanartHandlerVisibility(string SkinDir = (string) var _flagClearArt = false; var _flagClearArtPlay = false; + var _flagClearArtMovies = false; var _flagLabelMusic = false; var _flagLabelPlay = false; @@ -1666,7 +1668,7 @@ private void SetupWindowsUsingFanartHandlerVisibility(string SkinDir = (string) ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1690,7 +1692,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1709,7 +1711,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1730,7 +1732,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1759,7 +1761,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1778,7 +1780,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1799,7 +1801,7 @@ ref skinFile ref _flag1Movie, ref _flag2Movie, ref _flag1Picture, ref _flag2Picture, ref _flagPlay, - ref _flagClearArt, ref _flagClearArtPlay, + ref _flagClearArt, ref _flagClearArtPlay, ref _flagClearArtMovies, ref _flagGenrePlay, ref _flagGenrePlaySingle, ref _flagGenrePlayAll, ref _flagGenrePlayVertical, ref _flagGenreMusic, ref _flagGenreMusicSingle, ref _flagGenreMusicAll, ref _flagGenreMusicVertical, ref _flagGenreMovie, ref _flagGenreMovieSingle, ref _flagGenreMovieAll, ref _flagGenreMovieVertical, @@ -1848,6 +1850,11 @@ ref skinFile { FSelectedOther.WindowsUsingFanartSelectedClearArtMusic.Add(nodeValue, nodeValue); } + // Selected Movie ClearArt + if (_flagClearArtMovies && !Utils.ContainsID(FSelectedOther.WindowsUsingFanartSelectedClearArtMovie, nodeValue)) + { + FSelectedOther.WindowsUsingFanartSelectedClearArtMovie.Add(nodeValue, nodeValue); + } #endregion #region Labels @@ -2047,7 +2054,7 @@ private void HandleXmlImports(string filename, string windowId, ref bool _flag1Movie, ref bool _flag2Movie, ref bool _flag1Picture, ref bool _flag2Picture, ref bool _flagPlay, - ref bool _flagClearArt, ref bool _flagClearArtPlay, + ref bool _flagClearArt, ref bool _flagClearArtPlay, ref bool _flagClearArtMovies, ref bool _flagGenrePlay, ref bool _flagGenrePlaySingle, ref bool _flagGenrePlayAll, ref bool _flagGenrePlayVertical, ref bool _flagGenreMusic, ref bool _flagGenreMusicSingle, ref bool _flagGenreMusicAll, ref bool _flagGenreMusicVertical, ref bool _flagGenreMovie, ref bool _flagGenreMovieSingle, ref bool _flagGenreMovieAll, ref bool _flagGenreMovieVertical, @@ -2136,6 +2143,12 @@ private void HandleXmlImports(string filename, string windowId, _flagClearArt = true; } + // ClearArt Movies + if (_xml.Contains("#fanarthandler.movie.clearart.selected") || _xml.Contains("#fanarthandler.movie.clearlogo.selected") || _xml.Contains("#fanarthandler.movie.cd.selected") || _xml.Contains("#fanarthandler.series.clearart.selected") || _xml.Contains("#fanarthandler.series.clearlogo.selected")) + { + _flagClearArtMovies = true; + } + // Labels if (_xml.Contains("#fanarthandler.music.labels.selected")) { diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index f5ee0cc..ad425fd 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using WindowPlugins.GUITVSeries; namespace FanartHandler { @@ -38,6 +39,7 @@ internal class FanartSelectedOther public int RefreshTickCount { get; set; } public Hashtable WindowsUsingFanartSelectedClearArtMusic { get; set; } + public Hashtable WindowsUsingFanartSelectedClearArtMovie { get; set; } public Hashtable WindowsUsingFanartSelectedGenreMusic { get; set; } public Hashtable WindowsUsingFanartSelectedLabelMusic { get; set; } @@ -62,6 +64,7 @@ public FanartSelectedOther() RefreshTickCount = 0; WindowsUsingFanartSelectedClearArtMusic = new Hashtable(); + WindowsUsingFanartSelectedClearArtMovie = new Hashtable(); WindowsUsingFanartSelectedGenreMusic = new Hashtable(); WindowsUsingFanartSelectedLabelMusic = new Hashtable(); @@ -97,6 +100,7 @@ public bool CheckValidWindowIDForFanart() Utils.ContainsID(WindowsUsingFanartSelectedGenreMovie) || Utils.ContainsID(WindowsUsingFanartSelectedStudioMovie) || Utils.ContainsID(WindowsUsingFanartSelectedClearArtMusic) || + Utils.ContainsID(WindowsUsingFanartSelectedClearArtMovie) || Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie) ); } @@ -151,26 +155,10 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st } AddSelectedGenreProperty(SelectedGenre, SelectedItem, property); - // Trakt remove ClearArt for pages - var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); - if (window != null) + if (isVideo) { - var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); - if (selectedListItem != null) - { - if (selectedListItem.IsFolder) - { - IsSelectedVideo = true; - ClearSelectedMoviePropertys(); - } - else - { - if (isVideo) - { - AddSelectedMoviePropertys(); - } - } - } + Console.WriteLine(Utils.iActiveWindow.ToString()); + AddSelectedMoviePropertys(); } ResetRefreshTickCount(); @@ -318,25 +306,10 @@ public void RefreshSelected(RefreshWorker rw, System.ComponentModel.DoWorkEventA { if (Utils.ContainsID(WindowsUsingFanartSelectedGenreMovie) || Utils.ContainsID(WindowsUsingFanartSelectedStudioMovie) || - Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie)) + Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie) || + Utils.ContainsID(WindowsUsingFanartSelectedClearArtMovie)) { IsSelectedVideo = true; - if (Utils.iActiveWindow == 87266 || // Trakt Trending Movies - Utils.iActiveWindow == 87700 || // Trakt Calendar Movies - Utils.iActiveWindow == 87101 || // Trakt Popular Movies - Utils.iActiveWindow == 87263 || // Trakt Recommendations Movies - Utils.iActiveWindow == 87605 || // Trakt Anticipated Movies - Utils.iActiveWindow == 87607 || // Trakt Box Office - Utils.iActiveWindow == 87265 || // Trakt Trending Series - Utils.iActiveWindow == 87102 || // Trakt Popular Series - Utils.iActiveWindow == 87262 || // Trakt Recommendations Series - Utils.iActiveWindow == 87259 || // Trakt Calendar Series - Utils.iActiveWindow == 87606 || // Trakt Anticipated Series - Utils.iActiveWindow == 87281 || // Trakt Series Seasons - Utils.iActiveWindow == 87282) // Trakt Series Episodes - { - IsSelectedVideo = false; - } RefreshGenericSelectedProperties(Utils.SelectedType.Movie, ref CurrSelectedMovie, ref CurrSelectedMovieTitle); @@ -891,6 +864,23 @@ public void AddSelectedMoviePropertys() { strTVDBID = Utils.GetProperty("#TVSeries.Series.ID"); } + if (string.IsNullOrEmpty(strTVDBID)) + { + // TV Series ID + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + if (window != null) + { + var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); + if (selectedListItem != null) + { + DBSeries series = selectedListItem.TVTag as DBSeries; + if (series != null) + { + strTVDBID = series[DBOnlineSeries.cID]; + } + } + } + } if (!string.IsNullOrEmpty(strIMDBID)) { @@ -907,6 +897,13 @@ public void AddSelectedMoviePropertys() Utils.FanartTVFileExists(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) ? Utils.GetFanartTVFileName(strIMDBID, null, null, Utils.FanartTV.MoviesBanner) : string.Empty); 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); } if (!string.IsNullOrEmpty(strTVDBID)) { @@ -914,6 +911,9 @@ public void AddSelectedMoviePropertys() Utils.FanartTVFileExists(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) ? Utils.GetFanartTVFileName(strTVDBID, null, null, Utils.FanartTV.SeriesClearArt) : string.Empty); 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); } if (string.IsNullOrEmpty(strIMDBID) && string.IsNullOrEmpty(strTVDBID)) { diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index 06644c7..891934c 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -2634,6 +2634,32 @@ 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 + { + SelectedItem = Utils.GetProperty("#selecteditem"); + // Remove ClearArt on Trakt Folders + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + if (window != null) + { + var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); + if (selectedListItem == null || selectedListItem.IsFolder) + { + SelectedItem = string.Empty; + } + } + } else SelectedItem = Utils.GetProperty("#selecteditem"); From 4d1e117d1046b6fd88977373f195736f387a951f Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Thu, 25 Apr 2024 14:36:37 +1000 Subject: [PATCH 7/9] Bug fixes --- FanartHandler/FanartSelectedOther.cs | 29 ++++++++++++++++------------ FanartHandler/Utils.cs | 11 +++++++++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index ad425fd..6025a9e 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -157,7 +157,6 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st if (isVideo) { - Console.WriteLine(Utils.iActiveWindow.ToString()); AddSelectedMoviePropertys(); } @@ -855,10 +854,21 @@ public void AddSelectedMoviePropertys() { strIMDBID = Utils.GetProperty("#myfilms.db.imdb_id.value"); } + + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + GUIListItem selectedListItem = null; + if (window != null) + { + selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); + if (selectedListItem == null && string.IsNullOrEmpty(strIMDBID)) + return; + } + if (string.IsNullOrEmpty(strIMDBID)) { strIMDBID = Utils.GetProperty("#Trakt.Movie.ImdbId"); } + string strTVDBID = Utils.GetProperty("#Trakt.Show.TvdbId"); if (string.IsNullOrEmpty(strTVDBID)) { @@ -867,18 +877,13 @@ public void AddSelectedMoviePropertys() if (string.IsNullOrEmpty(strTVDBID)) { // TV Series ID - var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); - if (window != null) + if (selectedListItem != null) { - var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); - if (selectedListItem != null) - { - DBSeries series = selectedListItem.TVTag as DBSeries; - if (series != null) - { - strTVDBID = series[DBOnlineSeries.cID]; - } - } + DBSeries series = selectedListItem.TVTag as DBSeries; + if (series != null) + { + strTVDBID = series[DBOnlineSeries.cID]; + } } } diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index 891934c..b68710e 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -2654,9 +2654,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.IsFolder) + if (selectedListItem != null) { - SelectedItem = string.Empty; + if (selectedListItem.IsFolder) + { + GUIControl cntl = window.GetControl(50); + if (cntl is GUIFacadeControl) + { + SelectedItem = string.Empty; + } + } } } } From 9469ae4b6068a17a97f232b10dc2c5d7cc754512 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Thu, 25 Apr 2024 21:08:20 +1000 Subject: [PATCH 8/9] Updated MovingPictures clearart paths --- FanartHandler/Utils.cs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index b68710e..f7a06df 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -823,7 +823,13 @@ public static void InitFolders() { MoviesClearArtFolder = Path.Combine(MPThumbsFolder, @"Movies\ClearArt\FullSize\"); // DVDArt if (!Directory.Exists(MoviesClearArtFolder) || IsDirectoryEmpty(MoviesClearArtFolder)) - MoviesClearArtFolder = string.Empty; + { + MoviesClearArtFolder = Path.Combine(MPThumbsFolder, @"MovingPictures\ClearArt\FullSize\"); // Moving Pictures + if (!Directory.Exists(MoviesClearArtFolder) || IsDirectoryEmpty(MoviesClearArtFolder)) + { + MoviesClearArtFolder = string.Empty; + } + } } if (!string.IsNullOrEmpty(MoviesClearArtFolder)) { @@ -847,7 +853,13 @@ public static void InitFolders() { MoviesCDArtFolder = Path.Combine(MPThumbsFolder, @"Movies\DVDArt\FullSize\"); // DVDArt if (!Directory.Exists(MoviesCDArtFolder) || IsDirectoryEmpty(MoviesCDArtFolder)) - MoviesCDArtFolder = string.Empty; + { + MoviesCDArtFolder = Path.Combine(MPThumbsFolder, @"MovingPictures\DVDArt\FullSize\"); // Moving Pictures + if (!Directory.Exists(MoviesCDArtFolder) || IsDirectoryEmpty(MoviesCDArtFolder)) + { + MoviesCDArtFolder = string.Empty; + } + } } if (!string.IsNullOrEmpty(MoviesCDArtFolder)) { @@ -859,7 +871,13 @@ public static void InitFolders() { MoviesClearLogoFolder = Path.Combine(MPThumbsFolder, @"Movies\ClearLogo\FullSize\"); // DVDArt if (!Directory.Exists(MoviesClearLogoFolder) || IsDirectoryEmpty(MoviesClearLogoFolder)) - MoviesClearLogoFolder = string.Empty; + { + MoviesClearLogoFolder = Path.Combine(MPThumbsFolder, @"MovingPictures\ClearLogo\FullSize\"); // Moving Pictures + if (!Directory.Exists(MoviesClearLogoFolder) || IsDirectoryEmpty(MoviesClearLogoFolder)) + { + MoviesClearLogoFolder = string.Empty; + } + } } if (!string.IsNullOrEmpty(MoviesClearLogoFolder)) { From d9bdb7f550edde9d80ea952709377ee0ab9fa7c8 Mon Sep 17 00:00:00 2001 From: KJ-Cox Date: Fri, 26 Apr 2024 01:48:05 +1000 Subject: [PATCH 9/9] Updates --- FanartHandler/FanartSelectedOther.cs | 33 +++++++++------------------- FanartHandler/Utils.cs | 33 ++++++++++++++++------------ FanartHandler/UtilsTVSeries.cs | 28 +++++++++++++++++++++++ 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/FanartHandler/FanartSelectedOther.cs b/FanartHandler/FanartSelectedOther.cs index 6025a9e..11476aa 100644 --- a/FanartHandler/FanartSelectedOther.cs +++ b/FanartHandler/FanartSelectedOther.cs @@ -13,7 +13,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using WindowPlugins.GUITVSeries; namespace FanartHandler { @@ -157,7 +156,7 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st if (isVideo) { - AddSelectedMoviePropertys(); + AddSelectedMoviePropertys(SelectedItem); } ResetRefreshTickCount(); @@ -843,7 +842,7 @@ public void AddSelectedGenreProperty(string Genres, string sTitle, Utils.Selecte FanartAvailable = FanartAvailable || picFound; } - public void AddSelectedMoviePropertys() + public void AddSelectedMoviePropertys(string SelectedItem) { string strIMDBID = Utils.GetProperty("#imdbnumber"); if (string.IsNullOrEmpty(strIMDBID)) @@ -855,14 +854,9 @@ public void AddSelectedMoviePropertys() strIMDBID = Utils.GetProperty("#myfilms.db.imdb_id.value"); } - var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); - GUIListItem selectedListItem = null; - if (window != null) - { - selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); - if (selectedListItem == null && string.IsNullOrEmpty(strIMDBID)) - return; - } + // 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)) { @@ -874,18 +868,11 @@ public void AddSelectedMoviePropertys() { strTVDBID = Utils.GetProperty("#TVSeries.Series.ID"); } - if (string.IsNullOrEmpty(strTVDBID)) - { - // TV Series ID - if (selectedListItem != null) - { - DBSeries series = selectedListItem.TVTag as DBSeries; - if (series != null) - { - strTVDBID = series[DBOnlineSeries.cID]; - } - } - } + //if (string.IsNullOrEmpty(strTVDBID)) + //{ + // // TV Series ID + // strTVDBID = UtilsTVSeries.GetTVSeriesID(50); + //} if (!string.IsNullOrEmpty(strIMDBID)) { diff --git a/FanartHandler/Utils.cs b/FanartHandler/Utils.cs index f7a06df..c440517 100644 --- a/FanartHandler/Utils.cs +++ b/FanartHandler/Utils.cs @@ -2666,24 +2666,29 @@ public static void GetSelectedItem(ref string SelectedItem, ref string SelectedA iActiveWindow == 87281 || // Trakt Series Seasons iActiveWindow == 87282) // Trakt Series Episodes { - SelectedItem = Utils.GetProperty("#selecteditem"); - // Remove ClearArt on Trakt Folders - var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); - if (window != null) + SelectedItem = Utils.GetProperty("#selecteditem"); + // Remove ClearArt on Trakt Folders + var window = GUIWindowManager.GetWindow(Utils.iActiveWindow); + if (window != null) + { + var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); + if (selectedListItem != null) // (selectedListItem != null || selectedListItem.IsFolder) { - var selectedListItem = GUIControl.GetSelectedListItem(Utils.iActiveWindow, window.GetFocusControlId()); - if (selectedListItem != null) + if (selectedListItem.IsFolder) { - if (selectedListItem.IsFolder) - { - GUIControl cntl = window.GetControl(50); - if (cntl is GUIFacadeControl) - { - SelectedItem = string.Empty; - } - } + GUIControl cntl = window.GetControl(50); + if (cntl is GUIFacadeControl) + { + SelectedItem = string.Empty; + } } } + else + { + // Trakt menu is a null SelectedItem but we dont want to clear the SelectedItem when a movie is selected + SelectedItem = "TraktIsNull"; + } + } } else SelectedItem = Utils.GetProperty("#selecteditem"); diff --git a/FanartHandler/UtilsTVSeries.cs b/FanartHandler/UtilsTVSeries.cs index 9aa3ce5..5804ecf 100644 --- a/FanartHandler/UtilsTVSeries.cs +++ b/FanartHandler/UtilsTVSeries.cs @@ -209,6 +209,34 @@ internal static string GetTVSeriesID(string tvSeriesName) // -> TV Series ID .. return result; } + internal static string GetTVSeriesID(int ControlID) // -> 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) + { + GUIListItem selectedListItem = (cntl as GUIFacadeControl).SelectedListItem; + if (selectedListItem != null) + { + DBSeries series = selectedListItem.TVTag as DBSeries; + if (series != null) + { + return series[DBOnlineSeries.cID]; + } + } + } + return string.Empty; + } + internal static string GetTVSeriesAttributes(GUIListItem currentitem, ref string sGenre, ref string sStudio) // -> TV Series name ... { if (!Utils.TVSeriesEnabled)