/// <summary>
        /// Tries to populate any empty fanart types in the specified <see cref="FanArtPathCollection"/> with image paths
        /// contained in <paramref name="potentialFanArtFiles"/> that start with 'season-all', 'season{<paramref name="seasonNumber"/>}'
        /// or, if <paramref name="seasonNumber"/> is 0, 'season-specials'.
        /// </summary>
        /// <param name="paths">The <see cref="FanArtPathCollection"/> to add matching paths to.</param>
        /// <param name="potentialFanArtFiles">Collection of potential fanart paths.</param>
        /// <param name="seasonNumber">The season number.</param>
        protected void GetAdditionalSeasonFolderFanArt(FanArtPathCollection paths, ICollection <ResourcePath> potentialFanArtFiles, int?seasonNumber)
        {
            if (!seasonNumber.HasValue)
            {
                return;
            }
            if (potentialFanArtFiles == null || potentialFanArtFiles.Count == 0)
            {
                return;
            }

            string[] prefixes = LocalFanartHelper.GetAdditionalSeasonPrefixes(seasonNumber);

            if (paths.Count(FanArtTypes.Thumbnail) == 0)
            {
                paths.AddRange(FanArtTypes.Thumbnail, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                         LocalFanartHelper.THUMB_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Poster) == 0)
            {
                paths.AddRange(FanArtTypes.Poster, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                      LocalFanartHelper.POSTER_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Logo) == 0)
            {
                paths.AddRange(FanArtTypes.Logo, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                    LocalFanartHelper.LOGO_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.ClearArt) == 0)
            {
                paths.AddRange(FanArtTypes.ClearArt, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                        LocalFanartHelper.CLEARART_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.DiscArt) == 0)
            {
                paths.AddRange(FanArtTypes.DiscArt, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                       LocalFanartHelper.DISCART_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Banner) == 0)
            {
                paths.AddRange(FanArtTypes.Banner, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                      LocalFanartHelper.BANNER_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.FanArt) == 0)
            {
                paths.AddRange(FanArtTypes.FanArt, LocalFanartHelper.FilterPotentialFanArtFilesByPrefix(potentialFanArtFiles,
                                                                                                        LocalFanartHelper.BACKDROP_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }
        }
예제 #2
0
        /// <summary>
        /// Tries to populate any empty fanart types in the specified <see cref="FanArtPathCollection"/> with image paths
        /// contained in <paramref name="potentialFanArtFiles"/> that start with 'season-all', 'season{<paramref name="seasonNumber"/>}'
        /// or, if <paramref name="seasonNumber"/> is 0, 'season-specials'.
        /// </summary>
        /// <param name="paths">The <see cref="FanArtPathCollection"/> to add matching paths to.</param>
        /// <param name="potentialFanArtFiles">Collection of potential fanart paths.</param>
        /// <param name="seasonNumber">The season number.</param>
        protected void GetAdditionalSeasonFolderFanArt(FanArtPathCollection paths, ICollection <ResourcePath> potentialFanArtFiles, int seasonNumber)
        {
            if (potentialFanArtFiles == null || potentialFanArtFiles.Count == 0)
            {
                return;
            }

            string[] prefixes = new[]
            {
                string.Format("season{0:00}", seasonNumber),
                seasonNumber == 0 ? "season-specials" : "season-all"
            };

            if (paths.Count(FanArtTypes.Thumbnail) == 0)
            {
                paths.AddRange(FanArtTypes.Thumbnail, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                         LocalFanartHelper.THUMB_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Poster) == 0)
            {
                paths.AddRange(FanArtTypes.Poster, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                      LocalFanartHelper.POSTER_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Logo) == 0)
            {
                paths.AddRange(FanArtTypes.Logo, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                    LocalFanartHelper.LOGO_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.ClearArt) == 0)
            {
                paths.AddRange(FanArtTypes.ClearArt, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                        LocalFanartHelper.CLEARART_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.DiscArt) == 0)
            {
                paths.AddRange(FanArtTypes.DiscArt, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                       LocalFanartHelper.DISCART_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.Banner) == 0)
            {
                paths.AddRange(FanArtTypes.Banner, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                      LocalFanartHelper.BANNER_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }

            if (paths.Count(FanArtTypes.FanArt) == 0)
            {
                paths.AddRange(FanArtTypes.FanArt, LocalFanartHelper.FilterPotentialFanArtFilesByName(potentialFanArtFiles,
                                                                                                      LocalFanartHelper.BACKDROP_FILENAMES.SelectMany(f => prefixes.Select(p => p + "-" + f))));
            }
        }