当前位置: 首页>>代码示例>>C#>>正文


C# Database.IMDBActor类代码示例

本文整理汇总了C#中MediaPortal.Video.Database.IMDBActor的典型用法代码示例。如果您正苦于以下问题:C# IMDBActor类的具体用法?C# IMDBActor怎么用?C# IMDBActor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMDBActor类属于MediaPortal.Video.Database命名空间,在下文中一共展示了IMDBActor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnItemSelected

    private void OnItemSelected(GUIListItem item, GUIControl parent)
    {
      GUIPropertyManager.SetProperty("#groupmovielist", string.Empty);
      
      if (handler.CurrentLevel > 0)
      {
        FilterDefinition defCurrent = (FilterDefinition)handler.View.Filters[handler.CurrentLevel - 1];
        string selectedValue = defCurrent.SelectedValue;

        if (Regex.Match(selectedValue, @"[\d]*").Success)
        {
          if (defCurrent.Where == "actor" || defCurrent.Where == "director")
          {
            selectedValue = VideoDatabase.GetActorNameById(Convert.ToInt32(defCurrent.SelectedValue));
          }

          if (defCurrent.Where == "genre")
          {
            selectedValue = VideoDatabase.GetGenreById(Convert.ToInt32(defCurrent.SelectedValue));
          }

          if (defCurrent.Where == "user groups")
          {
            selectedValue = VideoDatabase.GetUserGroupById(Convert.ToInt32(defCurrent.SelectedValue));
          }
        }
        GUIPropertyManager.SetProperty("#currentmodule",
                                       String.Format("{0}/{1} - {2}", GUILocalizeStrings.Get(100006),
                                                     handler.LocalizedCurrentView, selectedValue));
      }
      
      if (item.Label == "..")
      {
        IMDBMovie notMovie = new IMDBMovie();
        notMovie.SetProperties(true, string.Empty);
        IMDBActor notActor = new IMDBActor();
        notActor.SetProperties();
        return;
      }
      
      // Set current item if thumb thread is working (thread can still update thumbs while user changed
      // item) thus preventing sudden jump to initial selected item before thread start
      if (_setThumbs != null && _setThumbs.IsAlive)
      {
        currentSelectedItem = facadeLayout.SelectedListItemIndex;
      }

      IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
      
      if (movie == null)
      {
        movie = new IMDBMovie();
      }
      
      ArrayList files = new ArrayList();
      VideoDatabase.GetFilesForMovie(movie.ID, ref files);
      
      if (files.Count > 0)
      {
        movie.SetProperties(false, (string)files[0]);
      }
      else
      {
        movie.SetProperties(false, string.Empty);

        // Set title properties for other views (year, genres..)
        if (!string.IsNullOrEmpty(item.Label))
        {
          GUIPropertyManager.SetProperty("#title", item.Label);
          GUIPropertyManager.SetProperty("#groupmovielist", SetMovieListGroupedBy(item));
        }
      }
      
      IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID);
      
      if (actor != null)
      {
        actor.SetProperties();
      }
      else
      {
        actor = new IMDBActor();
        actor.SetProperties();
      }

      if (movie.ID >= 0)
      {
        string titleExt = movie.Title + "{" + movie.ID + "}";
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt);
        
        if (Util.Utils.FileExistsInCache(coverArtImage))
        {
          facadeLayout.FilmstripLayout.InfoImageFileName = coverArtImage;
        }
      }
      
      if (movie.Actor != string.Empty)
      {
        GUIPropertyManager.SetProperty("#title", movie.Actor);
        string coverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieActors, movie.ActorID.ToString());
//.........这里部分代码省略.........
开发者ID:sanyaade-embedded-systems,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs

示例2: MakeNfo


