Page 1 of 1

IMDB (batch).ifs - Description

Posted: 2004-08-21 02:39:51
by PropheX
hi, i was just using a slightly modified IMDB (batch).ifs to try and update my movie catalog
it did everything i wanted except for the description part
i wanted the short description for all my movies but since some description on the imdb homepage are longer then other, they end with "... (more)" etc etc
how do i make the discription end with the ... and no
<a href="/rg/title-tease/plotsummary/title/tt0000000/plotsummary">(more)</a ?

to simplify
i want: "This movie is about a monkey and his..."
i dont want: "This movie is about a monkey and his...<a href="/rg/title-tease/plotsummary/title/tt0000000/plotsummary">(more)</a"

can anybody who knows how to program the scripts help me?^^

heres the code thats in the description part

Code: Select all

  //Description
  if ImportDescription then
  begin
    LineNr := FindLine('Plot Summary:', Page, 0);
    if LineNr < 1 then
      LineNr := FindLine('Plot Outline:', Page, 0);
    if LineNr > -1 then
    begin
      Line := Page.GetString(LineNr);
      BeginPos := pos('</b>', Line) + 5;
      EndPos := pos('<a href', Line);
      if EndPos < 1 then
      begin
        Line := Line + Page.GetString(LineNr+1);
        EndPos := pos('<br><br>', Line);
        if EndPos < 1 then
          EndPos := Length(Line);
      end;
      Value := copy(Line, BeginPos, EndPos - BeginPos);
      HTMLDecode(Value);
      if UseLongestDescription then
        SetField(fieldDescription, GetDescriptions(MovieURL + 'plotsummary'))
      else
        SetField(fieldDescription, Value);
    end;
  end;
that same from the latest IMDB (batch).ifs

Posted: 2004-08-21 09:11:17
by antp
if the last character (<) was not cut, you could use the function HTMLRemoveTags to remove this.

Posted: 2004-08-22 01:15:28
by PropheX
sorry, i have no programing know-how^^;
where do i add that line?
also, the last characters are always "</a"
it doesnt close off for some reason
for example, i just tried with the movie, the net
this is what i got in the description

Code: Select all

Angela Bennett's a software engineer type who works from home and has few friends outside of cyberspace... <a href="/rg/title-tease/plotsummary/title/tt0113957/plotsummary">(more)</a
if possible, id like to totally remove this or if not, id like to somehow make it point to the full url at least (http://www.imdb.com/rg/title-tease/plot ... lotsummary or better yet, http://www.imdb.com/title/tt0113957/plotsummary) and close with a </a>

Posted: 2004-08-22 11:42:49
by antp
After the HTMLDecode line, add :

Code: Select all

  if (Pos('</a', Value) > 0) and (Pos('</a>', Value) = 0) then
    Value := StringReplace(Value, '</a', '</a>');
If you want to remove the tag, add also :

Code: Select all

  HTMLRemoveTags(Value);
If you prefer to keep the link, add :

Code: Select all

  BeginPos := Pos('href=', Value);
  if BeginPos > 0 then
    Insert('http://us.imdb.com', Value, BeginPos + 6);
I hope it works :D