Personal Video Database

English => Support => Topic started by: Ivek23 on June 16, 2010, 09:45:18 am

Title: [SOLVED] AllMovie Cast(Actors) in custom items
Post by: Ivek23 on June 16, 2010, 09:45:18 am
The AllMovie script:
I original code
Code: [Select]
procedure ParseCast(HTML : String);
var
 curPos, EndPos : Integer;
 Name, Role, URL : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 if curPos < 1 then
  Exit;
  
  
 //Actors              
 EndPos := curPos;
 curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</table>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
  
  URL := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
  
  Name := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := PosFrom('<em>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 4;
   EndPos := PosFrom('</em>', HTML, curPos);
  
   Role := Trim(Copy(HTML, curPos, EndPos - curPos));
  end else begin
   Role := '';  
   curPos := EndPos;
  end;
  
  AddMoviePerson(Name, '', Role, URL, ctActors);

  if curPos > 0 then
   curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos)
  else
   Exit;  
 end;
end;
I replaced it with this code
Code: [Select]
procedure ParseCast(HTML : String);
var
curPos, EndPos : Integer;
 TmpStr : String;
 Name, Role, URL : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 if curPos < 1 then
  Exit;
  
  TmpStr := '';
  
 EndPos := curPos;
 curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</table>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
  
  URL := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
  
  Name := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := PosFrom('<em>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 4;
   EndPos := PosFrom('</em>', HTML, curPos);
  
   Role := Trim(Copy(HTML, curPos, EndPos - curPos));
  end else begin
   Role := '';  
   curPos := EndPos;
  end;
  
  if TmpStr <> '' then
   TmpStr := TmpStr + #13;  
  if URL <> '' then
   TmpStr := TmpStr + '<link url="' + URL + '">';
  TmpStr := TmpStr + Name;
  if Role <> '' then
   TmpStr := TmpStr + ' - ' + Role;
  if URL <> '' then
   TmpStr := TmpStr + '</link>';

  if curPos > 0 then
   curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos)
  else
   Exit;  
 end;
  
 AddCustomFieldValueByName('Actors', TmpStr);
end;

Actors are now in the custom items (custom items: custom field Actors and Memo field) just as Production.

[attachment deleted by admin]
Title: Re: AllMovie Cast(Actors) in custom items
Post by: Ivek23 on November 11, 2010, 08:57:17 pm
Sorry for delete this post:Posted on: 01 October 2010, 20:14:14    Posted by: Ivek23


Here is More pvd_movie_tabs + AllMovie skins (http://www.videodb.info/forum_en/index.php?topic=2131.0)

Here is AllMovie movie skin tabs (http://www.videodb.info/forum_en/index.php?topic=2133.0)
Title: Re: AllMovie Cast(Actors) in custom items
Post by: Ivek23 on November 11, 2010, 09:11:00 pm
Rick.ca or Nostra

Can that code for Actors (Cast)
Code: [Select]
procedure ParseCast(HTML : String);
var
curPos, EndPos : Integer;
 TmpStr : String;
 Name, Role, URL : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 if curPos < 1 then
  Exit;
  
  TmpStr := '';
  
 EndPos := curPos;
 curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos);
 while (curPos > 0) AND (curPos < PosFrom('</table>', HTML, EndPos)) do begin
  EndPos := PosFrom('">', HTML, curPos);
  
  URL := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := EndPos + 2;
  EndPos := PosFrom('</a>', HTML, curPos);
  
  Name := Copy(HTML, curPos, EndPos - curPos);
  
  curPos := PosFrom('<em>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 4;
   EndPos := PosFrom('</em>', HTML, curPos);
  
   Role := Trim(Copy(HTML, curPos, EndPos - curPos));
  end else begin
   Role := '';  
   curPos := EndPos;
  end;
  
  if TmpStr <> '' then
   TmpStr := TmpStr + #13;  
  if URL <> '' then
   TmpStr := TmpStr + '<link url="' + URL + '">';
  TmpStr := TmpStr + Name;
  if Role <> '' then
   TmpStr := TmpStr + ' - ' + Role;
  if URL <> '' then
   TmpStr := TmpStr + '</link>';

  if curPos > 0 then
   curPos := PosFrom('http://www.allmovie.com/artist/', HTML, curPos)
  else
   Exit;  
 end;
  
 AddCustomFieldValueByName('Actors', TmpStr);
end;
added to the AllMovie + script for general use for all PVD users.

Thank you.
Ivek23
Title: Re: AllMovie Cast(Actors) in custom items
Post by: rick.ca on November 11, 2010, 10:46:21 pm
Quote
Can that code for Actors (Cast) added to the AllMovie+ script for general use for all PVD users?

I updated AllMovie+ a few months ago for my own use, but did not post the update. I've done so now, here (http://www.videodb.info/forum_en/index.php?topic=1232.msg4393#msg4393). My modification is not the same as yours—I describe it as "Modified ParseCast procedure to save entire Cast tab to custom memo field, as well as individual actors." In other words, it will do both. It will add actors in the normal manner, if permitted to do so by the overwrite setting. It will also add all the actors (in the form of their AllMovie links) to a custom memo field named Cast.
Title: Re: AllMovie Cast(Actors) in custom items
Post by: Ivek23 on November 12, 2010, 07:40:18 am
OK, I understand, thanks for the reply and clarification.