mirror of
https://gitlab.com/foxixus/neomovies-api.git
synced 2025-10-28 01:48:51 +05:00
fix(api): add TMDB ID enrichment for KP content via IMDB ID lookup
- Add TMDBID field to ExternalIDs model - Enhance GetExternalIDs in MovieService and TVService to fetch TMDB ID via FindTMDBIdByIMDB - Add EnrichKPWithTMDBID function to enrich unified content with TMDB IDs - Update unified handlers to automatically enrich KP content with TMDB IDs - Enrich search results with TMDB IDs by fetching full film data for each result This ensures that when using source=kp, the response includes TMDB IDs in externalIds when available through IMDB ID mapping, while preserving all original KP data.
This commit is contained in:
@@ -122,6 +122,14 @@ func (s *MovieService) GetExternalIDs(id int) (*models.ExternalIDs, error) {
|
||||
if err == nil && kpFilm != nil {
|
||||
externalIDs := MapKPExternalIDsToTMDB(kpFilm)
|
||||
externalIDs.ID = id
|
||||
|
||||
// Пытаемся получить TMDB ID через IMDB ID
|
||||
if kpFilm.ImdbId != "" && s.tmdb != nil {
|
||||
if tmdbID, tmdbErr := s.tmdb.FindTMDBIdByIMDB(kpFilm.ImdbId, "movie", "ru-RU"); tmdbErr == nil {
|
||||
externalIDs.TMDBID = tmdbID
|
||||
}
|
||||
}
|
||||
|
||||
return externalIDs, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user