English > Development
Script for egafd.com
Ivek23:
--- Code: --- // Get Role (Now defined)
actPosStart := PosFrom('<a href="', HTML, EndPos); // search for url start;
actPosStart4 := PosFrom('> <i>', HTML, actPosStart)
actPosEnd:=PosFrom('</i></li>', HTML, actPosStart4); // search for url end
Role := Trim(Copy(HTML, (actPosStart4 + 5), (actPosEnd - actPosStart4 - 5) ));
LogMessage(Role);
debug_pos1:=Pos('(',Role);
if debug_pos1 >0 then
Role:= Copy(Role,0,debug_pos1-1);
LogMessage(Role);
--- End code ---
In egafd_people (2). psf script I tried to add Role, but we do not manage to add a Role in Bio field. Would you try to add this to the script.
Thank you in advance.
pra15:
I'll try.
In the meantime i modified the script iafd_people in the same idea that egafd_people.
I desactived somes infos, especially the section //Web Site because there's a little bug.
The text in the fieldBio (mode modify) is correct but in mode "design" the first movie of the filmographie go up the link of the website!
I don't know why.
If you're interested i post it.
[attachment deleted by admin]
pra15:
For Role :
Just after Year,
--- Code: --- // Get Role (Not yet defined)
actPosStart := PosFrom('<i>', HTML, (actposend-1)) + 4;
actPosEnd:=PosFrom('</i></li>', HTML, actPosStart) - 1;
Role := Trim(Copy(HTML, actposStart, (actPosEnd - actPosStart)));
LogMessage('Role: ' + Role);
debug_pos1:=Pos('(',Role);
if debug_pos1 >0 then
Role:= Copy(Role,0,debug_pos1-1);
LogMessage(Role);
AddPersonMovie(Trim(Title), '', '', Year, LowerCase(URL1), ctActors);
// Total Line
If Lien <> '' then
Lien := Lien + #13;
If URL1 <> '' then
Lien := Lien + '<link url="' + URL1 + '">' + Name + '</link>';
If Year <> '' then
Lien := Lien + ' • ' + Year;
If Role <> '' then
Lien := Lien + ' • ' + Role;
--- End code ---
It seems to be OK.
And for separate Year to notes :
Replace //Get Year by this :
--- Code: --- //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,2,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);
--- End code ---
and :
--- Code: --- // Total Line
If Lien <> '' then
Lien := Lien + #13;
If URL1 <> '' then
Lien := Lien + '<link url="' + URL1 + '">' + Name + '</link>';
If Year <> '' then
Lien := Lien + ' • ' + Year;
If Note <> '' then
Lien := Lien + ' • ' + Note;
If Role <> '' then
Lien := Lien + ' • ' + Role;
--- End code ---
It seems to be Ok too, but perhaps i have not seen all differents cases!
I've noted that if there's no "Notes" after a movie, the next movie does not appears in the bio, seems to again function Posfrom don't step to the good place!
Ivek23:
--- Code: ---//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(Notes);
Case tmpYear of
'c.' : Begin
Year := Copy(Notes,2,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);
--- End code ---
This code is OK, but no work yet.
Add your script, that it tested and to see why my modifies script does not work.
pra15:
I post the code egafd_people(Role).psf.
For me the code is OK!
Have you declare all new variable? (notes, note, tmpYear...)
In what URL have you tested it ?
I'm seeing an error :
change in case 'c.' : -----> Year := Copy(Notes,4,4);
Still stay the problem of the movies who are not reed after a movie within "notes"!
[attachment deleted by admin]
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version