//.........这里部分代码省略.........

              try
              {
                string faFilename = moviePath + @"\" + movieFile + "-fanart" + index + ".jpg";
                File.Copy(faFile, faFilename, true);
                File.SetAttributes(faFilename, FileAttributes.Normal);
                CreateXmlNode(subNode, doc, "thumb", movieFile + "-fanart" + index + ".jpg");
              }
              catch (Exception ex)
              {
                Log.Info("VideoDatabas: Error in creating nfo - fanart section:{0}", ex.Message);
              }

            }
          }
          mainNode.AppendChild(subNode);

          // Genre
          string szGenres = movieDetails.Genre;

          if (szGenres.IndexOf("/") >= 0 || szGenres.IndexOf("|") >= 0)
          {
            Tokens f = new Tokens(szGenres, new[] {'/', '|'});

            foreach (string strGenre in f)
            {
              if (!string.IsNullOrEmpty(strGenre))
              {
                CreateXmlNode(mainNode, doc, "genre", strGenre.Trim());
              }
            }
          }
          else
          {
            CreateXmlNode(mainNode, doc, "genre", movieDetails.Genre);
          }

          // Cast
          ArrayList castList = new ArrayList();
          GetActorsByMovieID(movieId, ref castList);

          foreach (string actor in castList)
          {
            IMDBActor actorInfo = new IMDBActor();
            subNode = doc.CreateElement("actor");

            char[] splitter = {'|'};
            string[] temp = actor.Split(splitter);
            actorInfo = GetActorInfo(Convert.ToInt32(temp[0]));

            CreateXmlNode(subNode, doc, "name", temp[1]);
            CreateXmlNode(subNode, doc, "role", temp[3]);
            CreateXmlNode(subNode, doc, "imdb", temp[2]);

            if (actorInfo != null)
            {
              CreateXmlNode(subNode, doc, "thumb", actorInfo.ThumbnailUrl);
              CreateXmlNode(subNode, doc, "birthdate", actorInfo.DateOfBirth);
              CreateXmlNode(subNode, doc, "birthplace", actorInfo.PlaceOfBirth);
              CreateXmlNode(subNode, doc, "deathdate", actorInfo.DateOfDeath);
              CreateXmlNode(subNode, doc, "deathplace", actorInfo.PlaceOfDeath);
              CreateXmlNode(subNode, doc, "minibiography", actorInfo.MiniBiography);
              CreateXmlNode(subNode, doc, "biography", actorInfo.Biography);
            }

            mainNode.AppendChild(subNode);
          }

          // User groups
          ArrayList userGroups = new ArrayList();
          GetMovieUserGroups(movieId, userGroups);

          if (userGroups.Count > 0)
          {
            foreach (string userGroup in userGroups)
            {
              CreateXmlNode(mainNode, doc, "set", userGroup);
            }
          }

          // Trailer
          CreateXmlNode(mainNode, doc, "trailer", string.Empty);

          #endregion

          // End and save
          doc.AppendChild(mainNode);
          doc.InsertBefore(xmldecl, mainNode);
          doc.Save(nfoFile);
          fileCounter++;
        }
      }
      catch(Exception ex)
      {
        Log.Info("VideoDatabase: Error in creating nfo file:{0} Error:{1}", nfoFile ,ex.Message);
        return false;
      }

      return true;
    }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:101,代码来源:VideoDatabaseSqlLite.cs

