using System.Collections.Generic; using Kyoo.Models; using TMDbLib.Objects.TvShows; namespace Kyoo.TheMovieDb { /// /// A class containing extensions methods to convert from TMDB's types to Kyoo's types. /// public static partial class Convertors { /// /// Convert a into a . /// /// The episode to convert. /// The ID of the show inside TheMovieDb. /// The provider representing TheMovieDb. /// The converted episode as a . public static Episode ToEpisode(this TvEpisode episode, int showID, Provider provider) { return new Episode { SeasonNumber = episode.SeasonNumber, EpisodeNumber = episode.EpisodeNumber, Title = episode.Name, Overview = episode.Overview, ReleaseDate = episode.AirDate, Images = new Dictionary { [Images.Thumbnail] = episode.StillPath != null ? $"https://image.tmdb.org/t/p/original{episode.StillPath}" : null }, ExternalIDs = new [] { new MetadataID { Provider = provider, Link = $"https://www.themoviedb.org/tv/{showID}" + $"/season/{episode.SeasonNumber}/episode/{episode.EpisodeNumber}", DataID = episode.Id.ToString() } } }; } } }