Author Topic: Script for egafd.com  (Read 129371 times)

0 Members and 3 Guests are viewing this topic.

Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Script for egafd.com
« on: November 24, 2011, 09:26:41 am »
Hello!
First sorry for my english (i'm french)!

I tried to make a script to download data from egafd.com, adapted to the iafd script.
Script :
//This version of script is for use with PVD versions 0.9.9.16 and above!!!
 (*
 Additional types and functions that can be used in scripts:

  //Types
  TWIDEARRAY : array of String

  //Field functions
  procedure AddSearchResult(Title1, Title2, Year, URL, PreviewURL : String)
  procedure AddFieldValue(AField: Integer; AValue : String)
  procedure AddMoviePerson(Name, TransName, Role, URL : String; AType : Byte)
  procedure AddPersonMovie(Title, OrigTitle, Role, Year, URL : String; AType : Byte)
  procedure AddAward(Event, Award, Category, Recipient, Year: String; const Won : Boolean)
  procedure AddConnection(Title, OrigTitle, Category, URL, Year: String)
  procedure AddEpisode(Title, OrigTitle, Description, URL, Year, Season, Episode : String)
 
  //String functions
  function Pos(Substr : String; Str: String): Integer
  function PosFrom(const SubStr, Str : String; FromIndex : Integer) : Integer
  function LastPos(const SubStr, Str : String) : Integer
  function PrevPos(const SubStr, Str : String; APos : Integer) : Integer
  function RemoveTags(AText : String; doLineBreaks : Boolean) : String
  function ExplodeString(AText : String; var Items : TWideArray; Delimiters : String) : Integer
  function Copy(S: String; Index, Count: Integer): String
  procedure Delete(var S: String; Index, Count: Integer)
  procedure Insert(Source: String; var Dest: String; Index: Integer)
  function Length(S: String): Integer
  function Trim(S: String): String
  function CompareText(S1, S2: String): Integer
  function CompareStr(S1, S2: String): Integer
  function UpperCase(S: String): String
  function LowerCase(S: String): String
  function StringReplace(S, OldPattern, NewPattern: String; ReplaceAll : Boolean; IgnoreCase : Boolean; WholeWord: Boolean): String
  function StrToInt(const S: String): Integer
  function IntToStr(const Value: Integer): String
  function StrToFloat(const S: String): Extended
  function FloatToStr(const Value: Extended): String

  function HTMLValues(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String
  function HTMLValues2(const HTML : String; ABegin, AEnd, ItemBegin, ItemEnd : String; ValDelim : String; var Pos : Integer) : String
  function TextBetween(const HTML : String; ABegin, AEnd : String; doLineBreaks : Boolean; var Pos : Integer) : String
  function HTMLToText(const HTML : String) : String

  procedure ShowMessage(const Msg, Head : String)
*)

const
 pauseBeforeLoad = 1000; // Pause before loading (in millisecond)

//Some useful constants
const
 //Script types
 stMovies = 0;
 stPeople = 1;
 stPoster = 2;
 
 //Script modes
 smSearch = 0;
 smNormal = 1;
 smPoster = 2;
 
 //Parse results
 prError     = 0;
 prFinished  = 1;
 prList      = 2;
 prListImage = 3;
 prDownload  = 4;
 
 //Movie fields
 mfURL         = 0;
 mfTitle       = 1;
 mfOrigTitle   = 2;
 mfAka         = 3;
 mfYear        = 4;
 mfGenre       = 5;
 mfCategory    = 6;
 mfCountry     = 7;
 mfStudio      = 8;
 mfMPAA        = 9;
 mfRating      = 10;
 mfTags        = 11;
 mfTagline     = 12;
 mfDescription = 13;
 mfDuration    = 14;
 mfFeatures    = 15;

 
 //People fields
 pfURL        = 0;
 pfName       = 1;
 pfTransName  = 2;
 pfAltNames   = 3;
 pfBirthday   = 4;
 pfBirthplace = 5;
 pfGenre      = 6;
 pfBio        = 7;
 pfDeathDate  = 8;
 
 //Credits types
 ctActors    = 0;
 ctDirectors = 1;
 ctWriters   = 2;
 ctComposers = 3;
 ctProducers = 4;
 
 //Script data
 //This version of script is for use with PVD versions 0.9.9.16 and above!!!

 SCRIPT_VERSION = '0.0.0.1';
 SCRIPT_NAME    = 'EGAFD.com';
 SCRIPT_DESC    = '[EN] Get movie information from EGAFD.com';
 SCRIPT_LANG    = $09; //English
 SCRIPT_TYPE    = stMovies;
 
 BASE_URL    = 'http://www.egafd.com';
 RATING_NAME = 'ADE';

 SEARCH_STR  = 'www.egafd.com/results.asp?SearchType=Mozilla-search&SearchString=%s';
 
 CODE_PAGE   = 0; //Use 0 for Autodetect

 
//Global variables
var
 Mode : Byte;
 PosterURL : String;

//Functions
function GetScriptVersion : String;
begin
 Result := SCRIPT_VERSION;
end;
 
function GetScriptName : String;
begin
 Result :=  SCRIPT_NAME;
end;

function GetScriptDesc : String;
begin
 Result := SCRIPT_DESC;
end;

function GetRatingName : String;
begin
 Result := RATING_NAME;
end;

function GetScriptLang: Cardinal;
begin
 Result := SCRIPT_LANG;
end;

function GetCodePage : Cardinal;
begin
 Result := CODE_PAGE;
end;

function GetBaseURL : AnsiString;
begin
 Result := BASE_URL;
end;

function GetDownloadURL : AnsiString;
begin
 if PosterURL = '' then
  Result := SEARCH_STR
 else
  Result := PosterURL;
end;

function GetScriptType : Byte;
begin
 Result := SCRIPT_TYPE;
end;

function GetCurrentMode : Byte;
begin
 Result := Mode;
end;

procedure FindPoster(HTML : String);

var
 curPos, EndPos : Integer;
begin
LogMessage('procedure Findposter en cours')
// curPos := Pos('<span class="Item_ViewTitle">Box Cover</span>', HTML);
// curPos := PosFrom('<img src="', HTML, curPos);
// curPos := curPos + Length('<img src="');
// EndPos := PosFrom('"', HTML, curPos);
 
// PosterURL := Copy(HTML, curPos, EndPos - curPos);
end;
 
// ParseMovie
//  - after searchlist selection this function is called with the new html content
procedure ParseMovie(MovieURL : String; HTML : String);

var
 curPos, EndPos, P, P2, L: Integer;
 actPosStart,actPosStart2,
actPosEnd, UrlPosStart,UrlPosEnd,debug_pos1:Integer;
 Tmp, URL, Name,dbgstrg,tmpstrg : String;
 ActorNames: TWideArray;
 ActorNumber,I,J: Integer;
begin
    AddFieldValue(mfURL, MovieURL);
    LogMessage('Page parsing started');
    EndPos := 1;

   //Check for title. No orig. title info present, so duplicate..
   dbgstrg:= TextBetween(HTML, '<title>', '</title>', False, EndPos);
   LogMessage('Title: ' + dbgstrg);
   AddFieldValue(mfOrigTitle,dbgstrg);
   AddFieldValue(mfTitle,dbgstrg);
   
   //Year
   dbgstrg := '';
   CurPos := Pos('Released: ', HTML);
   endpos := CurPos;
         LogMessage('getting year');
         dbgstrg := TextBetween(HTML, '">', '</td>', False, CurPos);
         LogMessage('YEAR:' + dbgstrg);
         AddFieldValue(mfYear,dbgstrg);
   
   //Director
   curPos := Pos('Director: ', HTML);
   EndPos := curPos;
         LogMessage('getting Director');
         dbgstrg:= TextBetween(HTML, '">', '</td>', False, CurPos);
         LogMessage('DIRECTOR:' + dbgstrg);
         AddMoviePerson(dbgstrg, '', '', '', ctDirectors);


   //Notes
   curpos := Pos('Notes: ' , HTML);
   EndPos := curPos;
         LogMessage('Notes')
         dbgstrg := TextBetween(HTML, '">', '</td>', False, CurPos);
         LogMessage('Notes :' + dbgstrg);
         AddFieldValue(mfDescription, dbgstrg);
   
   //AKA - Titles...
   LogMessage('getting all titles')
   Curpos := Pos('<th>Alternate Titles</th>' ,HTML);
   EndPos := curPos;
      while (curPos > 0) AND (curPos < PosFrom('<th>Actresses</th>', HTML, EndPos)) do begin
         EndPos := curPos;
         actPosStart := PosFrom('class="flma"', HTML, EndPos);
         actPosEnd := PosFrom('</span>', HTML, actPosStart);
         dbgstrg := Trim(Copy(HTML, (actPosstart + 13), (actPosEnd - actPosStart - 13) ));
         LogMessage('AKA: ' + dbgstrg);
         AddFieldValue(mfAka, dbgstrg);
         curpos := PosFrom('class="flma"', HTML, actPosEnd);
      end;
   
   //Cast
   curPos:= Pos('<th>Actresses</th>', HTML);
   LogMessage('Cast readout');
   if curPos > 0 then    begin
   EndPos := curPos;
      while (curPos > 0) AND (curPos < PosFrom('<th>Notes</th>', HTML, EndPos)) do begin
      
         EndPos := curPos; // Set last position to actual position
         // get url
         UrlPosStart := PosFrom('href="', HTML, EndPos);  // search for url start
         UrlPosEnd := PosFrom('>', HTML, UrlPosStart);  // search for url end
      
         URL := BASE_URL + Trim(Copy(HTML, UrlPosStart + 6, (UrlPosEnd - UrlPosStart - 7) ));
   
         LogMessage(URL);
   
         // Get Name
         actPosStart := PosFrom('href="', HTML, EndPos);   // search for url start;
         actPosStart2 := PosFrom('">', HTML, actPosStart)
         actPosEnd:=PosFrom('</a>', HTML, actPosStart2);    // search for url end
         Name := Trim(Copy(HTML, (actPosStart2 + 2), (actPosEnd - actPosStart2 - 2) ));
         LogMessage(Name);
      
         debug_pos1:=Pos('(',Name);
            if debug_pos1 >0 then
            Name := Copy(Name,0,debug_pos1-1);
            LogMessage(Name);
      
            AddMoviePerson(Trim(Name), '', '', LowerCase(URL), ctActors);
                  
            curPos := PosFrom('href="', HTML, actPosEnd);
             end;
      end;

end; // End of the routine...


// ParseSearchResults
// - create list of movies found during the search
procedure ParseSearchResults(HTML : String);
var
 curPos, EndPos, P : Integer;
 Title, Year, URL, Studio : String;
begin
   LogMessage('procedure ParseSearchResults en cours')
   EndPos := 1;
   LogMessage('Parsing movie list...');
   curPos := PosFrom('<dt>', HTML, EndPos);
   
   while curPos > 0 do
      begin
      // Each movie entry starts with <dt>
      EndPos := curPos + Length('<dt>');
         curPos := PosFrom('<a href="', HTML, EndPos);
         if curPos > 0 then       begin
            curPos := curPos + Length('<a href="');
            EndPos := PosFrom('"', HTML, curPos);
            URL := BASE_URL + '/' + Copy(HTML, curPos, EndPos - curPos);
            LogMessage('URL detected: '+URL);
         end;
         Title := TextBetween(HTML, '>', '</a>', False, EndPos);
         LogMessage(Title);

         // Now that we got the title, move on to the studio...
         curPos := PosFrom('<b>Release Info:</b>', HTML, EndPos);
         
         if curPos > 0 then begin
            curPos := curPos + Length('<b>Release Info:</b>') + 1;
            EndPos := PosFrom(',', HTML, curPos);
         
            Studio := Copy(HTML, curPos, EndPos - curPos);
            LogMessage(Studio);
            curPos := EndPos +  2;
            EndPos := PosFrom('<', HTML, curPos);
            Year := Copy(HTML, curPos, EndPos - curPos);
            LogMessage(Year);
         end;
     AddSearchResult(Title, Studio, Year, URL, '');

     curPos := PosFrom('<dt>', HTML, EndPos);
    end;
end;

// ParsePage
// - Entrypoint for the script. Check if the search-term leads to zero, one or many results.
function ParsePage(HTML : String; URL : AnsiString) : Cardinal;
begin
   Wait (pauseBeforeLoad);
   LogMessage('Script version:' + SCRIPT_VERSION);
      Mode := smNormal;
      ParseMovie(URL, HTML);
      Result := prFinished; //script has finished it's job
      {Result := prError; //error (unknown page retrieved)}
end;

begin
 Mode := smSearch;
end.


For use this script, the URL of the page must be indicate in the data movie before execute.
The data transfered are good in my PC!

My problem is to write "notes" in field comment and not in field description!
I tried to declare "mfComment = 16;" but no data are transfered!

If somebody is interested, or can improve it!
Thanks a lot!
« Last Edit: November 24, 2011, 09:37:06 am by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #1 on: November 25, 2011, 10:39:22 am »
Welcome, pra15

Quote
My problem is to write "notes" in field comment and not in field description!
I tried to declare "mfComment = 16;" but no data are transfered!

As the first "mfComment" not yet exist and does not work yet.
It is a solution ot the PVD settings looking at the attached picture. Now the information in the comment box.

Since the author did not do psf files, egafd.psf is now attached in this reply.

[attachment deleted by admin]
« Last Edit: November 25, 2011, 02:17:10 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 pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #2 on: November 25, 2011, 11:11:07 pm »
Thanks a lot !

I try now with egafd_people, but my script doesn't work!

When i look the log, the values are good but no data are tranfered to my PC !

[attachment deleted by admin]
« Last Edit: November 25, 2011, 11:13:32 pm by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #3 on: November 26, 2011, 03:31:24 pm »
Quote
I try now with egafd_people, but my script doesn't work!

With pre-made ​​duplicate url script works, but info does not transfer data.
Sorry, but unfortunately you can not help.
It might be good to have a review of the movie scripts and try to maybe do a similar script as the AllMovie script or Rovi script or on the basis of these scripts to make changes, that the script is ready to transfer data from http://www.egafd.com .
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #4 on: November 26, 2011, 11:32:02 pm »
Ok this script works for me,
I simplified it in maximum.
After have taken info about a movie with script egafd.psf, you have URL and name for actresse in egafd.
Now you can use this script egafd_people.psf for download photo and pseudonyms.

Is it possible to insert a link (to web page) in the field Biographie?
I try <Link="www......">Name</Link> but when i click in, nothing happens!

[attachment deleted by admin]
« Last Edit: November 26, 2011, 11:42:34 pm by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #5 on: November 27, 2011, 07:55:16 am »
For egafd.psf

Code: [Select]
//Notes
   curpos := Pos('Notes: ' , HTML);
   EndPos := curPos;
         LogMessage('Notes')
         dbgstrg := TextBetween(HTML, '">', '</td>', False, CurPos);
         LogMessage('Notes :' + dbgstrg);
         AddFieldValue(mfDescription, dbgstrg);

Proposal:
  AddFieldValue(mfDescription, dbgstrg);

Replace this

AddFieldValue(mfTagline, dbgstrg);

You can add yet Notes: (Description) in a similar manner as in people added pfBio

-------------------------------------------------------------------
Here you is an updated egafd_people.psf
Is now added pfbio (films).


Script is attached.




[attachment deleted by admin]
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #6 on: November 27, 2011, 08:16:22 am »
Hello,
Thank you, great.

I wanted make this, but it's for the reason of my last question.
Is it possible to incorporate the link (clickable) of the movie (from egafd and not link title of the database) in the list of movie?
« Last Edit: November 27, 2011, 08:23:46 am by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #7 on: November 27, 2011, 10:53:50 am »
Quote
I try <Link="www......">Name</Link> but when i click in, nothing happens!

Code: [Select]
<Link="www......">Name</Link>

This is wrong (not correct), so can not work.

Try something like the following

Code: [Select]
'<link url="' + PeopleURL + '">' + Name + '</link>'

or is this

Code: [Select]
'<link url="' + MovieURL + '">' + Title + '</link>'

or something similar as previously described.

Or, do like code as the code in egafd.psf  for Cast.

I apologize if I did not understand everything correctly on this issue, but I hope that the answer was still helpful.

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: 2738
    • View Profile
Re: Script for egafd.com
« Reply #8 on: November 27, 2011, 11:27:21 am »
Code: [Select]
procedure ParseCast(HTML : String);
var
curPos, endPos : Integer;
TmpStr : String;
Name, Role, URL : String;
begin
curPos := Pos('<div class="tabset-content main-tab-pane">', HTML);
if curPos < 1 then

curPos := Pos('<div class="description-box">', HTML);
if curPos < 1 then
Exit;
 
TmpStr := '';

endPos := curPos;
curPos := PosFrom('http://www.allrovi.com/name/', 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('>', HTML, endPos);
if curPos > 0 then begin
curPos := curPos + 2;
endPos := PosFrom('</td', HTML, curPos);
Role := Copy(Trim(Copy(HTML, curPos + 4, endPos - curPos - 4)), 5, endPos - curPos - 4);
end else begin
Role := '';
curPos := endPos;
end;

if GET_ACTORS then
AddMoviePerson(Name, '', '', URL, ctActors);

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.allrovi.com/name/', HTML, curPos)
else
Exit;
end;

AddCustomFieldValueByName('Cast', TmpStr);

Perhaps you will keep this code something to help, how to integrate TmpStr and then how to continue, is copy that URL, that you want to copy in the database.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #9 on: November 27, 2011, 11:54:55 am »
Ok, thanks,
manually, <link url= works good, i will try to incorporate this in the script later.
I'm trying to add function of search within the url at start.

Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #10 on: November 27, 2011, 05:32:36 pm »
 >:(

Hello,

I'm blocked !!!!!
I search to obtain the value of the URL start.
I tried with : getfieldvalue(pfurl) but this give me a number and not a url !!!!  ???

Sorry i'm not a developer!

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #11 on: November 27, 2011, 06:09:15 pm »
Quote
Sorry i'm not a developer!

Me neither.
Attempts to examine Rovi script or AllMovie script, if you will do any good.

egafd_mod.psf is attached

[attachment deleted by admin]
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: 2738
    • View Profile
Re: Script for egafd.com
« Reply #12 on: November 28, 2011, 06:47:46 pm »
I'm blocked !!!!!
I search to obtain the value of the URL start.
I tried with : getfieldvalue(pfurl) but this give me a number and not a url !!!! 

You can add this code in a reply if you still have this code and add the entire script to the end of the reply that I can see the result (number, not URL), and how or what can help you (if you can, of course) about this problem.
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: 2738
    • View Profile
Re: Script for egafd.com
« Reply #13 on: November 28, 2011, 08:13:25 pm »
Is it possible to insert a link (to web page) in the field Biographie?
I try <Link="www......">Name</Link> but when i click in, nothing happens!

I managed, so you'll be happy.

egafd_people_mod.psf is attached

[attachment deleted by admin]
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #14 on: November 28, 2011, 09:06:54 pm »
Thanks a lot!


I'm fighting with the search Function since two days!
HHHHHHAAAAAAAA!

I can find the URL, if the name or pseudo is strictly the same, but if it's only a part of the real name ........
egafd have pages with alphabetics letters.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #15 on: November 29, 2011, 06:59:07 am »
Quote
egafd have pages with alphabetics letters.

This is really a very big problem to find the url for SEARCH_STR , the best is still to what is mentioned in these words:

Quote
For use this script, the URL of the page must be indicate in the data movie before execute.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #16 on: November 29, 2011, 07:24:07 am »
I post my new egafd (on the way, so confuse), i don't use SEARCH_STR but go to the alphabetic page of the name.
If Title is the exact name or exact Pseudo the script give the good info, but if it's the pseudo you must choose the good line:
Title alias for Real Name.


I have added your code for Movie link, but i have a problem in part //get year.
All the line are not the same if the movie is original, alternate title or best of, so we can't step to "class=notes" for all.
I want step first to "</a>", then step to ">" for obtain info (but here, it seems to stay in the ">" of the "a>").
But there is a condition before go to ">", the movie must have info in the page otherwise the position goes to the next line.

Pascal is so strictly!
Is there a tuto for the different way of condition If, i never know the exact syntax, if there is one or two or .... conditions, if we must write ";". I lost a lot of time with this.

I tried different ways but i obtain always an error or the data (of year) is empty!

Just a another question, is there a number limited of logmessage by script because i see somes logmessage give me an error, the syntax was correct and when they are desactived, all is perfect!

i'm again so sorry for my poor english!


[attachment deleted by admin]
« Last Edit: November 29, 2011, 08:25:54 am by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Re: Script for egafd.com
« Reply #17 on: November 29, 2011, 01:43:59 pm »
1.) Very good job.

2.) 
Quote
Pascal is so strictly!
 
I'm not familiar with Pascal writing.

3. ) In the "year" I had a similar problem, so I eliminated the "Year" from the transfer of data as it is not so important information (concerning the transfer and extract data - the script works better that way).

4.) 
Quote
Just a another question, is there a number limited of logmessage by script because i see somes logmessage give me an error, the syntax was correct and when they are desactived, all is perfect!
I do not know (maybe someone else knows more about it), but if you really do not need it is better to deactivate or even remove the log message.

5. )  Small correction:
This code for BIO

