Skip to content

Commit

Permalink
Update for Trakt to use FanartHandler ClearArt paths for Movies (#1)
Browse files Browse the repository at this point in the history
* Update for Trakt to use FanartHandler ClearArt paths for Movies
* Clear Movie imdb value for page navigation to avoid clearart from appearing on page navigation when options selected
* Clear Trakt movie imdb on page nav
* Added TV Series ClearArt and fixed issues
* Updated to fix TVSeries and more
* Bug fixes
* Updated MovingPictures clearart paths
* Updates
  • Loading branch information
KJ-Cox authored Apr 25, 2024
1 parent 0300c02 commit ce13e3a
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 16 deletions.
29 changes: 21 additions & 8 deletions FanartHandler/FanartHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, " +
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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"))
{
Expand Down
52 changes: 48 additions & 4 deletions FanartHandler/FanartSelectedOther.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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; }
Expand All @@ -62,6 +63,7 @@ public FanartSelectedOther()
RefreshTickCount = 0;

WindowsUsingFanartSelectedClearArtMusic = new Hashtable();
WindowsUsingFanartSelectedClearArtMovie = new Hashtable();

WindowsUsingFanartSelectedGenreMusic = new Hashtable();
WindowsUsingFanartSelectedLabelMusic = new Hashtable();
Expand Down Expand Up @@ -97,6 +99,7 @@ public bool CheckValidWindowIDForFanart()
Utils.ContainsID(WindowsUsingFanartSelectedGenreMovie) ||
Utils.ContainsID(WindowsUsingFanartSelectedStudioMovie) ||
Utils.ContainsID(WindowsUsingFanartSelectedClearArtMusic) ||
Utils.ContainsID(WindowsUsingFanartSelectedClearArtMovie) ||
Utils.ContainsID(WindowsUsingFanartSelectedAwardMovie)
);
}
Expand Down Expand Up @@ -153,7 +156,7 @@ public void RefreshGenericSelectedProperties(Utils.SelectedType property, ref st

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

ResetRefreshTickCount();
Expand Down Expand Up @@ -301,7 +304,8 @@ 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;
RefreshGenericSelectedProperties(Utils.SelectedType.Movie,
Expand Down Expand Up @@ -838,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 @@ -850,6 +854,26 @@ public void AddSelectedMoviePropertys()
strIMDBID = Utils.GetProperty("#myfilms.db.imdb_id.value");
}

// 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))
{
Utils.SetProperty("movie.animated.selected.thumb",
Expand All @@ -865,8 +889,25 @@ 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);
}
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);
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))
{
ClearSelectedMoviePropertys();
}
Expand All @@ -880,6 +921,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)
Expand Down
Loading

0 comments on commit ce13e3a

Please sign in to comment.