English > Scripts and Templates

AllMovie script for People:Questions

<< < (2/3) > >>

Ivek23:

--- Quote from: Ivek23 on April 07, 2011, 06:55:06 pm ---For assistance:
For example, people url

http://www.allmovie.com/artist/george-gabby-hayes-31223

http://www.allmovie.com/artist/geoffrey-rush-151418

http://www.allmovie.com/artist/geoffrey-lewis-42203

http://www.allmovie.com/artist/gene-wilder-116771

Added a script to facilitate assistance.

If this change
this AddFieldValue(pfFilmography, TmpStr);
in this
AddFieldValue(pfBio, TmpStr);
I just transferred filmography but not a biography.


--- End quote ---

I worked a lot of tests but I could not find the right code, maybe someone might have some idea or solution for this,


--- Code: ---function RemoveTagsEx(AText : String) : String;
var
 B, E : Integer;
begin
 Result := AText;

 B := PosFrom('<', Result, 1);
 E := PosFrom('>', Result, B);

 while (B > 0) AND (B < E) do begin
  Delete(Result, B, E - B + 1);

  B := Pos('<', Result);
  E := Pos('>', Result);
 end;
end;

procedure ParseBiography(HTML : String);
var
 curPos, endPos : Integer;
 TmpStr, TmpStr1, TmpStr2 : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 endPos := curPos
 if curPos < 1 then
  Exit;
  
 //Biography
 curPos := PosFrom('<td colspan="2">', HTML, curPos);
 endPos := PosFrom('</p></td>', HTML, curPos);
 TmpStr := Copy(HTML, curPos, EndPos - curPos);
 TmpStr1 := StringReplace(TmpStr, ' -- ', '—', True, True, False);
 TmpStr2 := StringReplace(TmpStr1, ' --- ', '—', True, True, False);
 TmpStr := StringReplace(TmpStr2, '--', '—', True, True, False);
 TmpStr1 := StringReplace(TmpStr, #13#13#13#13, #13#10#13#10, True, True, False);
 TmpStr2 := RemoveTagsEx(TmpStr1);
 AddFieldValue(pfBio, 'Biography:' + #13 + TmpStr2);
 end;

--- End code ---

and


--- Code: ---procedure ParseFilmography(HTML : String);
var
 curPos, EndPos : Integer;
 TmpStr : String;
 Name, Role, URL, Year, Aka, Artist : String;
begin
 curPos := Pos('<div id="results-table">', HTML);
 if curPos < 1 then
  Exit;
  
 LogMessage('Pasrsing filmography...');
 
 TmpStr := '';

 EndPos := curPos;
 EndPos := PosFrom('width="35" align="center', HTML, curPos);
 curPos := PosFrom('">', HTML, EndPos) + 2;
 EndPos := PosFrom('</td>', HTML, curPos);
 
 Year := Trim(Copy(HTML, curPos, EndPos - curPos));

 EndPos := curPos;
 curPos := PosFrom('http://www.allmovie.com/work/', 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('<td>', HTML, EndPos);
  if curPos > 0 then begin
   curPos := curPos + 4;
   EndPos := PosFrom('</td>', 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 Year <> '' then
   TmpStr := TmpStr + '(' + Year + ')' + '  ';      
 
  EndPos := PosFrom('width="35" align="center">', HTML, curPos);
  curPos := curPos + Length('<tr><small>');
  EndPos := PosFrom('</td>', HTML, curPos);
  
  Aka := Copy(HTML, curPos + 5, EndPos - curPos - 16);

  EndPos := curPos;
  EndPos := PosFrom('width="130', HTML, curPos);
  curPos := PosFrom('">', HTML, EndPos) + 2;
  EndPos := PosFrom('</td>', HTML, curPos);

  Artist := Copy(HTML, curPos, EndPos - curPos);

  EndPos := curPos;
  EndPos := PosFrom('width="35" align="center', HTML, curPos);
  curPos := PosFrom('">', HTML, EndPos) + 2;
  EndPos := PosFrom('</td>', HTML, curPos);

  Year := Copy(HTML, curPos, EndPos - curPos);

  if Artist <> '' then
   TmpStr := TmpStr + '-  ' +  Artist;
  if Aka <> '' then
   TmpStr := TmpStr + #13 + 'Aka''s:  ' + Aka;
  
  if curPos > 0 then
   curPos := PosFrom('http://www.allmovie.com/work/', HTML, curPos)
  else
   Exit;  
 end;

 AddFieldValue(pfBio, 'Filmography:' + #13 + #13 + TmpStr);
end;

--- End code ---

that would bring together the biography and filmography in field Biography.

Ivek23:

--- Quote ---that would bring together the biography and filmography in field Biography.

--- End quote ---

or even both at once can copy together in one box.

Ivek23:

--- Quote from: Ivek23 on April 17, 2011, 12:38:02 pm ---
--- Quote ---that would bring together the biography and filmography in field Biography.

--- End quote ---

or even both at once can copy together in one box.

--- End quote ---

After many tests, I still have not found the right code, but still has only a data transfer for only Biography or for only a filmography.

Ivek23:
For perhaps any ideas or solutions from of previous post's here is E-mail for Guest:
Ivanrupnik@simobil.net - not work anymore

new E-mail
ivan.rupnik@amis.net

Ivek23:
Attention to important:

AllMovie script for People do not work anymore.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version