Code: [Select]
if Lien <> '' then
         Lien := Lien + #13;
            if URL <> '' then
         Lien := Lien + '<link url="' + URL + '">';
            Lien := Lien + Name + '</link>';


//if URL1 <> '' then
         //Lien := Lien + '<link url="' + URL1 + '">';
            //Lien := Lien + Name + '</link>';
if Year <> '' then
         Lien := Lien + ' • ' + Year;
//if Role <> '' then
         //Lien := Lien + ' • ' + Role;

transferred to wrong url link to the movies, but this correction code

Code: [Select]
if Lien <> '' then
         Lien := Lien + #13;
           // if URL <> '' then
        // Lien := Lien + '<link url="' + URL + '">';
            //Lien := Lien + Name + '</link>';
if URL1 <> '' then
         Lien := Lien + '<link url="' + URL1 + '">';
            Lien := Lien + Name + '</link>';
if Year <> '' then
         Lien := Lien + ' • ' + Year;
//if Role <> '' then
         //Lien := Lien + ' • ' + Role;

now transferred to the correct url link to the movies.
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD


Offline pra15

  • Older Power User
  • *****
  • Posts: 173
    • View Profile
Re: Script for egafd.com
« Reply #18 on: November 29, 2011, 05:53:19 pm »
Ok thanks works good!

For Get Year :
declare actposstart3 if is not

Code: [Select]
// Get Year
actPosStart := PosFrom('<a href="', HTML, EndPos);
actPosStart2 := PosFrom('</a>', HTML, actPosStart);
Av := Trim(Copy(HTML, (actposstart2 + 5), 1));
logmessage('AV : ' + Av);
If Av = '<' then begin
actposStart2 := (actposstart2 + 5);           //Step to go after "</a>"
actposstart3 := PosFrom('>', HTML, actposStart2);
actposend := PosFrom('<', HTML, actposstart3);
Year := Trim(Copy(HTML, (actposstart3 +1), (actposend - actposStart3 - 1)));
logmessage(Year);
end;

Now is it possible to obtain in this script,  the titles of movies where this actor plays in the database. (The list in the buttom)
Another question :
If we start the script from an actor "A", can we obtain the ID of an other actor who is in the database?
« Last Edit: November 29, 2011, 06:28:22 pm by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 2738
    • View Profile
Ivek23
Win 10 64bit (32bit)   PVD v0.9.9.21, PVD v1.0.2.7, PVD v1.0.2.7 + MOD