Can ne1 explain this part of the adultdvdempire.com script?

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Post Reply
dmoolkye
Posts: 13
Joined: 2002-12-29 04:13:30
Location: USA
Contact:

Can ne1 explain this part of the adultdvdempire.com script?

Post by dmoolkye »

I am trying to figure out what the line:
LineNr := FindLine('/graphics/pornstarempire/6283st2.jpg',Page,0);
and
BeginPos := pos('/graphics/pornstarempire/6283st2.jpg', Line)+36;

are for. I am trying to convert this script for DVDEmpire.com. Any help would be much appriciated. Thanks in advance

Dan

Code: Select all

 //Actors & Director
  LineNr := FindLine('/graphics/pornstarempire/6283st2.jpg',Page,0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    BeginPos := pos('/graphics/pornstarempire/6283st2.jpg', Line)+36;
    Delete(Line, 1, BeginPos);

    FullValue := '';
    Value := '';
    repeat
      BeginPos := pos('sort=2', Line);
      if Value <> '' then
      begin
        if BeginPos <> 0 then
        begin
           FullValue := FullValue + Value;
          FullValue := FullValue + #13#10;     
        end;
        setField(fieldDirector,Value);
      end;

      Delete(Line, 1, BeginPos+7);
      EndPos := pos('</a>', Line);
      Value := copy(Line, 1, EndPos - 1);
      Delete(Line, 1, EndPos);
    until Line = '';
   
    HTMLDecode(FullValue);
    setField(fieldActors,FullValue);
  end;
trekkie

Post by trekkie »

1.
LineNr := FindLine('/graphics/pornstarempire/6283st2.jpg',Page,0);
This is used to find the first line within the whole page ( 0 -> starting from the first line ) that contains the Pattern "'/graphics/pornstarempire/6283st2.jpg"

2.
BeginPos := pos('/graphics/pornstarempire/6283st2.jpg', Line)+36;
This is used to find the position within the line of the above pattern
Pos returns the location of the first character of the pattern ( or 0 if it is not found ) . The "+36" ( length of the pattern ) is used to move the location PAST the pattern.
Twink
Posts: 92
Joined: 2002-08-01 01:40:12

Post by Twink »

basically I took advantage of the fact that there is always an image just before the cast list.
Post Reply