예제 #1
0
        private Series GetMatchingSeries(string seriesName, FileOrganizationResult result, AutoOrganizeOptions options)
        {
            var parsedName = _libraryManager.ParseName(seriesName);

            var yearInName      = parsedName.Year;
            var nameWithoutYear = parsedName.Name;

            result.ExtractedName = nameWithoutYear;
            result.ExtractedYear = yearInName;

            var series = _libraryManager.RootFolder.GetRecursiveChildren(i => i is Series)
                         .Cast <Series>()
                         .Select(i => NameUtils.GetMatchScore(nameWithoutYear, yearInName, i))
                         .Where(i => i.Item2 > 0)
                         .OrderByDescending(i => i.Item2)
                         .Select(i => i.Item1)
                         .FirstOrDefault();

            if (series == null)
            {
                SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(e => e.MatchStrings.Contains(nameWithoutYear, StringComparer.OrdinalIgnoreCase));

                if (info != null)
                {
                    series = _libraryManager.RootFolder
                             .GetRecursiveChildren(i => i is Series)
                             .Cast <Series>()
                             .FirstOrDefault(i => string.Equals(i.Name, info.ItemName, StringComparison.OrdinalIgnoreCase));
                }
            }

            return(series);
        }
예제 #2
0
        private Series GetMatchingSeries(string seriesName, FileOrganizationResult result)
        {
            var parsedName = _libraryManager.ParseName(seriesName);

            var yearInName      = parsedName.Year;
            var nameWithoutYear = parsedName.Name;

            result.ExtractedName = nameWithoutYear;
            result.ExtractedYear = yearInName;

            return(_libraryManager.RootFolder.RecursiveChildren
                   .OfType <Series>()
                   .Select(i => NameUtils.GetMatchScore(nameWithoutYear, yearInName, i))
                   .Where(i => i.Item2 > 0)
                   .OrderByDescending(i => i.Item2)
                   .Select(i => i.Item1)
                   .FirstOrDefault());
        }
예제 #3
0
        private Series GetMatchingSeries(string seriesName, FileOrganizationResult result, AutoOrganizeOptions options)
        {
            var parsedName = _libraryManager.ParseName(seriesName);

            var yearInName      = parsedName.Year;
            var nameWithoutYear = parsedName.Name;

            result.ExtractedName = nameWithoutYear;
            result.ExtractedYear = yearInName;

            var series = _libraryManager.GetItemList(new Controller.Entities.InternalItemsQuery
            {
                IncludeItemTypes = new[] { typeof(Series).Name },
                Recursive        = true
            })
                         .Cast <Series>()
                         .Select(i => NameUtils.GetMatchScore(nameWithoutYear, yearInName, i))
                         .Where(i => i.Item2 > 0)
                         .OrderByDescending(i => i.Item2)
                         .Select(i => i.Item1)
                         .FirstOrDefault();

            if (series == null)
            {
                SmartMatchInfo info = options.SmartMatchInfos.FirstOrDefault(e => e.MatchStrings.Contains(nameWithoutYear, StringComparer.OrdinalIgnoreCase));

                if (info != null)
                {
                    series = _libraryManager.GetItemList(new Controller.Entities.InternalItemsQuery
                    {
                        IncludeItemTypes = new[] { typeof(Series).Name },
                        Recursive        = true,
                        Name             = info.ItemName
                    }).Cast <Series>().FirstOrDefault();
                }
            }

            return(series);
        }