mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-05 04:56:37 +08:00
fix issue 51 library reclassify regressions
This commit is contained in:
@@ -156,6 +156,7 @@ func (s *ScraperService) applyProviderMatchWithOptions(ctx context.Context, m *m
|
||||
if len(match.Languages) > 0 {
|
||||
updates["languages"] = strings.Join(match.Languages, ",")
|
||||
}
|
||||
applyScrapeMediaTypeResets(updates, match)
|
||||
|
||||
if err := s.repo.DB.Model(&model.Media{}).Where("id = ?", m.ID).
|
||||
Updates(updates).Error; err != nil {
|
||||
@@ -188,3 +189,28 @@ func (s *ScraperService) applyProviderMatchWithOptions(ctx context.Context, m *m
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyScrapeMediaTypeResets(updates map[string]any, match *Match) {
|
||||
if updates == nil || match == nil {
|
||||
return
|
||||
}
|
||||
switch normalizeOrganizeMediaType(match.MediaType) {
|
||||
case "movie", "adult":
|
||||
updates["season_num"] = 0
|
||||
updates["episode_num"] = 0
|
||||
updates["episode_title"] = ""
|
||||
updates["series_id"] = ""
|
||||
if match.TMDbID <= 0 {
|
||||
updates["tm_db_id"] = 0
|
||||
}
|
||||
if match.BangumiID <= 0 {
|
||||
updates["bangumi_id"] = 0
|
||||
}
|
||||
if strings.TrimSpace(match.DoubanID) == "" {
|
||||
updates["douban_id"] = ""
|
||||
}
|
||||
if strings.TrimSpace(match.TheTVDBID) == "" {
|
||||
updates["thetvdb_id"] = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user