示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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
            });
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }