Ejemplo n.º 1
0
        /// <inheritdoc />
        public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
        {
            // Don't ignore application folders
            if (fileInfo.FullName.Contains(_serverApplicationPaths.RootFolderPath, StringComparison.InvariantCulture))
            {
                return(false);
            }

            // Don't ignore top level folders
            if (fileInfo.IsDirectory && parent is AggregateFolder)
            {
                return(false);
            }

            if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
            {
                return(true);
            }

            var filename = fileInfo.Name;

            if (fileInfo.IsDirectory)
            {
                if (parent != null)
                {
                    // Ignore trailer folders but allow it at the collection level
                    if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase) &&
                        !(parent is AggregateFolder) &&
                        !(parent is UserRootFolder))
                    {
                        return(true);
                    }

                    if (string.Equals(filename, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }

                    if (string.Equals(filename, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
                    {
                        return(true);
                    }
                }
            }
            else
            {
                if (parent != null)
                {
                    // Don't resolve these into audio files
                    if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFilename, StringComparison.Ordinal) &&
                        _libraryManager.IsAudioFile(filename))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
        {
            // Don't ignore application folders
            if (fileInfo.FullName.Contains(_serverApplicationPaths.RootFolderPath, StringComparison.InvariantCulture))
            {
                return(false);
            }

            // Don't ignore top level folders
            if (fileInfo.IsDirectory && parent is AggregateFolder)
            {
                return(false);
            }

            if (IgnorePatterns.ShouldIgnore(fileInfo.FullName))
            {
                return(true);
            }

            var filename = fileInfo.Name;

            if (fileInfo.IsDirectory)
            {
                if (parent != null)
                {
                    // Ignore extras folders but allow it at the collection level
                    if (_namingOptions.AllExtrasTypesFolderNames.ContainsKey(filename) &&
                        parent is not AggregateFolder &&
                        parent is not UserRootFolder)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                if (parent != null)
                {
                    // Don't resolve these into audio files
                    if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal) &&
                        AudioFileParser.IsAudioFile(filename, _namingOptions))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }