English > Support

[SOLVED] AllMovie Cast(Actors) in custom items

(1/1)

Ivek23:
The AllMovie script:
I original code
--- Code: ---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;

--- End code ---
I replaced it with this code
--- Code: ---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;

--- End code ---

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

[attachment deleted by admin]

Ivek23:
Sorry for delete this post:Posted on: 01 October 2010, 20:14:14    Posted by: Ivek23


Here is More pvd_movie_tabs + AllMovie skins

Here is AllMovie movie skin tabs

Ivek23:
Rick.ca or Nostra

Can that code for Actors (Cast)

--- Code: ---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;

--- End code ---
added to the AllMovie + script for general use for all PVD users.

Thank you.
Ivek23

rick.ca:

--- Quote ---Can that code for Actors (Cast) added to the AllMovie+ script for general use for all PVD users?
--- End quote ---

I updated AllMovie+ a few months ago for my own use, but did not post the update. I've done so now, here. 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.

Ivek23:
OK, I understand, thanks for the reply and clarification.

Navigation

[0] Message Index

Go to full version