public override void ResolveEntity(IMediaLocation location,
                                           out BaseItemFactory factory,
                                           out IEnumerable <InitializationParameter> setup)
        {
            factory = null;
            setup   = null;

            if (location is IFolderMediaLocation && !location.IsHidden() && TVUtils.IsSeasonFolder(location.Path))
            {
                factory = BaseItemFactory <Season> .Instance;
            }
        }
        public static bool IsSeriesFolder(this IMediaLocation location)
        {
            IFolderMediaLocation folder = location as IFolderMediaLocation;

            if (folder != null)
            {
                if (TVUtils.IsSeasonFolder(folder.Path))
                {
                    return(false);
                }

                int i = 0;

                foreach (IMediaLocation child in folder.Children)
                {
                    if (child is IFolderMediaLocation &&
                        TVUtils.IsSeasonFolder(child.Path))
                    {
                        return(true); // we have found at least one season folder
                    }
                    else
                    {
                        i++;
                    }
                    if (i >= 3)
                    {
                        return(false); // a folder with more than 3 non-season folders in will not be counted as a series
                    }
                }

                foreach (IMediaLocation child in folder.Children)
                {
                    if (!(child is IFolderMediaLocation) &&
                        child.IsVideo() &&
                        TVUtils.EpisodeNumberFromFile(child.Path, false) != null)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }