Poll

How are you appearance of Actors custom fields:

Good
1 (100%)
Poor
0 (0%)

Total Members Voted: 1

Author Topic: [SOLVED] AllMovie Cast(Actors) in custom items  (Read 6268 times)

0 Members and 1 Guest are viewing this topic.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2667
    • View Profile
[SOLVED] AllMovie Cast(Actors) in custom items
« 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]
« Last Edit: November 14, 2010, 08:09:23 am by rick.ca »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2667
    • View Profile
Re: AllMovie Cast(Actors) in custom items
« Reply #1 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

Here is AllMovie movie skin tabs
« Last Edit: November 11, 2010, 09:06:54 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2667
    • View Profile
Re: AllMovie Cast(Actors) in custom items
« Reply #2 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
« Last Edit: November 11, 2010, 09:20:46 pm by Ivek23 »
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline rick.ca

  • Global Moderator
  • *****
  • Posts: 3241
  • "I'm willing to shoot you!"
    • View Profile
Re: AllMovie Cast(Actors) in custom items
« Reply #3 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. 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.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2667
    • View Profile
Re: AllMovie Cast(Actors) in custom items
« Reply #4 on: November 12, 2010, 07:40:18 am »
OK, I understand, thanks for the reply and clarification.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD