Пример #1
0
        public async Task <Titles> SearchTitles(String Title, Int32 Limit     = 10, Boolean OnUserBehalf = true,
                                                TitleExpansion ExpansionLevel = TitleExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary <String, String> extraParams = new Dictionary <String, String>();

            extraParams.Add("term", FlixSharp.Helpers.OAuth.OAuthHelpers.Encode(Title));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";

            //String token = "";
            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                                                              Login.ConsumerKey,
                                                              Constants.CatalogTitleSearchUrl,
                                                              "GET",
                                                              tokenSecret,
                                                              extraParams);

            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);

            Titles movies = new Titles();

            switch (ExpansionLevel)
            {
            case TitleExpansion.Minimal:
                movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                break;

            case TitleExpansion.Expanded:
                movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                break;

            case TitleExpansion.Complete:
                movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                break;
            }


            return(movies);
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="titles"></param>
 public void AddTitles(List <string> titles)
 {
     if (Mode == FileMode.ReadOnly)
     {
         throw new FileLibException("File is Read-Only cannot AddTitles");
     }
     Titles.AddRange(titles);
 }
Пример #3
0
        public IndividualItem(ConsolidatedList consolidated, XElement xelem) : this()
        {
            if (consolidated != null)
            {
                ConsolidatedList = consolidated;
                ConsListId       = consolidated.Id;
            }
            ;
            if (xelem != null && xelem.Name.LocalName == "INDIVIDUAL")
            {
                FillCommonInfo(xelem);

                SecondName  = xelem.Element(S("SECOND_NAME"))?.Value;
                ThirdName   = xelem.Element(S("THIRD_NAME"))?.Value;
                FourthName  = xelem.Element(S("FOURTH_NAME"))?.Value;
                Gender      = xelem.Element(S("GENDER"))?.Value;
                Nationality = xelem.Element(S("NATIONALITY2"))?.Value;
                SubmittedBy = xelem.Element(S("SUBMITTED_BY"))?.Value;


                Aliases   = xelem.Elements(S("INDIVIDUAL_ALIAS")).Select(s => new IndividualAlias(this, s)).Where(w => w.IsCorrect()).ToList();
                DOBs      = xelem.Elements(S("INDIVIDUAL_DATE_OF_BIRTH")).Select(s => new IndividualDOB(this, s)).Where(w => w != null && w.IsCorrect()).ToList();
                POBs      = xelem.Elements(S("INDIVIDUAL_PLACE_OF_BIRTH")).Select(s => new IndividualPOB(this, s)).Where(w => w != null && w.IsCorrect()).ToList();
                Docs      = xelem.Elements(S("INDIVIDUAL_DOCUMENT")).Select(s => new IndividualDoc(this, s)).Where(w => w != null && w.IsCorrect()).ToList();
                Addresses = xelem.Elements(S("INDIVIDUAL_ADDRESS")).Select(s => new Address(this, s)).Where(w => w != null && w.IsCorrect()).ToList();


                var titles        = xelem.Element(S("TITLE"));
                var designations  = xelem.Element(S("DESIGNATION"));
                var nationalities = xelem.Element(S("NATIONALITY"));

                if (titles != null)
                {
                    Titles.AddRange(titles.Elements().Select(s => new Title(this, s)).Where(w => w != null).ToList());
                }
                if (designations != null)
                {
                    Designations.AddRange(designations.Elements().Select(s => new Designation(this, s)).Where(w => w != null).ToList());
                }
                if (nationalities != null)
                {
                    Nationalities.AddRange(nationalities.Elements().Select(s => new Nationality(this, s)).Where(w => w != null).ToList());
                }


                FillLastDayUpdates(xelem.Element(S("LAST_DAY_UPDATED")));
            }
            ;
        }
Пример #4
0
        /// <summary>
        /// Make a catalog/titles search request
        /// </summary>
        /// <param name="SearchTerm"></param>
        /// <param name="Limit"></param>
        /// <param name="OnUserBehalf">Make the request on the user's behalf if a
        /// GetCurrentUserNetflixUserInfo delegate was provided during creation.</param>
        /// <returns></returns>
        public async Task <SearchResults> SearchEverything(String SearchTerm, Int32 Limit       = 20, Boolean OnUserBehalf = true,
                                                           TitleExpansion TitleExpansionLevel   = TitleExpansion.Minimal,
                                                           PersonExpansion PersonExpansionLevel = PersonExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary <String, String> extraParams = new Dictionary <String, String>();

            extraParams.Add("term", OAuthHelpers.Encode(SearchTerm));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";

            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String personurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                                                               Login.ConsumerKey,
                                                               Constants.CatalogPeopleSearcUrl,
                                                               "GET",
                                                               tokenSecret,
                                                               extraParams);
            var persondoc = AsyncHelpers.NetflixLoadXDocumentAsync(personurl);

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                                                              Login.ConsumerKey,
                                                              Constants.CatalogTitleSearchUrl,
                                                              "GET",
                                                              tokenSecret,
                                                              extraParams);
            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);

            People people = new People();

            switch (PersonExpansionLevel)
            {
            case PersonExpansion.Minimal:
                people.AddRange(from person
                                in (await persondoc).Descendants("person")
                                select new Person(PersonExpansion.Minimal)
                {
                    IdUrl = person.Element("id").Value,
                    Name  = person.Element("name").Value,
                    Bio   = (String)person.Element("bio")
                });
                break;

            case PersonExpansion.Complete:
                people.AddRange(await AsyncFiller.GetCompleteNetflixPersonDetails(await persondoc));
                break;
            }

            Titles movies = new Titles();

            switch (TitleExpansionLevel)
            {
            case TitleExpansion.Minimal:
                movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                break;

            case TitleExpansion.Expanded:
                movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                break;

            case TitleExpansion.Complete:
                movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                break;
            }

            SearchResults sr = new SearchResults();

            sr.MovieResults  = movies;
            sr.PeopleResults = people;
            sr.SearchTerm    = SearchTerm;
            return(sr);
        }
