OnSelectActor() public method

public OnSelectActor ( IMDBFetcher fetcher, int &selected ) : bool
fetcher IMDBFetcher
selected int
return bool
Exemplo n.º 1
0
    /// <summary>
    /// Downloads actor info.
    /// Movie details can be empty (it is used to help update role for movie if role is empty)
    /// </summary>
    /// <param name="progress"></param>
    /// <param name="details"></param>
    /// <param name="actor"></param>
    /// <param name="actorId"></param>
    public static IMDBActor FetchMovieActor(IMDB.IProgress progress, IMDBMovie details, string actor, int actorId)
    {
      if (actor == string.Empty)
        return null;
      
      IMDBFetcher fetcher = new IMDBFetcher(progress);
      fetcher._movieDetails = details;
      // Find actor
      IMDB imdb = new IMDB();

      // Don't search for actor if name is IMDBactorId (little speed up)
      if (!VideoDatabase.CheckActorImdbId(actor))
      {
        imdb = fetcher.FindActor(actor);

        // Check for results
        if (imdb.Count > 0)
        {
          int i = 0;

          // If more than 1, invoke selection
          if (imdb.Count > 1)
          {
            if (!fetcher.OnSelectActor(fetcher, out i))
            {
              return null;
            }
          }
          // Fetch actor details
          return fetcher.FetchActorDetails(actor, actorId, i);
        }
      }
      else // Direct get actor details (by actorImdbId) as name
      {
        fetcher._imdb.SetIMDBActor("http://www.imdb.com/name/" + actor, actor);
        return fetcher.FetchActorDetails(actor, actorId, 0);
      }
      return null;
    }