IMDB with ALL Genres

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
weed

IMDB with ALL Genres

Post by weed »

Because orginal IMDB script doesn't get all genres from the www, i made a liitle modification.

orginal

Code: Select all

//Category
  LineNr := FindLine('Genre:', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr + 1);
    BeginPos := pos('/">', Line) + 3;
    EndPos := pos('</a>', Line);
    Value := copy(Line, BeginPos, EndPos - BeginPos);
    HTMLDecode(Value);
    SetField(fieldCategory, Value);
  end;

my mod

Code: Select all

//Category 
  LineNr := FindLine('Genre:', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr + 1);
    FullValue := '';
  repeat
    BeginPos := pos('/">', Line);
    EndPos := pos('</a>', Line);
    if BeginPos > 0 then
      begin
        Value := copy(Line, BeginPos + 3, EndPos - BeginPos - 3 );
        Line := copy(Line, EndPos +4 , Length(Line));
        if FullValue <> '' then
          begin
           FullValue := FullValue + ' / ';
          end;
        FullValue := FullValue + Value;
     end else
      begin
        Line := '';
      end;
   until Line = '';
   HTMLDecode(FullValue);
   SetField(fieldCategory, FullValue);
  end;
Post Reply