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

0 Members and 2 Guests are viewing this topic.

Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #60 on: December 09, 2011, 05:39:48 pm »
Thanks, good work!
It's interesting to add new infos.
But with this method, the info of country for exemple will be always for the last movie of Alternate Titles.
I think it should be better to use the origtitle and compare it with the list of alternate Titles, and if the same title is in the list, we can search data in this line. (of country, if it's a dvd, or studio)

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #61 on: December 09, 2011, 05:54:55 pm »
For Url
I'm sorry, my mistake, added to the Cast wrong url  code,
This is the right URL codes.

Code: [Select]
// get url
          UrlPosStart := PosFrom('href="', HTML, EndPos) + 6;
          UrlPosEnd := PosFrom('">', HTML, UrlPosStart);
          URL := BASE_URL + Trim(Copy(HTML, UrlPosStart, UrlPosEnd - UrlPosStart));
          LogMessage(URL);

ADDED IS NOW ALSO CORRECT egafd_mod7 script for movie attached.

Thanks
What is your best should be.
What is better, it should be.

For egafd people slight adjustment in the Bio
Code: [Select]
// Get Role (Now defined)
     difpos := (PosFrom('<i>', HTML, (actposEnd-1))+4) - actposend;
     logmessage('DIFFERENCE : ' + intToStr(difpos));

     If difpos > 0 then begin
    If difpos < 200 then begin

            actPosStart := PosFrom('<i>', HTML, (actposend-1)) + 4;
            {actPosStart := PosFrom('> <i>', HTML, actPosStart) + 6;}
            actPosEnd:=PosFrom('</i></li>', HTML, actPosStart) - 1;
            Role := Trim(Copy(HTML, actposStart, (actPosEnd - actPosStart)));
    Role := StringReplace(Role, ';', '  - ', true, false, true);
    Role := StringReplace(Role, '/', ' - ', true, false, true);
            if Pos(', ', Role) = 1 then Delete(Role, 1, 2);
            LogMessage('Role: ' + Role);
     
            debug_pos1:=Pos('(',Role);
            if debug_pos1 >0 then
            Role:= Copy(Role,0,debug_pos1-1);
            LogMessage(Role);

        end;
     end;
« Last Edit: December 09, 2011, 07:38:46 pm by Ivek23 »
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #62 on: December 10, 2011, 10:54:55 am »
Hello,
I think the data of country, dvd ... are not organise in egafd to make that's you want.
If Title is Original, infos are in top, else they are in alternate titles and infos are not separated!

So i opted for this solution, it's not perfect but simple :

Declare altposStart, altposEnd as integer

Code: [Select]
//AKA - Titles...
   dbgstrg := '';
   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);

if Copy(HTML, (actposend + 7), 5)  <> '</li>' then begin
AltposEnd := Posfrom('</li>', HTML, actposend);
AltposStart := PrevPos('>', HTML, altPosEnd);
dbgstrg := dbgstrg + ' •' + copy(HTML, (altposstart +1), (altPosEnd - altPosStart-1));
end;

If dbgstrg <> '' then
          AddFieldValue(mfAka, dbgstrg);

         curpos := PosFrom('class="flma"', HTML, actPosEnd);
////
end;

I taked only the part Notes of alternate title, other infos are not for me very important!

Have you try code for Birthplace and Birthday in egafd people ?
« Last Edit: December 10, 2011, 10:58:42 am by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #63 on: December 11, 2011, 06:43:06 am »
Quote
Have you try code for Birthplace and Birthday in egafd people ?

Not yet, because I had yesterday morning denied access to the Internet, which I could not fix, so I had a new load computer, so I need time somehow one day or more to add all the programs and the rest of what he needed to operate a computer as needed, so I announced news about this until tomorrow, if the right.
Greeting
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #64 on: December 11, 2011, 04:56:23 pm »
I had a problem too with access to videobb, a page said me i had virus or spyware who send spam, i made a scan with my antivirus and antispyware and i found nothing. Finally i restarted my computer and my router and all was ok!

????

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #65 on: December 12, 2011, 08:24:08 pm »
Have you try code for Birthplace and Birthday in egafd people ?

It is fine, but problems occur when certain words like this for example:
Hungarian , b. 1983   <---  no problem
Hungarian or this b. 1983    <---  there's a problem - the script is blocked

Here is the link  http://www.egafd.com/actresses/details.php/id/k00071 for classic example of described problems (b. 1978).

Hungarian     <---  this problem  I just somehow solved

