Добавил еще провайдер TVMaze
This commit is contained in:
@@ -39,16 +39,31 @@ func (r *Recognizer) matchMetadata(ctx context.Context, plan Plan) *Match {
|
||||
continue
|
||||
}
|
||||
c := strong[0]
|
||||
match := &Match{Provider: c.Provider, ProviderID: c.ID, Title: c.Title, Year: c.Year}
|
||||
|
||||
// Число серий тянем по нативному id провайдера.
|
||||
var counts map[int]int
|
||||
if mt == metadata.Series {
|
||||
if counts, cerr := p.SeasonEpisodeCounts(ctx, c.ID); cerr == nil {
|
||||
match.SeasonEpisodeCounts = counts
|
||||
if got, cerr := p.SeasonEpisodeCounts(ctx, c.ID); cerr == nil {
|
||||
counts = got
|
||||
} else {
|
||||
r.log.Warn("recognize: episode counts failed",
|
||||
"provider", p.Name(), "id", c.ID, "err", cerr)
|
||||
}
|
||||
}
|
||||
return match
|
||||
|
||||
// Провенанс и тег папки — по внешнему id, если провайдер его дал
|
||||
// (TVMaze отдаёт TVDB/IMDb-id); иначе по самому провайдеру.
|
||||
prov, pid := c.Provider, c.ID
|
||||
if c.TagProvider != "" {
|
||||
prov, pid = c.TagProvider, c.TagID
|
||||
}
|
||||
return &Match{
|
||||
Provider: prov,
|
||||
ProviderID: pid,
|
||||
Title: c.Title,
|
||||
Year: c.Year,
|
||||
SeasonEpisodeCounts: counts,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user