示例3: GetActorMovies

    private void GetActorMovies(IMDBActor actor, HTMLParser parser, bool director, bool writer)
    {
      string[] vdbParserStr = VdbParserStringActorMovies();

      if (vdbParserStr == null || vdbParserStr.Length != 19)
      {
        return;
      }

      string movies = string.Empty;
      
      // Get films and roles block
      if (parser.extractTo(vdbParserStr[0], ref movies)) // <div id
      {
        parser.Content = movies;
      }
      
      // Parse block for evey film and get year, title and it's imdbID and role
      while (parser.skipToStartOf(vdbParserStr[1])) // <span class="year_column"
      {
        string movie = string.Empty;

        if (parser.extractTo(vdbParserStr[2], ref movie)) // <div class
        {
          movie += vdbParserStr[3]; // </li>

          HTMLParser movieParser = new HTMLParser(movie);
          string title = string.Empty;
          string strYear = string.Empty;
          string role = string.Empty;
          string imdbID = string.Empty;

          // IMDBid
          movieParser.skipToEndOf(vdbParserStr[4]);           // title/
          movieParser.extractTo(vdbParserStr[5], ref imdbID); // /

          // Title
          movieParser.resetPosition();
          movieParser.skipToEndOf(vdbParserStr[6]);           // <a
          movieParser.skipToEndOf(vdbParserStr[7]);           // >
          movieParser.extractTo(vdbParserStr[8], ref title);  // <br/>
          title = CleanCrlf(title);

          if (!SkipNoMovies(title))
          {
            // Year
            movieParser.resetPosition();

            if (movieParser.skipToStartOf(vdbParserStr[9]) &&       // year_column">20
                movieParser.skipToEndOf(vdbParserStr[10]))          // >
            {
              movieParser.extractTo(vdbParserStr[11], ref strYear); // <
            }
            else
            {
              movieParser.resetPosition();
              
              if (movieParser.skipToStartOf(vdbParserStr[12]) &&      // year_column">19
                  movieParser.skipToEndOf(vdbParserStr[13]))          // >
              {
                movieParser.extractTo(vdbParserStr[14], ref strYear); // <
              }
            }

            strYear = strYear.Trim();

            if (strYear.Length > 4)
            {
              strYear = strYear.Substring(0, 4);
            }

            // Roles actor
            if (!director && !writer)
            {
              // Role case 1, no character link
              if (movieParser.skipToEndOf(vdbParserStr[15]))       // <br/>
              {
                movieParser.extractTo(vdbParserStr[16], ref role); // <
                role = CleanCrlf(role);

                // Role case 2, with character link
                if (role == string.Empty)
                {
                  movieParser.resetPosition();
                  movieParser.skipToEndOf(vdbParserStr[17]);          // <br/>
                  movieParser.extractTo(vdbParserStr[18], ref role);  // </a>
                  role = CleanCrlf(role);
                }
              }
            }
            else if (director)
            {
              role = GUILocalizeStrings.Get(199).Replace(":", string.Empty);
            }
            else // Writer
            {
              string wRole = string.Empty;

              if (title != null)
              {
//.........这里部分代码省略.........
开发者ID:sekotin,项目名称:MediaPortal-1,代码行数:101,代码来源:IMDB.cs

示例4: SetActorInfo

 public void SetActorInfo(int idActor, IMDBActor actor)
 {
   try
   {
     if (null == m_db)
     {
       return;
     }
     
     string strSQL = String.Format("SELECT * FROM actorinfo WHERE idActor ={0}", idActor);
     SQLiteResultSet results = m_db.Execute(strSQL);
     
     if (results.Rows.Count == 0)
     {
       // doesnt exists, add it
       strSQL =
         String.Format(
           "INSERT INTO actorinfo (idActor , dateofbirth , placeofbirth , minibio , biography, thumbURL, IMDBActorID, dateofdeath , placeofdeath, lastupdate ) VALUES( {0},'{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')",
           idActor, 
           DatabaseUtility.RemoveInvalidChars(actor.DateOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.MiniBiography),
           DatabaseUtility.RemoveInvalidChars(actor.Biography),
           DatabaseUtility.RemoveInvalidChars(actor.ThumbnailUrl),
           DatabaseUtility.RemoveInvalidChars(actor.IMDBActorID),
           DatabaseUtility.RemoveInvalidChars(actor.DateOfDeath),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfDeath),
           DatabaseUtility.RemoveInvalidChars(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
       m_db.Execute(strSQL);
     }
     else
     {
       // exists, modify it
       strSQL =
         String.Format(
           "UPDATE actorinfo SET dateofbirth='{1}', placeofbirth='{2}', minibio='{3}', biography='{4}', thumbURL='{5}', IMDBActorID='{6}', dateofdeath='{7}', placeofdeath='{8}', lastupdate ='{9}' WHERE idActor={0}",
           idActor, 
           DatabaseUtility.RemoveInvalidChars(actor.DateOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.MiniBiography),
           DatabaseUtility.RemoveInvalidChars(actor.Biography),
           DatabaseUtility.RemoveInvalidChars(actor.ThumbnailUrl),
           DatabaseUtility.RemoveInvalidChars(actor.IMDBActorID),
           DatabaseUtility.RemoveInvalidChars(actor.DateOfDeath),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfDeath),
           DatabaseUtility.RemoveInvalidChars(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
       m_db.Execute(strSQL);
       RemoveActorInfoMovie(idActor);
     }
     
     for (int i = 0; i < actor.Count; ++i)
     {
       AddActorInfoMovie(idActor, actor[i]);
     }
     
     return;
   }
   catch (Exception ex)
   {
     Log.Error("videodatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
     Open();
   }
   return;
 }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:64,代码来源:VideoDatabaseSqlLite.cs

示例5: GetActorInfo

    public IMDBActor GetActorInfo(int idActor)
    {
      try
      {
        if (null == m_db)
        {
          return null;
        }
        string strSql = String.Format(
            "SELECT actorinfo.biography, actorinfo.dateofbirth, actorinfo.dateofdeath, actorinfo.minibio, actors.strActor, actorinfo.placeofbirth, actorinfo.placeofdeath, actorinfo.thumbURL, actorinfo.lastupdate, actors.IMDBActorID, actorinfo.idActor FROM actors,actorinfo WHERE actors.idActor=actorinfo.idActor AND actors.idActor ={0}", idActor);
        SQLiteResultSet results = m_db.Execute(strSql);
        
        if (results.Rows.Count != 0)
        {
          IMDBActor actor = new IMDBActor();
          actor.Biography = DatabaseUtility.Get(results, 0, "actorinfo.biography".Replace("''", "'"));
          actor.DateOfBirth = DatabaseUtility.Get(results, 0, "actorinfo.dateofbirth".Replace("''", "'"));
          actor.DateOfDeath = DatabaseUtility.Get(results, 0, "actorinfo.dateofdeath".Replace("''", "'"));
          actor.MiniBiography = DatabaseUtility.Get(results, 0, "actorinfo.minibio".Replace("''", "'"));
          actor.Name = DatabaseUtility.Get(results, 0, "actors.strActor".Replace("''", "'"));
          actor.PlaceOfBirth = DatabaseUtility.Get(results, 0, "actorinfo.placeofbirth".Replace("''", "'"));
          actor.PlaceOfDeath = DatabaseUtility.Get(results, 0, "actorinfo.placeofdeath".Replace("''", "'"));
          actor.ThumbnailUrl = DatabaseUtility.Get(results, 0, "actorinfo.thumbURL");
          actor.LastUpdate = DatabaseUtility.Get(results, 0, "actorinfo.lastupdate");
          actor.IMDBActorID = DatabaseUtility.Get(results, 0, "actors.IMDBActorID");
          actor.ID = Convert.ToInt32(DatabaseUtility.Get(results, 0, "actorinfo.idActor"));

          strSql = String.Format("SELECT * FROM actorinfomovies WHERE idActor ={0}", idActor);
          results = m_db.Execute(strSql);
          
          for (int i = 0; i < results.Rows.Count; ++i)
          {
            string imdbId = DatabaseUtility.Get(results, i, "IMDBID");
            strSql = String.Format("SELECT * FROM IMDBMovies WHERE idIMDB='{0}'", imdbId);
            SQLiteResultSet resultsImdb = m_db.Execute(strSql);

            IMDBActor.IMDBActorMovie movie = new IMDBActor.IMDBActorMovie();
            movie.ActorID = Convert.ToInt32(DatabaseUtility.Get(results, i, "idActor"));
            movie.Role = DatabaseUtility.Get(results, i, "role");
            
            if (resultsImdb.Rows.Count != 0)
            {
              // Added IMDBid
              movie.MovieTitle = DatabaseUtility.Get(resultsImdb, 0, "strTitle");
              movie.Year = Int32.Parse(DatabaseUtility.Get(resultsImdb, 0, "iYear"));
              movie.MovieImdbID = DatabaseUtility.Get(resultsImdb, 0, "idIMDB");
              movie.MoviePlot = DatabaseUtility.Get(resultsImdb, 0, "strPlot");
              movie.MovieCover = DatabaseUtility.Get(resultsImdb, 0, "strPictureURL");
              movie.MovieGenre = DatabaseUtility.Get(resultsImdb, 0, "strGenre");
              movie.MovieCast = DatabaseUtility.Get(resultsImdb, 0, "strCast");
              movie.MovieCredits = DatabaseUtility.Get(resultsImdb, 0, "strCredits");
              movie.MovieRuntime = Int32.Parse(DatabaseUtility.Get(results, i, "runtime")); // Not used
              movie.MovieMpaaRating = DatabaseUtility.Get(resultsImdb, 0, "mpaa");
            }
            actor.Add(movie);
          }
          return actor;
        }
      }
      catch (Exception ex)
      {
        Log.Error("videodatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
        Open();
      }
      return null;
    }
开发者ID:akhilgt,项目名称:MediaPortal-1,代码行数:66,代码来源:VideoDatabaseSqlLite.cs

示例6: OnItemSelected

    private void OnItemSelected(GUIListItem item, GUIControl parent)
    {
      GUIPropertyManager.SetProperty("#groupmovielist", string.Empty);
      string strView = string.Empty;
      int currentViewlvl = 0;
      
      if (handler != null)
      {
        strView = handler.CurrentLevelWhere.ToLowerInvariant();
        currentViewlvl = handler.CurrentLevel;

        if (handler.CurrentLevel > 0)
        {
          FilterDefinition defCurrent = (FilterDefinition) handler.View.Filters[handler.CurrentLevel - 1];
          string selectedValue = defCurrent.SelectedValue;
          Int32 iSelectedValue;
          
          if (Int32.TryParse(selectedValue, out iSelectedValue))
          {
            if (strView == "actor" || strView == "director")
            {
              selectedValue = VideoDatabase.GetActorNameById(iSelectedValue);
            }

            if (strView == "genre")
            {
              selectedValue = VideoDatabase.GetGenreById(iSelectedValue);
            }

            if (strView == "user groups")
            {
              selectedValue = VideoDatabase.GetUserGroupById(iSelectedValue);
            }
          }

          GUIPropertyManager.SetProperty("#currentmodule",
                                         String.Format("{0}/{1} - {2}", GUILocalizeStrings.Get(100006),
                                                       handler.LocalizedCurrentView, selectedValue));
        }
      }

      if (item.Label == "..")
      {
        IMDBMovie notMovie = new IMDBMovie();
        notMovie.IsEmpty = true;
        notMovie.SetProperties(true, string.Empty);
        IMDBActor notActor = new IMDBActor();
        notActor.SetProperties();
        return;
      }
      
      // Set current item if thumb thread is working (thread can still update thumbs while user changed
      // item) thus preventing sudden jump to initial selected item before thread start
      if (_setThumbs != null && _setThumbs.IsAlive)
      {
        currentSelectedItem = facadeLayout.SelectedListItemIndex;
      }

      IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
      
      if (movie == null)
      {
        movie = new IMDBMovie();
      }
      
      if (!string.IsNullOrEmpty(movie.VideoFileName))
      {
        movie.SetProperties(false, movie.VideoFileName);
      }
      else
      {
        switch (strView)
        {
          case "actorindex":
          case "directorindex":
          case "titleindex":
            movie.IsEmpty = true;
            movie.SetProperties(false, string.Empty);
            break;

          default:
            movie.SetProperties(false, string.Empty);
            break;
        }
        
        // Set title properties for other views (year, genres..)
        if (!string.IsNullOrEmpty(item.Label))
        {
          GUIPropertyManager.SetProperty("#title", item.Label);

          if (item.MusicTag != null)
          {
            GUIPropertyManager.SetProperty("#groupmovielist", item.MusicTag.ToString());
          }
        }
      }
      
      IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID);
      
      if (actor != null)
//.........这里部分代码省略.........
开发者ID:edalex86,项目名称:MediaPortal-1,代码行数:101,代码来源:GUIVideoTitle.cs

示例7: AddActorInfoMovie

 public static void AddActorInfoMovie(int idActor, IMDBActor.IMDBActorMovie movie)
 {
   _database.AddActorInfoMovie(idActor, movie);
 }
开发者ID:nio22,项目名称:MediaPortal-1,代码行数:4,代码来源:VideoDatabase.cs

示例8: GetActorInfo

    // Changed get thumbnailURL - IMDBActorID - IMDBID for movies
    public IMDBActor GetActorInfo(int idActor)
    {
      //"CREATE TABLE actorinfo ( idActor integer, dateofbirth text, placeofbirth text, minibio text, biography text
      try
      {
        if (null == m_db)
        {
          return null;
        }
        string strSQL =
          String.Format(
            "select * from actors,actorinfo where actors.idActor=actorinfo.idActor and actors.idActor ={0}", idActor);
        SQLiteResultSet results = m_db.Execute(strSQL);
        if (results.Rows.Count != 0)
        {
          IMDBActor actor = new IMDBActor();
          actor.Biography = DatabaseUtility.Get(results, 0, "actorinfo.biography".Replace("''", "'"));
          actor.DateOfBirth = DatabaseUtility.Get(results, 0, "actorinfo.dateofbirth");
          actor.MiniBiography = DatabaseUtility.Get(results, 0, "actorinfo.minibio".Replace("''", "'"));
          actor.Name = DatabaseUtility.Get(results, 0, "actors.strActor".Replace("''", "'"));
          actor.PlaceOfBirth = DatabaseUtility.Get(results, 0, "actorinfo.placeofbirth".Replace("''", "'"));
          actor.ThumbnailUrl = DatabaseUtility.Get(results, 0, "actorinfo.thumbURL");
          actor.IMDBActorID = DatabaseUtility.Get(results, 0, "actorinfo.IMDBActorID");

          strSQL = String.Format("select * from actorinfomovies where idActor ={0}", idActor);
          results = m_db.Execute(strSQL);
          for (int i = 0; i < results.Rows.Count; ++i)
          {
            IMDBActor.IMDBActorMovie movie = new IMDBActor.IMDBActorMovie();
            movie.MovieTitle = DatabaseUtility.Get(results, i, "strTitle");
            movie.Role = DatabaseUtility.Get(results, i, "role");
            movie.Year = Int32.Parse(DatabaseUtility.Get(results, i, "iYear"));
            // Added IMDBid
            movie.imdbID = DatabaseUtility.Get(results, i, "IMDBID");
            actor.Add(movie);
          }
          return actor;
        }
      }
      catch (Exception ex)
      {
        Log.Error("videodatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
        Open();
      }
      return null;
    }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:47,代码来源:VideoDatabaseSqlLite.cs

示例9: FetchActorsInMovie

    // Changed actors find & count display on progress bar window
    private void FetchActorsInMovie()
    {
      bool director = false; // Actor is director
      bool byImdbId = true;
      // Lookup by movie IMDBid number from which will get actorIMDBid, lookup by name is not so db friendly

      if (_movieDetails == null)
      {
        return;
      }
      ArrayList actors = new ArrayList();
      // Try first by IMDBMovieId to find IMDBactorID (100% accuracy)
      IMDBSearch actorlist = new IMDBSearch();
      // New actor search method
      actorlist.SearchActors(_movieDetails.IMDBNumber, ref actors);

      // If search by IMDBid fails try old fetch method (by name, less accurate)
      if (actors.Count == 0)
      {
        byImdbId = false;
        string cast = _movieDetails.Cast + "," + _movieDetails.Director;
        char[] splitter = {'\n', ','};
        string[] temp = cast.Split(splitter);

        foreach (string element in temp)
        {
          string el = element.Trim();
          if (el != string.Empty)
          {
            actors.Add(el);
          }
        }
      }

      if (actors.Count > 0)
      {
        int percent = 0;
        for (int i = 0; i < actors.Count; ++i)
        {
          // Is actor movie director??
          switch (byImdbId) // True-new method, false-old method
          {
            case true:
              {
                // Director
                if (actors[i].ToString().Length > 1 && actors[i].ToString().Substring(0, 2) == "*d")
                {
                  director = true;
                  // Remove director prefix (came from IMDBmovieID actor search)
                  actors[i] = actors[0].ToString().Replace("*d", string.Empty);
                }
                else
                {
                  director = false;
                }
                break;
              }
            case false:
              {
                // from old method (just comparing name with dbmoviedetail director name)
                if (actors[i].ToString().Contains(_movieDetails.Director))
                {
                  director = true;
                }
                else
                {
                  director = false;
                }
                break;
              }
          }
          string actor = (string)actors[i];
          string role = string.Empty;

          if (byImdbId == false)
          {
            int pos = actor.IndexOf(" as ");
            if (pos >= 0)
            {
              role = actor.Substring(pos + 4);
              actor = actor.Substring(0, pos);
            }
          }

          actor = actor.Trim();
          string line1 = GUILocalizeStrings.Get(986) + " " + (i + 1) + "/" + actors.Count;
          string line2 = actor;
          string line3 = string.Empty;
          OnProgress(line1, line2, line3, percent);
          _imdb.FindActor(actor);
          IMDBActor imdbActor = new IMDBActor();

          if (_imdb.Count > 0)
          {
            int index = FuzzyMatch(actor);
            if (index == -1)
            {
              index = 0;
            }
//.........这里部分代码省略.........
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:101,代码来源:IMDBFetcher.cs

示例10: SetActorInfo

 // Changed thumbURl added - IMDBActorID added
 public void SetActorInfo(int idActor, IMDBActor actor)
 {
   //"CREATE TABLE actorinfo ( idActor integer, dateofbirth text, placeofbirth text, minibio text, biography text
   try
   {
     if (null == m_db)
     {
       return;
     }
     string strSQL = String.Format("select * from actorinfo where idActor ={0}", idActor);
     SQLiteResultSet results = m_db.Execute(strSQL);
     if (results.Rows.Count == 0)
     {
       // doesnt exists, add it
       strSQL =
         String.Format(
           "insert into actorinfo (idActor , dateofbirth , placeofbirth , minibio , biography, thumbURL, IMDBActorID ) values( {0},'{1}','{2}','{3}','{4}','{5}','{6}')",
           idActor, DatabaseUtility.RemoveInvalidChars(actor.DateOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.MiniBiography),
           DatabaseUtility.RemoveInvalidChars(actor.Biography),
           DatabaseUtility.RemoveInvalidChars(actor.ThumbnailUrl),
           DatabaseUtility.RemoveInvalidChars(actor.IMDBActorID));
       m_db.Execute(strSQL);
     }
     else
     {
       // exists, modify it
       strSQL =
         String.Format(
           "update actorinfo set dateofbirth='{1}', placeofbirth='{2}' , minibio='{3}' , biography='{4}' , thumbURL='{5}' , IMDBActorID='{6}' where idActor={0}",
           idActor, DatabaseUtility.RemoveInvalidChars(actor.DateOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.PlaceOfBirth),
           DatabaseUtility.RemoveInvalidChars(actor.MiniBiography),
           DatabaseUtility.RemoveInvalidChars(actor.Biography),
           DatabaseUtility.RemoveInvalidChars(actor.ThumbnailUrl),
           DatabaseUtility.RemoveInvalidChars(actor.IMDBActorID));
       m_db.Execute(strSQL);
       RemoveActorInfoMovie(idActor);
     }
     for (int i = 0; i < actor.Count; ++i)
     {
       AddActorInfoMovie(idActor, actor[i]);
     }
     return;
   }
   catch (Exception ex)
   {
     Log.Error("videodatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
     Open();
   }
   return;
 }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:54,代码来源:VideoDatabaseSqlLite.cs

示例11: AddActorInfoMovie

 public void AddActorInfoMovie(int idActor, IMDBActor.IMDBActorMovie movie)
 {
   //idActor, idDirector , strPlotOutline , strPlot , strTagLine , strVotes , fRating ,strCast ,strCredits , iYear , strGenre , strPictureURL , strTitle , IMDBID , mpaa ,runtime , iswatched , role 
   string movieTitle = DatabaseUtility.RemoveInvalidChars(movie.MovieTitle);
   try
   {
     if (null == m_db)
     {
       return;
     }
     // Changed-added IMDBid value
     string strSQL =
       String.Format(
         "insert into actorinfomovies (idActor, idDirector , strPlotOutline , strPlot , strTagLine , strVotes , fRating ,strCast ,strCredits , iYear , strGenre , strPictureURL , strTitle , IMDBID , mpaa ,runtime , iswatched , role  ) values( {0} ,{1} ,'{2}' , '{3}' , '{4}' , '{5}' , '{6}' ,'{7}' ,'{8}' , {9} , '{10}' , '{11}' , '{12}' , '{13}' ,'{14}',{15} , {16} , '{17}' )",
         idActor, -1, "-", "-", "-", "-", "-", "-", "-", movie.Year, "-", "-", movieTitle, movie.imdbID, "-", -1, 0,
         DatabaseUtility.RemoveInvalidChars(movie.Role));
     m_db.Execute(strSQL);
     return;
   }
   catch (Exception ex)
   {
     Log.Error("videodatabase exception err:{0} stack:{1}", ex.Message, ex.StackTrace);
     Open();
   }
   return;
 }
开发者ID:djblu,项目名称:MediaPortal-1,代码行数:26,代码来源:VideoDatabaseSqlLite.cs

示例12: GrabActorDetails

    public static bool GrabActorDetails(string url, string wscript, out IMDBActor person)
    {
      LogMyFilms.Debug("launching (GrabActorDetails) with url = '" + url + "', wscript = '" + wscript + "'");

      person = new IMDBActor();
      var Grab = new Grabber_URLClass();
      var Result = new string[80];

      #region load internet data
      try
      {
        Result = Grab.GetDetail(url, "", wscript, false, null, null, null, null);
        // Result = Grab.GetDetail(url, downLoadPath, wscript, true, MyFilms.conf.GrabberOverrideLanguage, MyFilms.conf.GrabberOverridePersonLimit, MyFilms.conf.GrabberOverrideTitleLimit, MyFilms.conf.GrabberOverrideGetRoles, null);
        for (int i = 0; i < 40; i++) // copy mapped values to original values
        {
          Result[i] = Result[i + 40];
        }
      }
      catch (Exception ex)
      {
        LogMyFilms.ErrorException("GrabActorDetails() - exception = '" + ex.Message + "'", ex);
        return false;
      }
      #endregion

      #region load details data for person
      person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
      person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
      person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
      person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
      person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
      #endregion
      LogMyFilms.Debug("GrabActorDetails() done for person : '" + person.Name + "'");
      return true;
    }
开发者ID:drtak34,项目名称:my-films,代码行数:35,代码来源:MyFilmsDetail.cs

示例13: SetActorDetailsFromTmdb

    private static void SetActorDetailsFromTmdb(TmdbPerson tmdbPerson, TmdbConfiguration conf, ref IMDBActor imdbPerson)
    {
      if (tmdbPerson == null)
      {
        LogMyFilms.Debug("SetActorDetailsFromTMDB() - TMDB person is 'null' - return");
        return;
      }
      if (imdbPerson == null)
      {
        LogMyFilms.Debug("SetActorDetailsFromTMDB() - IMDB person is 'null' - return");
        return;
      }
      string tmdbProfileSize = "original";
      foreach (string profileSize in conf.images.profile_sizes.Where(profileSize => profileSize == "h632"))
      {
        tmdbProfileSize = profileSize;
      }

      // imdbPerson.IMDBActorID = 
      // imdbPerson.Name = tmdbPerson.name;
      // imdbPerson.MiniBiography = tmdbPerson.biography;
      // LogMyFilms.Debug("SetActorDetailsFromTMDB() - update IMDB name     - old : '" + imdbPerson.Name + "', new: '" + tmdbPerson.name + "'");
      if (!string.IsNullOrEmpty(tmdbPerson.biography) && tmdbPerson.biography.Length > imdbPerson.Biography.Length)
      {
        // LogMyFilms.Debug("SetActorDetailsFromTMDB() - update IMDB bio      - old : '" + imdbPerson.Biography + "', new: '" + tmdbPerson.biography + "'");
        imdbPerson.Biography = tmdbPerson.biography;
      }

      if (!string.IsNullOrEmpty(tmdbPerson.birthday))
      {
        LogMyFilms.Debug("SetActorDetailsFromTMDB() - update IMDB birthday - old : '" + imdbPerson.DateOfBirth + "', new: '" + tmdbPerson.birthday + "'");
        imdbPerson.DateOfBirth = tmdbPerson.birthday + ((!string.IsNullOrEmpty(tmdbPerson.deathday)) ? " (" + tmdbPerson.deathday + ")" : "");
      }
      if (!string.IsNullOrEmpty(tmdbPerson.place_of_birth))
      {
        LogMyFilms.Debug("SetActorDetailsFromTMDB() - update IMDB b-place  - old : '" + imdbPerson.PlaceOfBirth + "', new: '" + tmdbPerson.place_of_birth + "'");
        imdbPerson.PlaceOfBirth = tmdbPerson.place_of_birth;
      }
      if (!string.IsNullOrEmpty(tmdbPerson.profile_path))
      {
        LogMyFilms.Debug("SetActorDetailsFromTMDB() - update IMDB thumb    - old : '" + imdbPerson.ThumbnailUrl + "', new: '" + conf.images.base_url + tmdbProfileSize + tmdbPerson.profile_path + "'");
        imdbPerson.ThumbnailUrl = conf.images.base_url + tmdbProfileSize + tmdbPerson.profile_path;
      }
    }
开发者ID:drtak34,项目名称:my-films,代码行数:44,代码来源:MyFilmsDetail.cs

示例14: UpdatePersonDetails

    internal static bool UpdatePersonDetails(string personname, GUIListItem item, bool forceupdate, bool stopLoadingViewDetails)
    {
      if (!forceupdate && !Helper.PersonUpdateAllowed(MyFilms.conf.StrPathArtist, personname)) return false;

      string item1LabelOrg = (item != null) ? item.Label : "";
      string item3LabelOrg = (item != null) ? item.Label3 : "";
      string filename = MyFilms.conf.StrPathArtist + "\\" + personname + ".jpg";  // string filename = Path.Combine(MyFilms.conf.StrPathArtist, personname); //File.Exists(MyFilms.conf.StrPathArtist + "\\" + personsname + ".jpg")))

      IMDBActor person = null;
      bool vdBexists = false;

      if (item != null) item.Label = item1LabelOrg + " " + GUILocalizeStrings.Get(10799205); // (updating...)

      #region get person info from VDB
      if (item != null) item.Label3 = "Loading details from VDB ...";
      var actorList = new ArrayList();
      VideoDatabase.GetActorByName(personname, actorList);
      LogMyFilms.Debug("VDB - found '" + actorList.Count + "' local results for '" + personname + "'");
      if (actorList.Count > 0 && actorList.Count < 5)
      {
        LogMyFilms.Debug("VDB first search result: '" + actorList[0] + "'");
        string[] strActor = actorList[0].ToString().Split(new char[] { '|' });
        // int actorID = (strActor[0].Length > 0 && strActor.Count() > 1) ? Convert.ToInt32(strActor[0]) : 0; // string actorname = strActor[1];
        int actorId;
        int.TryParse(strActor[0], out actorId);
        if (actorId > 0)
        {
          person = VideoDatabase.GetActorInfo(actorId);
        }
        if (person != null)
        {
          if (item != null) item.Label3 = "ID = " + actorId + ", URL = " + person.ThumbnailUrl;
          vdBexists = true;
        }
        else
        {
          if (item != null) item.Label3 = "ID = " + actorId;
        }
      }
      #endregion

      if (person != null && File.Exists(filename) && !forceupdate && !person.Biography.ToLower().StartsWith("unknown") && !(person.Biography.Length > 8))
      {
        LogMyFilms.Debug("Skip update for '" + personname + "' - VDB entry and image already present !");
        if (item != null)
        {
          item.MusicTag = person;
          item.Label = item1LabelOrg;
          item.Label3 = item3LabelOrg;
        }
        if (stopLoadingViewDetails && item != null) return false; // stop download if we have exited window
        return true; // nothing to do
      }

      // region update person detail infos or load new ones ...
      if (person == null || person.DateOfBirth.Length < 1 || person.DateOfBirth.ToLower().StartsWith("unknown") || !File.Exists(filename) || forceupdate)
      {
        if (person == null) person = new IMDBActor();

        #region IMDB internet search
        if (item != null) item.Label3 = "Searching IMDB ...";

        string grabberscript = MyFilmsSettings.GetPath(MyFilmsSettings.Path.GrabberScripts) + @"\IMDB-Person.xml";
        if (File.Exists(grabberscript))
        {
          ArrayList personUrls = FindActor(personname, grabberscript);
          LogMyFilms.Debug("IMDB - " + personUrls.Count + " person(s) found for '" + personname + "' with person grabber script '" + grabberscript + "'"); 
          if (personUrls.Count > 0)
          {
            var wurl = (Grabber_URLClass.IMDBUrl)personUrls[0];
            if (wurl.URL.Length != 0)
            {
              if (item != null) item.Label3 = "Loading IMDB details ...";
              GrabActorDetails(wurl.URL, grabberscript, out person);
              LogMyFilms.Debug("IMDB - Value found - name       = '" + (person.Name ?? "") + "'");
              LogMyFilms.Debug("IMDB - Value found - birthday   = '" + (person.DateOfBirth ?? "") + "'");
              LogMyFilms.Debug("IMDB - Value found - birthplace = '" + (person.PlaceOfBirth ?? "") + "'");
              LogMyFilms.Debug("IMDB - Value found - biography  = '" + (person.Biography.Substring(0, Math.Min(person.Biography.Length, 100)) ?? "") + "'");
              LogMyFilms.Debug("IMDB - Value found - thumb url  = '" + (person.ThumbnailUrl ?? "") + "'");
            }
          }
        }
        else
        {
          LogMyFilms.Debug("IMDB - Default person grabber script not found (" + grabberscript + ")");
        }
        
        //var imdb = new IMDB();
        //imdb.FindActor(personname);
        //LogMyFilms.Debug("IMDB - " + imdb.Count + " person(s) found for '" + personname + "' with IMDB API");
        //if (imdb.Count > 0)
        //{
        //  if (imdb[0].URL.Length != 0)
        //  {
        //    if (item != null) item.Label3 = "Loading IMDB details ...";
        //    //#if MP1X
        //    // _imdb.GetActorDetails(_imdb[0], out person);
        //    //#else
        //    // _imdb.GetActorDetails(_imdb[0], false, out person);
        //    //#endif
//.........这里部分代码省略.........
开发者ID:drtak34,项目名称:my-films,代码行数:101,代码来源:MyFilmsDetail.cs

示例15: DownloadActors

 private static void DownloadActors(IMDBMovie movieDetails)
 {
   char[] splitter = {'\n', ','};
   string[] actors = movieDetails.Cast.Split(splitter);
   if (actors.Length > 0)
   {
     for (int i = 0; i < actors.Length; ++i)
     {
       int percent = (int)(i * 100) / (1 + actors.Length);
       int pos = actors[i].IndexOf(" as ");
       string actor = actors[i];
       if (pos >= 0)
       {
         actor = actors[i].Substring(0, pos);
       }
       actor = actor.Trim();
       string strThumb = Util.Utils.GetCoverArtName(Thumbs.MovieActors, actor);
       if (!File.Exists(strThumb))
       {
         _imdb.FindActor(actor);
         IMDBActor imdbActor = new IMDBActor();
         for (int x = 0; x < _imdb.Count; ++x)
         {
           _imdb.GetActorDetails(_imdb[x], false, out imdbActor);
           if (imdbActor.ThumbnailUrl != null && imdbActor.ThumbnailUrl.Length > 0)
           {
             break;
           }
         }
         if (imdbActor.ThumbnailUrl != null)
         {
           if (imdbActor.ThumbnailUrl.Length != 0)
           {
             int actorId = VideoDatabase.AddActor(actor);
             if (actorId > 0)
             {
               VideoDatabase.SetActorInfo(actorId, imdbActor);
             }
             //ShowProgress(GUILocalizeStrings.Get(1009), actor, "", percent);
             DownloadThumbnail(Thumbs.MovieActors, imdbActor.ThumbnailUrl, actor);
           }
           else
           {
             Log.Debug("GUIVideoFiles: url=empty for actor {0}", actor);
           }
         }
         else
         {
           Log.Debug("GUIVideoFiles: url=null for actor {0}", actor);
         }
       }
     }
   }
 }
开发者ID:npcomplete111,项目名称:MediaPortal-1,代码行数:54,代码来源:GUIVideoFiles.cs


注:本文中的MediaPortal.Video.Database.IMDBActor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。