others do not, therefore,  egafd_people(4 (Ivek23)10 script attached if they will give what and how to save and improve the script,

[attachment deleted by admin]
« Last Edit: December 12, 2011, 08:39:45 pm by Ivek23 »
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #66 on: December 12, 2011, 11:16:44 pm »
I haven't seen this exemples.

For b.1978 see this code :

Code: [Select]
//BirthDay & Birthplace:

ExplodeString(Born, PartBorn, #46);
If High(partBorn) > 0 then
Begin

For I := Low(partBorn) to High(partBorn) do
Begin
PartBorn[I] := Trim(partBorn[I]);
End;


For I := Low(partBorn) to High(partBorn) do
Begin
If Lowercase(partBorn[I]) = 'b' then begin
If High(partBorn) = 1 then Begin
BirthDay := '01/01/' + Copy(partBorn[I+1], 0, 4);
Country := '';
end
else begin
ExplodeString(partBorn[I-1], PartBorn2, ' ');
J := High(partBorn2);
BirthDay := '01/01/' + Copy(partBorn[I+1], 0, 4);
Country := partBorn2[J];
end;
end;

If Copy(partBorn[I], length(partBorn[I])-2,3) = ', b' then begin
ExplodeString(partBorn[I], partBorn2, ',');
J := High(partBorn2);
ExplodeString(partBorn2[J-1], partBorn3, ' ');
J := High(partBorn3);
Country := partBorn3[J];
Birthday := '01/01/' + copy(partborn[I+1],0,4);
end;
end;
end;

If Country <> '' then
AddFieldValue(pfBirthPlace, Country);
If BirthDay <> '' then
AddFieldValue(pfBirthday, BirthDay);

For country only can you post a link?

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #67 on: December 13, 2011, 07:50:09 am »
For country only can you post a link?

For country only link:
http://www.egafd.com/actresses/details.php/id/v00279
http://www.egafd.com/actresses/details.php/id/t00019
http://www.egafd.com/actresses/details.php/id/s00066
http://www.egafd.com/actresses/details.php/id/r00044
http://www.egafd.com/actresses/details.php/id/o00009
http://www.egafd.com/actresses/details.php/id/n00518
http://www.egafd.com/actresses/details.php/id/n00130
http://www.egafd.com/actresses/details.php/id/n00047
http://www.egafd.com/actresses/details.php/id/k00333
http://www.egafd.com/actresses/details.php/id/j00106
http://www.egafd.com/actresses/details.php/id/j00041
http://www.egafd.com/actresses/details.php/id/i00028
http://www.egafd.com/actresses/details.php/id/g00361
http://www.egafd.com/actresses/details.php/id/g00339
http://www.egafd.com/actresses/details.php/id/g00077
http://www.egafd.com/actresses/details.php/id/g00320
http://www.egafd.com/actresses/details.php/id/f00059
http://www.egafd.com/actresses/details.php/id/e00056
http://www.egafd.com/actresses/details.php/id/a00750


For link, where the partial incorrectly data transfer for example like this:
http://www.egafd.com/actresses/details.php/id/v00195
series, b. 1978
http://www.egafd.com/actresses/details.php/id/r00061
origin, b. 1976
French, Algerian origin, b. 1976
http://www.egafd.com/actresses/details.php/id/l00281
breast. b. 1980
Hungarian.  ..... breast. b. 1980
http://www.egafd.com/actresses/details.php/id/l00129
arm. b. 1982
Hungarian blonde, tattoo upper right arm. b. 1982
http://www.egafd.com/actresses/details.php/id/f00165
resident, b. 1969
Congolese (Brazzaville), French resident, b. 1969
http://www.egafd.com/actresses/details.php/id/d00042
origin, b. 1968
French, Moroccan origin, b. 1968
http://www.egafd.com/actresses/details.php/id/c00453
arm. b. 1980
Hungarian, tattoo right shoulder / upper arm. b. 1980
http://www.egafd.com/actresses/details.php/id/a00493
blade. b. 1984
French. tattoos ....  blade. b. 1984
http://www.egafd.com/actresses/details.php/id/a00672
blade. b. 1980
Spanish, tattoos .... blade. b. 1980
http://www.egafd.com/actresses/details.php/id/a00266
shoulder. b. 1983
French. .... shoulder. b. 1983


For link, which do not transfer any data for example like this:
http://www.egafd.com/actresses/details.php/id/t00012
French-Canadian
http://www.egafd.com/actresses/details.php/id/s00841
Hungarian,
http://www.egafd.com/actresses/details.php/id/p00088
French, black African ethnic origin
http://www.egafd.com/actresses/details.php/id/n00033
Ukrainian, b. 1973 or 1977?
http://www.egafd.com/actresses/details.php/id/m01654
Bulgarian,
http://www.egafd.com/actresses/details.php/id/m00170
Hungarian,
http://www.egafd.com/actresses/details.php/id/m00671
mature, French
http://www.egafd.com/actresses/details.php/id/l01065
probably Hong Kong Chinese
http://www.egafd.com/actresses/details.php/id/l00073
French brunette,
http://www.egafd.com/actresses/details.php/id/l00056
French (Breton)
http://www.egafd.com/actresses/details.php/id/l00103
French,
http://www.egafd.com/actresses/details.php/id/k00045
French (Vietnamese father), b.1979,
http://www.egafd.com/actresses/details.php/id/k00026
French, 1973 - 2005, R.I.P.
http://www.egafd.com/actresses/details.php/id/j00037
Portuguese, French-based (according to some sources anyway)
http://www.egafd.com/actresses/details.php/id/i00080
Polish or Hungarian?, b. 1978
http://www.egafd.com/actresses/details.php/id/g00204
b. 1986, tattoo right upper arm, ....
http://www.egafd.com/actresses/details.php/id/g00056
Polish, spot ....
http://www.egafd.com/actresses/details.php/id/f00124
German, brunette, ....
http://www.egafd.com/actresses/details.php/id/e00153
French, blonde, mature, ....
http://www.egafd.com/actresses/details.php/id/d00548
Bulgarian, tattoo ....
http://www.egafd.com/actresses/details.php/id/a00104
French, tattoo ....
http://www.egafd.com/actresses/details.php/id/a01156
Bulgarian, tattoo ....
http://www.egafd.com/actresses/details.php/id/a00064
Russian / Kyrgyzstan
http://www.egafd.com/actresses/details.php/id/a00151
French,
http://www.egafd.com/actresses/details.php/id/a00053
Hungarian, b. 1970 (or 1968?), ....
http://www.egafd.com/actresses/details.php/id/b00121
Hungarian, b. 1974?
http://www.egafd.com/actresses/details.php/id/b00004
French, but according to IMDB, born Fort Worth, Texas

BTW:
How do you work with code the word  Birthday  ,because it does not work for me and I had to replace the word  Birthplace , it works.


Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #68 on: December 13, 2011, 08:56:05 am »
Thanks,
There's too many different type of string for use my code!
We only can utilise it for birthday, and for country we can utilise your code with Pos.....
But we must have all country possible in list.

Sorry for birthday or birthplace, i'm not at home for the moment, so i have not VDB for making test, i work only with script file.

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #69 on: December 13, 2011, 09:42:09 am »
Sorry for birthday or birthplace, i'm not at home for the moment, so i have not VDB for making test, i work only with script file.

No problem, we will wait that you will soon come home again.
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #70 on: December 16, 2011, 04:40:23 pm »
Changes for egafd_mod9 script for movie :
  • Corrected DVD code, it now adds DVD information, where information is added to the movie title (by the end of the movie title)
  • Country and Studio code I edited so that now the Country and Studio info data are both united in one whole and transferred in Tags box.

egafd_mod9 script for movie attached

[attachment deleted by admin]
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #71 on: December 17, 2011, 03:47:06 pm »
I added MPAA, I cleaned the script redundant parts of the code whose parts are not necessary for the proper functioning of the script.

egafd_mod10 script for movie attached

[attachment deleted by admin]
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #72 on: December 19, 2011, 10:41:03 am »
I'm back,
Thanks for egafd movie, i'll examine it!

Code for birthday and birthplace :

Code: [Select]
procedure ParsePeople(URL : String; HTML : String);

///////////////////////////////////////////////////////////////////////////////////////////////////
var curpos, endpos, PosStart, PosEnd, debug_Pos1 : Integer; //
    actPosstart, actposstart2, actPosStart3, actposend, UrlposStart, UrlposEnd, difPos : Integer;//
    Pseudo, Born, Lien, URL1, Name, Title, Year, Av, Role, Notes, Note, tmpYear, OrigT : String;
    posBorn, Country, Birthday : string;
    I, counter : integer; //
///////////////////////////////////////////////////////////////////////////////////////////////////

begin
AddFieldValue(pfGenre, 'EGAFD');

// URL: //

Addfieldvalue(pfURL,URL);


// BORN: //

curpos := Pos('<th>Notes</th>', HTML);
endpos := curpos;

While (curpos > 0) AND (curpos < Posfrom('</tr>', HTML, EndPos)) do begin
endpos := curpos;
PosStart := PosFrom('<td><ul class="list"><li>', HTML, endpos);
PosEnd := PosFrom('</li></ul></td>', HTML, PosStart);
Born := Trim(Copy(HTML, (PosStart + 25), (PosEnd - PosStart - 25)));
Born := Uppercase(Copy(Born,0,1)) + Copy(Born,2, length(Born)-1) + #13;
//LogMessage('BORN :' + Born);
curpos := posfrom('<td><ul class="list"><li>', HTML, posend);
//AddFieldValue(pfBirthplace, Born);
LogMessage('BORN :' + Born);
end;

/// BirthDay:

ExplodeString(Born, PartBorn, #46);

If High(partBorn) > 0 then
Begin
  logmessage('birhtday commence')
    For I := Low(partBorn) to High(partBorn) do
    Begin
    PartBorn[I] := Trim(partBorn[I]);
    End;

For I := Low(partBorn) to High(partBorn) do
Begin
If (Lowercase(partBorn[I]) = 'b') OR (Copy(partBorn[I], length(partBorn[I])-2,3) = ', b') then
     BirthDay := '01/01/' + Copy(partBorn[I+1], 0, 4);
end;
end;

If BirthDay <> '' then AddFieldValue(pfBirthday, BirthDay);

  // Birthplace:
 
  TabCountry := ['Hungarian', 'French', 'Russian', 'Norwegian' , 'Austrian', 'Spanish', 'Bulgarian'
                , 'English', 'German', 'Belgian', 'Canadian', 'Danish', 'Italian', 'Greek'
                , 'Portuguese', 'Polish', 'Kyrgyzstan', 'Czech', 'exit'];
 
  I := 0;
  For I := Low(TabCountry) to High(Tabcountry) do
  Begin
    If Pos((copy(TabCountry[I], 1 ,Length(TabCountry[I])-1)),Born) > 0 then
    Begin
    Addfieldvalue(pfBirthPlace, TabCountry[I]);
    I := High(TabCountry);
    end;
  End;


// AKA: //

curpos := Pos('<th>Pseudonyms</th>', HTML);
endpos := curpos;

While (curpos > 0) AND (curpos < Posfrom('<th>Films</th>', HTML, EndPos)) do begin
endpos := curpos;
PosStart := PosFrom('class="acta">', HTML, endpos);
PosEnd := PosFrom('</span>', HTML, PosStart);
Pseudo := Trim(Copy(HTML, (PosStart + 13), (PosEnd - PosStart - 13)));
LogMessage('AKA :' + Pseudo);
curpos := posfrom('class="acta">', HTML, posend);
AddFieldValue(pfAltnames, Pseudo);
end;

//////////
// BIO: //

curpos := Pos('<th>Films</th>', HTML);
    LogMessage('Films readout');
    if curPos > 0 then    begin

Lien := '----- Filmographie (EGAFD) -----' + #09;
    EndPos := curPos;

        while (curPos > 0) AND (curPos < PosFrom('</ul>', HTML, EndPos)) do begin
              EndPos := curPos; // Set last position to actual position

          /// Get URL: ///

         UrlPosStart := PosFrom('<a href="', HTML, EndPos);  // search for url start
         UrlPosEnd := PosFrom('" class="', HTML, UrlPosStart);  // search for url end     
         URL1 := BASE_URL + Copy(HTML, UrlPosStart + 9, (UrlPosEnd - UrlPosStart - 9) );
         LogMessage(URL1);


          /// Get Name: ///

         actPosStart := PosFrom('<a 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);


/// Get Title  (for movies): ///

         actPosStart := PosFrom('<a href="', HTML, EndPos);   // search for url start;
         actPosStart2 := PosFrom('">', HTML, actPosStart)
         actPosEnd:=PosFrom('</a>', HTML, actPosStart2);    // search for url end
         Title := Trim(Copy(HTML, (actPosStart2 + 2), (actPosEnd - actPosStart2 - 2) ));
         LogMessage(Title);
     
         debug_pos1:=Pos('(',Title);
            if debug_pos1 >0 then
            Title := Copy(Title,0,debug_pos1-1);
            LogMessage(Title);

/// If Original: ///

actposstart := actposEnd + 5;
actposstart := PosFrom('">', HTML, actposstart) + 2;
actPosEnd := PosFrom('</', HTML, actPosstart) - 1;
If copy(HTML, actposstart, 3) = 'alt' then
OrigT := Copy(HTML, (actPosstart + 22),(actPosEnd-actPosStart-21))
else
OrigT := Title;

/// Notes: ///

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);
     Notes := Trim(Copy(HTML, (actposstart3 +1), (actposend - actposStart3 - 1)));
     logmessage('Notes :' + Notes);
     end;   

         debug_pos1:=Pos('(',Notes);
         if debug_pos1 >0 then
         Year:= Copy(Notes,0,debug_pos1-1);
         LogMessage(Notes);

/// Get Year & Note: ///
tmpYear := Copy(Notes, 0, 2);
logMessage('tmpYear :' + tmpYear);

Case tmpYear of
'c.' : Begin
Year := Copy(Notes,4,4);
Note := '';
end;

'19', '20' : Begin
If Copy(Notes,0,5) = 's' {OR Copy(Notes,0,5) = '?'} then begin
Year := Copy(Notes,0,5);
Note := Copy(Notes,7, Length(Notes)-6);
end
else begin
Year := Copy(Notes,0,4);
Note := Copy(Notes,6, Length(Notes)-5);
end;
If Copy(Notes,0,5) = '?' then begin
Year := Copy(Notes,0,5);
Note := Copy(Notes,7, Length(Notes)-6);
end
else begin
Year := Copy(Notes,0,4);
Note := Copy(Notes,6, Length(Notes)-5);
end;
end;

else begin
Year := '';
Note := Notes;
end;
end;

logmessage('Year :' + Year);
logmessage('Note :' + Note);
 

/// Get Role: ///
difpos := (PosFrom('<i>', HTML, (actposEnd-1))+4) - actposend;
logmessage('DIFFERENCE : ' + intToStr(difpos));

If difpos > 0 then begin
If difpos < 200 then begin

          actPosStart := PosFrom('<i>', HTML, (actposend-1)) + 4;
          actPosEnd:=PosFrom('</i></li>', HTML, actPosStart) - 1;
        Role := Trim(Copy(HTML, actposStart, (actPosEnd - actPosStart)));
Role := StringReplace(Role, ';', '  - ', true, false, true);
    Role := StringReplace(Role, '/', ' - ', true, false, true);
            if Pos(', ', Role) = 1 then Delete(Role, 1, 2);
          LogMessage('Role: ' + Role);
     
          debug_pos1:=Pos('(',Role);
          if debug_pos1 >0 then
          Role:= Copy(Role,0,debug_pos1-1);
          LogMessage(Role);

end;
end;




{AddPersonMovie(Trim(OrigT), '', '', Year, LowerCase(URL1), ctActors);} //Add movie in database


/// Total Line: ///
If Lien <> '' then
Lien := Lien + #13;
If URL1 <> '' then begin
If OrigT <> Title then
Lien := Lien + Name
else
Lien := Lien + '<link url="' + URL1 + '">' + Name + '</link>';
end;
If Year <> '' then
Lien := Lien + ' • ' + Year;
If Note <> '' then
Lien := Lien + ' • ' + Note;
If Role <> '' then
Lien := Lien + ' • ' + Role;

LogMessage('LIEN :' + Lien);


                       
         curPos := PosFrom('<a href="', HTML, actPosEnd);
       end;
     
//////////
   
        if (Lien <> '') AND (Born = '') then
AddFieldValue(pfBio, Lien);
if (Lien  <> '') AND (Born <> '') then
AddFieldValue(pfBio, Born + #13#10 + Lien);
end;


// Photo:
curPos :=Pos('src="/actresses/id/',HTML);
if curPos > 0 then begin
EndPos := PosFrom('" width', HTML, curPos);
PhotoURL := BASE_URL + Copy(HTML, curPos + 5, EndPos - curPos - 5);
LogMessage('URL de la photo: '+ PhotoURL);
{PhotoURL := HTMLToText (PhotoURL);}
AddImageURL(4, PhotoURL);
end
else begin
PhotoURL := '';
end;

end;

for me 'birthday' works!

We must complete the list of country, i had certainly forgotten somes!
There are somes exeptions like French-Canadian, origin. This code takes only the first country and doesn't take care of origin.
I made some tests with urls up and it seems to be ok

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #73 on: December 19, 2011, 12:39:17 pm »
Welcome back.

I tried to declare "mfComment = 16;" but no data are transfered!
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.

Moreover, this also partially true, but there is also a solution to this problem that I have found these days in zelluloid_person script as an extra link, a link to the Comment field.

So it could be better info download certain information in the comment box where more so than not, they really belong there.

zelluloid_person script download link 


Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #74 on: December 19, 2011, 02:16:18 pm »


Code for birthday and birthplace :

Code: [Select]
procedure ParsePeople(URL : String; HTML : String);

///////////////////////////////////////////////////////////////////////////////////////////////////
var curpos, endpos, PosStart, PosEnd, debug_Pos1 : Integer; //
    actPosstart, actposstart2, actPosStart3, actposend, UrlposStart, UrlposEnd, difPos : Integer;//
    Pseudo, Born, Lien, URL1, Name, Title, Year, Av, Role, Notes, Note, tmpYear, OrigT : String;
    posBorn, Country, Birthday : string;
    I, counter : integer; //
///////////////////////////////////////////////////////////////////////////////////////////////////

begin
AddFieldValue(pfGenre, 'EGAFD');

// URL: //

Addfieldvalue(pfURL,URL);


// BORN: //

curpos := Pos('<th>Notes</th>', HTML);
endpos := curpos;

While (curpos > 0) AND (curpos < Posfrom('</tr>', HTML, EndPos)) do begin
endpos := curpos;
PosStart := PosFrom('<td><ul class="list"><li>', HTML, endpos);
PosEnd := PosFrom('</li></ul></td>', HTML, PosStart);
Born := Trim(Copy(HTML, (PosStart + 25), (PosEnd - PosStart - 25)));
Born := Uppercase(Copy(Born,0,1)) + Copy(Born,2, length(Born)-1) + #13;
//LogMessage('BORN :' + Born);
curpos := posfrom('<td><ul class="list"><li>', HTML, posend);
//AddFieldValue(pfBirthplace, Born);
LogMessage('BORN :' + Born);
end;

/// BirthDay:

ExplodeString(Born, PartBorn, #46);

If High(partBorn) > 0 then
Begin
  logmessage('birhtday commence')
    For I := Low(partBorn) to High(partBorn) do
    Begin
    PartBorn[I] := Trim(partBorn[I]);
    End;

For I := Low(partBorn) to High(partBorn) do
Begin
If (Lowercase(partBorn[I]) = 'b') OR (Copy(partBorn[I], length(partBorn[I])-2,3) = ', b') then
     BirthDay := '01/01/' + Copy(partBorn[I+1], 0, 4);
end;
end;

If BirthDay <> '' then AddFieldValue(pfBirthday, BirthDay);

  // Birthplace:
 
  TabCountry := ['Hungarian', 'French', 'Russian', 'Norwegian' , 'Austrian', 'Spanish', 'Bulgarian'
                , 'English', 'German', 'Belgian', 'Canadian', 'Danish', 'Italian', 'Greek'
                , 'Portuguese', 'Polish', 'Kyrgyzstan', 'Czech', 'exit'];
 
  I := 0;
  For I := Low(TabCountry) to High(Tabcountry) do
  Begin
    If Pos((copy(TabCountry[I], 1 ,Length(TabCountry[I])-1)),Born) > 0 then
    Begin
    Addfieldvalue(pfBirthPlace, TabCountry[I]);
    I := High(TabCountry);
    end;
  End;


// AKA: //

curpos := Pos('<th>Pseudonyms</th>', HTML);
endpos := curpos;

While (curpos > 0) AND (curpos < Posfrom('<th>Films</th>', HTML, EndPos)) do begin
endpos := curpos;
PosStart := PosFrom('class="acta">', HTML, endpos);
PosEnd := PosFrom('</span>', HTML, PosStart);
Pseudo := Trim(Copy(HTML, (PosStart + 13), (PosEnd - PosStart - 13)));
LogMessage('AKA :' + Pseudo);
curpos := posfrom('class="acta">', HTML, posend);
AddFieldValue(pfAltnames, Pseudo);
end;

//////////
// BIO: //

curpos := Pos('<th>Films</th>', HTML);
    LogMessage('Films readout');
    if curPos > 0 then    begin

Lien := '----- Filmographie (EGAFD) -----' + #09;
    EndPos := curPos;

        while (curPos > 0) AND (curPos < PosFrom('</ul>', HTML, EndPos)) do begin
              EndPos := curPos; // Set last position to actual position

          /// Get URL: ///

         UrlPosStart := PosFrom('<a href="', HTML, EndPos);  // search for url start
         UrlPosEnd := PosFrom('" class="', HTML, UrlPosStart);  // search for url end     
         URL1 := BASE_URL + Copy(HTML, UrlPosStart + 9, (UrlPosEnd - UrlPosStart - 9) );
         LogMessage(URL1);


          /// Get Name: ///

         actPosStart := PosFrom('<a 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);


/// Get Title  (for movies): ///

         actPosStart := PosFrom('<a href="', HTML, EndPos);   // search for url start;
         actPosStart2 := PosFrom('">', HTML, actPosStart)
         actPosEnd:=PosFrom('</a>', HTML, actPosStart2);    // search for url end
         Title := Trim(Copy(HTML, (actPosStart2 + 2), (actPosEnd - actPosStart2 - 2) ));
         LogMessage(Title);
     
         debug_pos1:=Pos('(',Title);
            if debug_pos1 >0 then
            Title := Copy(Title,0,debug_pos1-1);
            LogMessage(Title);

/// If Original: ///

actposstart := actposEnd + 5;
actposstart := PosFrom('">', HTML, actposstart) + 2;
actPosEnd := PosFrom('</', HTML, actPosstart) - 1;
If copy(HTML, actposstart, 3) = 'alt' then
OrigT := Copy(HTML, (actPosstart + 22),(actPosEnd-actPosStart-21))
else
OrigT := Title;

/// Notes: ///

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);
     Notes := Trim(Copy(HTML, (actposstart3 +1), (actposend - actposStart3 - 1)));
     logmessage('Notes :' + Notes);
     end;   

         debug_pos1:=Pos('(',Notes);
         if debug_pos1 >0 then
         Year:= Copy(Notes,0,debug_pos1-1);
         LogMessage(Notes);

/// Get Year & Note: ///
tmpYear := Copy(Notes, 0, 2);
logMessage('tmpYear :' + tmpYear);

Case tmpYear of
'c.' : Begin
Year := Copy(Notes,4,4);
Note := '';
end;

'19', '20' : Begin
If Copy(Notes,0,5) = 's' {OR Copy(Notes,0,5) = '?'} then begin
Year := Copy(Notes,0,5);
Note := Copy(Notes,7, Length(Notes)-6);
end
else begin
Year := Copy(Notes,0,4);
Note := Copy(Notes,6, Length(Notes)-5);
end;
If Copy(Notes,0,5) = '?' then begin
Year := Copy(Notes,0,5);
Note := Copy(Notes,7, Length(Notes)-6);
end
else begin
Year := Copy(Notes,0,4);
Note := Copy(Notes,6, Length(Notes)-5);
end;
end;

else begin
Year := '';
Note := Notes;
end;
end;

logmessage('Year :' + Year);
logmessage('Note :' + Note);
 

/// Get Role: ///
difpos := (PosFrom('<i>', HTML, (actposEnd-1))+4) - actposend;
logmessage('DIFFERENCE : ' + intToStr(difpos));

If difpos > 0 then begin
If difpos < 200 then begin

          actPosStart := PosFrom('<i>', HTML, (actposend-1)) + 4;
          actPosEnd:=PosFrom('</i></li>', HTML, actPosStart) - 1;
        Role := Trim(Copy(HTML, actposStart, (actPosEnd - actPosStart)));
Role := StringReplace(Role, ';', '  - ', true, false, true);
    Role := StringReplace(Role, '/', ' - ', true, false, true);
            if Pos(', ', Role) = 1 then Delete(Role, 1, 2);
          LogMessage('Role: ' + Role);
     
          debug_pos1:=Pos('(',Role);
          if debug_pos1 >0 then
          Role:= Copy(Role,0,debug_pos1-1);
          LogMessage(Role);

end;
end;




{AddPersonMovie(Trim(OrigT), '', '', Year, LowerCase(URL1), ctActors);} //Add movie in database


/// Total Line: ///
If Lien <> '' then
Lien := Lien + #13;
If URL1 <> '' then begin
If OrigT <> Title then
Lien := Lien + Name
else
Lien := Lien + '<link url="' + URL1 + '">' + Name + '</link>';
end;
If Year <> '' then
Lien := Lien + ' • ' + Year;
If Note <> '' then
Lien := Lien + ' • ' + Note;
If Role <> '' then
Lien := Lien + ' • ' + Role;

LogMessage('LIEN :' + Lien);


                       
         curPos := PosFrom('<a href="', HTML, actPosEnd);
       end;
     
//////////
   
        if (Lien <> '') AND (Born = '') then
AddFieldValue(pfBio, Lien);
if (Lien  <> '') AND (Born <> '') then
AddFieldValue(pfBio, Born + #13#10 + Lien);
end;


// Photo:
curPos :=Pos('src="/actresses/id/',HTML);
if curPos > 0 then begin
EndPos := PosFrom('" width', HTML, curPos);
PhotoURL := BASE_URL + Copy(HTML, curPos + 5, EndPos - curPos - 5);
LogMessage('URL de la photo: '+ PhotoURL);
{PhotoURL := HTMLToText (PhotoURL);}
AddImageURL(4, PhotoURL);
end
else begin
PhotoURL := '';
end;

end;

In this code for this part of code script does not work:

Code: [Select]
procedure ParsePeople(URL : String; HTML : String);

///////////////////////////////////////////////////////////////////////////////////////////////////
var curpos, endpos, PosStart, PosEnd, debug_Pos1 : Integer; //
    actPosstart, actposstart2, actPosStart3, actposend, UrlposStart, UrlposEnd, difPos : Integer;//
    Pseudo, Born, Lien, URL1, Name, Title, Year, Av, Role, Notes, Note, tmpYear, OrigT : String;
    posBorn, Country, Birthday : string;
    I, counter : integer; //
///////////////////////////////////////////////////////////////////////////////////////////////////

When I replace this piece of code with this part of code script now work:

Code: [Select]
procedure ParsePeople(URL : String; HTML : String);

///////////////////////////////////////////////////////////////////////////////////////////////////
var curpos, endpos, PosStart, PosEnd, debug_Pos1 : Integer; //
    actPosstart, actposstart2, actPosStart3, actposend, UrlposStart, UrlposEnd, difPos : Integer;//
    Pseudo, Born, Lien, URL1, Name, Title, Year, Av, Role, Notes, Note, tmpYear, OrigT : String;
    posBorn, Country, Birthday : string;
    I, counter : integer;
PartBorn, PartBorn3 : Twidearray;
PartBorn2, TabCountry : twidearray;//
///////////////////////////////////////////////////////////////////////////////////////////////////
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #75 on: December 19, 2011, 06:07:45 pm »
Countries that are currently required for TabCountry :

Code: [Select]
TabCountry := ['Austrian', 'Belgian', 'Brazilian', 'Bulgarian', 'Belarusian', 'Canadian'
                , 'Cuban', 'Colombian', 'Czech', 'Dutch', 'Danish', 'English', 'Estonian'
, 'Ecuadorian', 'French', 'German', 'Greek', 'Hungarian', 'Indian'
, 'Italian', 'Kyrgyzstan', 'Latvian', 'Lithuanian', 'Maori', 'Moldovan'
, 'Netherlands', 'Norwegian', 'Portuguese', 'Polish', 'Romanian', 'Russian'
, 'Slovak', 'Spanish', 'Swiss', 'Swedish', 'Venezuelan', 'Ukrainian'
, 'Yugoslavian', 'French-Canadian', 'French (Algerian origin)'
, 'French, Moroccan origin', 'French (Moroccan origin)', 'French of Vietnamese origin'
, 'French, Vietnamese origin,', 'Russian / Kyrgyzstan', 'Yugoslavian/French'
, 'exit'];
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #76 on: December 19, 2011, 07:45:16 pm »
I can not connect Birthday and TabCountry info data into a single, into a single piece of code to connect to the Birthplace box transferred data for the country and year of birth together.

Should look something like as attached code:

Code: [Select]
if (Birthday <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthday + '  b. ' + TabCountry[I]);
I := High(TabCountry);
or
Code: [Select]
if (Birthplace <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthplace + '  b. ' + TabCountry[I]);
I := High(TabCountry);

You can somehow arrange to make this work, nice please.
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline pra15

  • Power User
  • ****
  • Posts: 164
    • View Profile
Re: Script for egafd.com
« Reply #77 on: December 19, 2011, 09:50:49 pm »
Thanks,

The method addfieldvaluesXml('comment', _____) works good!
Thanks for the list of country too.
For the déclaration i have forgotten to say i had declare my array PartBorn and TabCountry in global variables!

For your problem
AddFieldValue(pfBirthplace, (Birthday + 'b.' + TabCountry) ); you have forgotten ()

I'm just trying this and it works!

For country i add somes :
Code: [Select]
TabCountry := ['Austrian', 'Belgian', 'Brazilian', 'Bulgarian', 'Belarusian', 'Canadian'
                , 'Chinese', 'Cuban', 'Colombian', 'Croatian', 'Cyprus', 'Czech', 'Dutch'
                , 'Danish', 'English', 'Estonian', 'Ecuadorian', 'Finnish', 'French', 'German'
                , 'Greek', 'Hungarian', 'Indian', 'Irish', 'Italian', 'Kyrgyzstan', 'Latvian'
                , 'Lithuanian', 'Maori', 'Moldovan', 'Netherlands', 'Norwegian', 'Portuguese'
                , 'Polish', 'Romanian', 'Russian', 'Slovak', 'Slovenian', 'Spanish', 'Swiss'
                , 'Swedish', 'Venezuelan', 'Ukrainian', 'Yugoslavian', 'French-Canadian'
                , 'French (Algerian origin)', 'French, Moroccan origin', 'French (Moroccan origin)'
                , 'French of Vietnamese origin','French, Vietnamese origin,', 'Russian / Kyrgyzstan'
                , 'Yugoslavian/French', 'exit'];
« Last Edit: December 19, 2011, 10:33:46 pm by pra15 »

Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #78 on: December 20, 2011, 09:47:37 am »
For country i add somes :
Code: [Select]
TabCountry := ['Austrian', 'Belgian', 'Brazilian', 'Bulgarian', 'Belarusian', 'Canadian'
                , 'Chinese', 'Cuban', 'Colombian', 'Croatian', 'Cyprus', 'Czech', 'Dutch'
                , 'Danish', 'English', 'Estonian', 'Ecuadorian', 'Finnish', 'French', 'German'
                , 'Greek', 'Hungarian', 'Indian', 'Irish', 'Italian', 'Kyrgyzstan', 'Latvian'
                , 'Lithuanian', 'Maori', 'Moldovan', 'Netherlands', 'Norwegian', 'Portuguese'
                , 'Polish', 'Romanian', 'Russian', 'Slovak', 'Slovenian', 'Spanish', 'Swiss'
                , 'Swedish', 'Venezuelan', 'Ukrainian', 'Yugoslavian', 'French-Canadian'
                , 'French (Algerian origin)', 'French, Moroccan origin', 'French (Moroccan origin)'
                , 'French of Vietnamese origin','French, Vietnamese origin,', 'Russian / Kyrgyzstan'
                , 'Yugoslavian/French', 'exit'];

Thanks for clearing the list.

I can not connect Birthday and TabCountry info data into a single, into a single piece of code to connect to the Birthplace box transferred data for the country and year of birth together.

Should look something like as attached code:

Code: [Select]
if (Birthday <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthday + '  b. ' + TabCountry[I]);
I := High(TabCountry);
or
Code: [Select]
if (Birthplace <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthplace + '  b. ' + TabCountry[I]);
I := High(TabCountry);

You can somehow arrange to make this work, nice please.
For your problem
AddFieldValue(pfBirthplace, (Birthday + 'b.' + TabCountry) ); you have forgotten ()

I'm just trying this and it works!

Anyway I do with this part of code with your solution, we PVD always report this error:
Out of Range
so I do not know more what to do that this would still work as it should, because I almost gave up in this case.
I use the PVD version 9.9.21, what about you.

Are two redundant beauty error:
First this:
Code: [Select]
begin
AddFieldValue(pfGenre, 'EGAFD');

// URL: //

I have blocked or deleted, because there will always be one way or another display, and my opinion is that does not belong there at all.

Second this
Code: [Select]
//////////
// BIO: //

curpos := Pos('<th>Films</th>', HTML);
    LogMessage('Films readout');
    if curPos > 0 then    begin

Lien := '----- Filmographie (EGAFD) -----' + #09;

    EndPos := curPos;

Equal, this will always be displayed, and if there is a filmography or is not, so it is better so that

Code: [Select]
//////////
// BIO: //

curpos := Pos('<th>Films</th>', HTML);
    LogMessage('Films readout');
    if curPos > 0 then    begin

Lien := '' ;

    EndPos := curPos;

and not otherwise shown, because important the fact this is that when the script as final version of the script well done and it will be possible to get, or will also available via auto-update system, potential users this part of the displayed data probably they will not like.

I would ask if you can attach the full script to test it, even with my with problems associated part of the code, and see my script errors.
Thanks.
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21


Offline Ivek23

  • Global Moderator
  • *****
  • Posts: 1899
    • View Profile
Re: Script for egafd.com
« Reply #79 on: December 20, 2011, 11:20:38 am »
I can not connect Birthday and TabCountry info data into a single, into a single piece of code to connect to the Birthplace box transferred data for the country and year of birth together.

Should look something like as attached code:

Code: [Select]
if (Birthday <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthday + '  b. ' + TabCountry[I]);
I := High(TabCountry);
or
Code: [Select]
if (Birthplace <> '') AND (TabCountry[I] <> '') then
AddFieldValue(pfBirthplace, Birthplace + '  b. ' + TabCountry[I]);
I := High(TabCountry);

You can somehow arrange to make this work, nice please.
For your problem
AddFieldValue(pfBirthplace, (Birthday + 'b.' + TabCountry) ); you have forgotten ()

I'm just trying this and it works!

Anyway I do with this part of code with your solution, we PVD always report this error:
Out of Range
so I do not know more what to do that this would still work as it should, because I almost gave up in this case.
I use the PVD version 9.9.21, what about you.

I would ask if you can attach the full script to test it, even with my with problems associated part of the code, and see my script errors.
Thanks.

No more problems and frustration with this, I  managed to solve this problem by using the enclosed part of the code

Code: [Select]
/// BirthDay:

ExplodeString(Born, PartBorn, #46);

If High(partBorn) > 0 then
Begin
  logmessage('birhtday commence')
    For I := Low(partBorn) to High(partBorn) do
    Begin
    PartBorn[I] := Trim(partBorn[I]);
    End;

For I := Low(partBorn) to High(partBorn) do
Begin
If (Lowercase(partBorn[I]) = 'b') OR (Copy(partBorn[I], length(partBorn[I])-2,3) = ', b') then
     BirthDay := '01/01/' + Copy(partBorn[I+1], 0, 4);
end;
end;

If BirthDay <> '' then AddFieldValue(pfBirthday, BirthDay);

BirthDay:= StringReplace(BirthDay, '01/01/', '  b. ', true, false, true);
       if Pos(', ', BirthDay) = 1 then Delete(BirthDay, 1, 2);
   
  // Birthplace:
 
  TabCountry := ['Austrian', 'Belgian', 'Brazilian', 'Bulgarian', 'Belarusian', 'Canadian'
                , 'Chinese', 'Cuban', 'Colombian', 'Croatian', 'Cyprus', 'Czech', 'Dutch'
                , 'Danish', 'English', 'Estonian', 'Ecuadorian', 'Finnish', 'French', 'German'
                , 'Greek', 'Hungarian', 'Indian', 'Irish', 'Italian', 'Kyrgyzstan', 'Latvian'
                , 'Lithuanian', 'Maori', 'Moldovan', 'Netherlands', 'Norwegian', 'Portuguese'
                , 'Polish', 'Romanian', 'Russian', 'Slovak', 'Slovenian', 'Spanish', 'Swiss'
                , 'Swedish', 'Venezuelan', 'Ukrainian', 'Yugoslavian', 'French-Canadian'
                , 'French (Algerian origin)', 'French, Moroccan origin', 'French (Moroccan origin)'
                , 'French of Vietnamese origin','French, Vietnamese origin,', 'Russian / Kyrgyzstan'
                , 'Yugoslavian/French', 'exit'];
 
  I := 0;
  For I := Low(TabCountry) to High(Tabcountry) do
  Begin
    If Pos((copy(TabCountry[I], 1 ,Length(TabCountry[I])-1)),Born) > 0 then
    Begin
    Addfieldvalue(pfBirthPlace, (TabCountry[I] + BirthDay));
    I := High(TabCountry);
    end;
  End;

I am very relieved now solve this problem. ::)
Now, happily to edit the script. :)

BTW:
Would be found to regulate  egafd movie script  that may be looking for movie titles the same way as in  egafd  people  script .
Ivek23
Win 7 32bit, 64bit   PVD v0.9.9.21