本文整理汇总了C#中MediaPortal.Video.Database.IMDBActor.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IMDBActor.Add方法的具体用法?C# IMDBActor.Add怎么用?C# IMDBActor.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaPortal.Video.Database.IMDBActor
的用法示例。
在下文中一共展示了IMDBActor.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetActorMovies
//.........这里部分代码省略.........
{
// Check for cases like "(movie type)(role)" and use "(role)" only
MatchCollection mc = Regex.Matches(title, @"\([^)]+\)");
if (mc.Count > 0)
{
if (mc.Count > 1)
{
wRole = mc[mc.Count - 1].Value;
}
else
{
wRole = mc[0].Value;
}
}
else
{
continue;
}
if (!string.IsNullOrEmpty(wRole))
{
// Remove parentheses (leave text inside)
wRole = Regex.Replace(wRole, "([(]|[)])", string.Empty);
role = GUILocalizeStrings.Get(200) + " " + wRole;
}
else
{
role = GUILocalizeStrings.Get(200).Replace(":", string.Empty);
}
}
}
int year = 0;
// Set near future for movies without year (99% it's a future project)
if (!Int32.TryParse(strYear, out year))
{
year = DateTime.Today.Year + 3;
}
IMDBActor.IMDBActorMovie actorMovie = new IMDBActor.IMDBActorMovie();
title = Util.Utils.RemoveParenthesis(title).Trim();
role = Util.Utils.RemoveParenthesis(role).Trim();
actorMovie.MovieTitle = title;
actorMovie.Role = role;
actorMovie.Year = year;
actorMovie.MovieImdbID = imdbID;
// Check if director/writer movie exists in actors movies, concatenate role
// to already fetched actor movie (no duplicate movie entries)
bool skipAdd = false;
if (writer)
{
for (int i = 0; i < actor.Count; i++)
{
if (actor[i].MovieImdbID == imdbID)
{
if (actor[i].Role != string.Empty)
{
actor[i].Role = role + ", " + actor[i].Role;
}
else
{
actor[i].Role = role;
}
skipAdd = true;
break;
}
}
}
if (director)
{
for (int i = 0; i < actor.Count; i++)
{
if (actor[i].MovieImdbID == imdbID)
{
if (actor[i].Role != string.Empty)
{
actor[i].Role = role + ", " + actor[i].Role;
}
else
{
actor[i].Role = role;
}
skipAdd = true;
break;
}
}
}
if (!skipAdd)
{
actor.Add(actorMovie);
}
}
}
}
}
示例2: 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;
}
示例3: 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;
}
//.........这里部分代码省略.........
示例4: GetActorDetails
//.........这里部分代码省略.........
{
if (parser.skipToEndOf("name=\"Actress\">Actress</a>") || parser.skipToEndOf("name=\"Actor\">Actor</a>"))
{
isActorPass = true;
}
}
// Get filmography
if (isDirectorPass | isActorPass)
{
string movies = string.Empty;
// Get films and roles block
if (parser.extractTo("<div id", ref movies))
{
parser.Content = movies;
}
// Parse block for evey film and get year, title and it's imdbID and role
while (parser.skipToStartOf("<span class=\"year_column\""))
{
string movie = string.Empty;
if (parser.extractTo("<div class", ref movie))
{
movie += "</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("title/");
movieParser.extractTo("/", ref imdbID);
// Title
movieParser.resetPosition();
movieParser.skipToEndOf("<a");
movieParser.skipToEndOf(">");
movieParser.extractTo("<br/>", ref title);
title = Util.Utils.stripHTMLtags(title);
title = title.Replace("\n", " ").Replace("\r", string.Empty);
title = HttpUtility.HtmlDecode(title.Trim()); // Remove HTML entities like ½
// Year
movieParser.resetPosition();
if (movieParser.skipToStartOf(">20") &&
movieParser.skipToEndOf(">"))
{
movieParser.extractTo("<", ref strYear);
}
else if (movieParser.skipToStartOf(">19") &&
movieParser.skipToEndOf(">"))
{
movieParser.extractTo("<", ref strYear);
}
// Roles
if ((director == false) && (movieParser.skipToEndOf("<br/>"))) // Role case 1, no character link
{
movieParser.extractTo("<", ref role);
role = Util.Utils.stripHTMLtags(role).Trim();
role = HttpUtility.HtmlDecode(role.Replace("\n", " ")
.Replace("\r", string.Empty).Trim());
if (role == string.Empty) // Role case 2, with character link
{
movieParser.resetPosition();
movieParser.skipToEndOf("<br/>");
movieParser.extractTo("</a>", ref role);
role = Util.Utils.stripHTMLtags(role).Trim();
role = HttpUtility.HtmlDecode(role.Replace("\n", " ")
.Replace("\r", string.Empty).Trim());
}
}
else
{
// Just director
if (director)
role = "Director";
}
int year = 0;
try
{
year = Int32.Parse(strYear.Substring(0, 4));
}
catch (Exception)
{
year = 1900;
}
IMDBActor.IMDBActorMovie actorMovie = new IMDBActor.IMDBActorMovie();
actorMovie.MovieTitle = title;
actorMovie.Role = role;
actorMovie.Year = year;
actorMovie.imdbID = imdbID;
actor.Add(actorMovie);
}
}
}
return true;
}
catch (Exception ex)
{
Log.Error("IMDB.GetActorDetails({0} exception:{1} {2} {3}", url.URL, ex.Message, ex.Source, ex.StackTrace);
}
return false;
}
示例5: 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;
}