Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KJ-Cox committed Apr 25, 2024
1 parent 9469ae4 commit d9bdb7f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 37 deletions.
33 changes: 10 additions & 23 deletions FanartHandler/FanartSelectedOther.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using WindowPlugins.GUITVSeries;

namespace FanartHandler
{
Expand Down Expand Up @@ -157,7 +156,7 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st

if (isVideo)
{
AddSelectedMoviePropertys();
AddSelectedMoviePropertys(SelectedItem);
}

ResetRefreshTickCount();
Expand Down Expand Up @@ -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))
Expand All @@ -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))
{
Expand All @@ -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))
{
Expand Down
33 changes: 19 additions & 14 deletions FanartHandler/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
28 changes: 28 additions & 0 deletions FanartHandler/UtilsTVSeries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d9bdb7f

Please sign in to comment.