Пример #5
0
 public DocumentationDefinition(ICustomAttributeProvider provider)
 {
     Titles.AddRange(provider.GetXRoadTitles());
     Notes.AddRange(provider.GetXRoadNotes());
     TechNotes.AddRange(provider.GetXRoadTechNotes());
 }
Пример #6
0
 /// <summary>
 /// Set the quest thread titles.
 /// </summary>
 /// <param name="titles">A list of titles to use.</param>
 public void SetThreadTitles(IEnumerable <string> titles)
 {
     Titles.Clear();
     Titles.AddRange(titles);
 }
Пример #7
0
        /// <summary>
        /// Make a catalog/titles search request
        /// </summary>
        /// <param name="SearchTerm"></param>
        /// <param name="Limit"></param>
        /// <param name="OnUserBehalf">Make the request on the user's behalf if a 
        /// GetCurrentUserNetflixUserInfo delegate was provided during creation.</param>
        /// <returns></returns>
        public async Task<SearchResults> SearchEverything(String SearchTerm, Int32 Limit = 20, Boolean OnUserBehalf = true,
            TitleExpansion TitleExpansionLevel = TitleExpansion.Minimal,
            PersonExpansion PersonExpansionLevel = PersonExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary<String, String> extraParams = new Dictionary<String, String>();
            extraParams.Add("term", OAuthHelpers.Encode(SearchTerm));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";
            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String personurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogPeopleSearcUrl,
                "GET",
                tokenSecret,
                extraParams);
            var persondoc = AsyncHelpers.NetflixLoadXDocumentAsync(personurl);

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogTitleSearchUrl,
                "GET",
                tokenSecret,
                extraParams);
            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);
            
            People people = new People();
            switch (PersonExpansionLevel)
            {
                case PersonExpansion.Minimal:
                    people.AddRange(from person
                                    in (await persondoc).Descendants("person")
                                    select new Person(PersonExpansion.Minimal)
                                    {
                                        IdUrl = person.Element("id").Value,
                                        Name = person.Element("name").Value,
                                        Bio = (String)person.Element("bio")
                                    });
                    break;
                case PersonExpansion.Complete:
                    people.AddRange(await AsyncFiller.GetCompleteNetflixPersonDetails(await persondoc));
                    break;
            }

            Titles movies = new Titles();
            switch (TitleExpansionLevel)
            {
                case TitleExpansion.Minimal:
                    movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                    break;
                case TitleExpansion.Expanded:
                    movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                    break;
                case TitleExpansion.Complete:
                    movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                    break;
            }

            SearchResults sr = new SearchResults();
            sr.MovieResults = movies;
            sr.PeopleResults = people;
            sr.SearchTerm = SearchTerm;
            return sr;
        }
Пример #8
0
        public async Task<Titles> SearchTitles(String Title, Int32 Limit = 10, Boolean OnUserBehalf = true,
            TitleExpansion ExpansionLevel = TitleExpansion.Minimal)
        {
            Login.CheckInformationSet();

            Dictionary<String, String> extraParams = new Dictionary<String, String>();
            extraParams.Add("term", FlixSharp.Helpers.OAuth.OAuthHelpers.Encode(Title));
            extraParams.Add("max_results", Limit.ToString());

            String tokenSecret = "";
            //String token = "";
            if (OnUserBehalf)
            {
                Account na = FlixSharp.Netflix.SafeReturnUserInfo();
                if (na != null)
                {
                    tokenSecret = na.TokenSecret;
                    extraParams.Add("oauth_token", na.Token);
                }
            }

            String titleurl = OAuthHelpers.GetOAuthRequestUrl(Login.SharedSecret,
                Login.ConsumerKey,
                Constants.CatalogTitleSearchUrl,
                "GET",
                tokenSecret,
                extraParams);

            var moviedoc = AsyncHelpers.NetflixLoadXDocumentAsync(titleurl);

            Titles movies = new Titles();

            switch (ExpansionLevel)
            {
                case TitleExpansion.Minimal:
                    movies.AddRange(await Fill.GetBaseTitleInfo(moviedoc, "catalog_title"));
                    break;
                case TitleExpansion.Expanded:
                    movies.AddRange(await AsyncFiller.GetExpandedMovieDetails(await moviedoc));
                    break;
                case TitleExpansion.Complete:
                    movies.AddRange(await AsyncFiller.GetCompleteNetflixMovieDetails(await moviedoc));
                    break;
            }


            return movies;

        }