Commit b1f77c3661

b1f77c366170c518658b5cbd15bf0bc4d15bd6e3

parent: 05f087edba

Unsigned

Wraient <wraient.911@gmail.com> · 2026-05-23 00:31 UTC

Confirm guessed provider matches

Layout: unified · split

internal/curd.go +31 −3
@@ -1203,6 +1203,11 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
12031203 found = true
12041204 } else if bestMatch != nil {
12051205 Log(fmt.Sprintf("Highest match score was %d (needed 100 for Animepahe exact meta tag match). Not selecting automatically to prevent false positives.", highestScore))
1206 if confirmProviderMatch(*bestMatch, "Animepahe metadata") {
1207 anime.ProviderId = bestMatch.Key
1208 Log(fmt.Sprintf("User confirmed Animepahe match. Setting ProviderId to: %s", anime.ProviderId))
1209 found = true
1210 }
12061211 }
12071212 }
12081213
@@ -1211,9 +1216,11 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
12111216 targetLabel := fmt.Sprintf("%v (%d episodes)", userQuery, selectedAnilistAnime.Media.Episodes)
12121217 for _, option := range animeList {
12131218 if fmt.Sprintf("%s (%d episodes)", option.Title, selectedAnilistAnime.Media.Episodes) == targetLabel {
1214 anime.ProviderId = option.Key
1215 Log(fmt.Sprintf("Found exact text match! Setting ProviderId to: %s", anime.ProviderId))
1216 found = true
1219 if confirmProviderMatch(option, "title and episode count") {
1220 anime.ProviderId = option.Key
1221 Log(fmt.Sprintf("User confirmed exact text match. Setting ProviderId to: %s", anime.ProviderId))
1222 found = true
1223 }
12171224 break
12181225 }
12191226 }
@@ -1468,6 +1475,27 @@ func WriteTokenToFile(token string, filePath string) error {
14681475 return nil
14691476}
14701477
1478func confirmProviderMatch(option SelectionOption, reason string) bool {
1479 label := option.Label
1480 if label == "" {
1481 label = option.Title
1482 }
1483 if label == "" {
1484 label = option.Key
1485 }
1486
1487 CurdOut(fmt.Sprintf("Provider match found by %s: %s", reason, label))
1488 selected, err := DynamicSelect([]SelectionOption{
1489 {Key: "use", Label: "Use this match"},
1490 {Key: "manual", Label: "Select manually"},
1491 })
1492 if err != nil {
1493 Log(fmt.Sprintf("Error confirming provider match: %v", err))
1494 return false
1495 }
1496 return selected.Key == "use"
1497}
1498
14711499func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string {
14721500 if err := resolveRuntimeProviderID(userCurdConfig, anime); err != nil {
14731501 Log(fmt.Sprintf("Failed to resolve provider id: %v", err))