public Tuple <List <AlternativeTitle>, AlternativeYear> AlternativeTitlesAndYearForMovie(int tmdbId) { var request = RadarrAPI.Create().SetSegment("route", "mappings").SetSegment("action", "find").AddQueryParam("tmdbid", tmdbId).Build(); var mappings = Execute <Mapping>(request); var titles = new List <NzbDrone.Core.Movies.AlternativeTitles.AlternativeTitle>(); foreach (var altTitle in mappings.Mappings.Titles) { titles.Add(new NzbDrone.Core.Movies.AlternativeTitles.AlternativeTitle(altTitle.Info.AkaTitle, SourceType.Mappings, altTitle.Id)); } var year = mappings.Mappings.Years.Where(y => y.Votes >= 3).OrderBy(y => y.Votes).FirstOrDefault(); AlternativeYear newYear = null; if (year != null) { newYear = new AlternativeYear { Year = year.Info.AkaYear, SourceId = year.Id }; } return(new Tuple <List <AlternativeTitle>, AlternativeYear>(titles, newYear)); }
public List <MovieResult> DiscoverMovies(string action, Func <HttpRequest, HttpRequest> enhanceRequest = null) { var request = RadarrAPI.Create().SetSegment("route", "discovery").SetSegment("action", action).Build(); if (enhanceRequest != null) { request = enhanceRequest(request); } return(Execute <List <MovieResult> >(request)); }
public AlternativeYear AddNewAlternativeYear(int year, int tmdbId) { var request = RadarrAPI.Create().SetSegment("route", "mappings").SetSegment("action", "add") .AddQueryParam("tmdbid", tmdbId).AddQueryParam("type", "year") .AddQueryParam("aka_year", year).Build(); var newYear = Execute <AddYearMapping>(request); return(new AlternativeYear { Year = newYear.Info.AkaYear, SourceId = newYear.Id }); }
public List <AlternativeTitle> AlternativeTitlesForMovie(int TmdbId) { var request = RadarrAPI.Create().SetSegment("route", "mappings").SetSegment("action", "find").AddQueryParam("tmdbid", TmdbId).Build(); var mappings = Execute <Mapping>(request); var titles = new List <NzbDrone.Core.Movies.AlternativeTitles.AlternativeTitle>(); foreach (var altTitle in mappings.Mappings.Titles) { titles.Add(new NzbDrone.Core.Movies.AlternativeTitles.AlternativeTitle(altTitle.Info.AkaTitle, SourceType.Mappings, altTitle.Id)); } return(titles); }
public AlternativeTitle AddNewAlternativeTitle(AlternativeTitle title, int TmdbId) { var request = RadarrAPI.Create().SetSegment("route", "mappings").SetSegment("action", "add") .AddQueryParam("tmdbid", TmdbId).AddQueryParam("type", "title") .AddQueryParam("language", IsoLanguages.Get(title.Language).TwoLetterCode) .AddQueryParam("aka_title", title.Title).Build(); var newMapping = Execute <AddTitleMapping>(request); var newTitle = new AlternativeTitle(newMapping.Info.AkaTitle, SourceType.Mappings, newMapping.Id, title.Language); newTitle.VoteCount = newMapping.VoteCount; newTitle.Votes = newMapping.Votes; return(newTitle); }