mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-12 08:16:37 +08:00
优化番号处理逻辑,添加对MetaTube的支持
优化番号处理逻辑,添加对MetaTube的支持
This commit is contained in:
@@ -83,14 +83,20 @@ func manualTMDbSearchTypes(mediaType string) []string {
|
||||
}
|
||||
|
||||
func (s *ScraperService) manualAdultMatches(ctx context.Context, media *model.Media, query string) []*Match {
|
||||
if s.adult == nil || !s.adult.Enabled() {
|
||||
return nil
|
||||
}
|
||||
candidates := []string{query}
|
||||
if media != nil {
|
||||
candidates = append(candidates, media.Path, media.OriginalName, media.Title)
|
||||
}
|
||||
out := make([]*Match, 0, 1)
|
||||
out := make([]*Match, 0, 4)
|
||||
seen := map[string]struct{}{}
|
||||
for _, candidate := range candidates {
|
||||
code := normalizeAdultCode(candidate)
|
||||
if code == "" {
|
||||
code = strings.TrimSpace(candidate)
|
||||
}
|
||||
if code == "" {
|
||||
continue
|
||||
}
|
||||
@@ -98,8 +104,12 @@ func (s *ScraperService) manualAdultMatches(ctx context.Context, media *model.Me
|
||||
continue
|
||||
}
|
||||
seen[code] = struct{}{}
|
||||
if match := s.manualAdultMatch(ctx, code); match != nil {
|
||||
out = append(out, match)
|
||||
if matches, err := s.adult.SearchCandidates(ctx, code); err == nil && len(matches) > 0 {
|
||||
for _, m := range matches {
|
||||
if m != nil && m.Title != "" {
|
||||
out = append(out, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user