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)