Page 1 of 1

Update OFDb - IMDb (DE)

Posted: 2007-10-07 10:00:26
by gerol
Hello,

a small modification is necessary, otherwise the display of some actors looks like '<a href="/character/ch0027833/"> ... </a>'

Please change the Part:

Code: Select all

 // Actors
  LineNr := FindLine('Cast overview', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('cast overview', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('Credited cast', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('Complete credited cast', Page, 0);
  if LineNr > -1 then
  begin
    FullValue := '';
    Line := Page.GetString(LineNr);
    repeat
      BeginPos := Pos('<td class="nm">', Line);
      if BeginPos > 0 then
      begin
        Delete(Line, 1, BeginPos);
        Line := copy(Line, 26, Length(Line));
        BeginPos := pos('">', Line) + 2;
        EndPos := pos('</a>', Line);
        if EndPos = 0 then
          EndPos := Pos('</td>', Line);
        Value := copy(Line, BeginPos, EndPos - BeginPos);
        if (Value <> '(more)') and (Value <> '') then
        begin
          BeginPos := pos('<td class="char">', Line);
          if BeginPos > 0 then
          begin
            EndPos := pos('</td></tr>', Line);
            BeginPos := BeginPos + 17;
            Value2 := copy(Line, BeginPos, EndPos - BeginPos);
            if Value2 <> '' then
            begin
              Value := Value + ' (als ' + Value2 + ')';
            end;
          end;
          if FullValue <> '' then
            FullValue := FullValue + ', ';
          FullValue := FullValue + Value;
        end;
        EndPos := Pos('</td></tr>', Line);
        Delete(Line, 1, EndPos);
      end else
      begin
        Line := '';
      end;
    until Line = '';
    HTMLDecode(FullValue);
    SetField(fieldActors, FullValue);
  end;
to:

Code: Select all

 // Actors
  LineNr := FindLine('Cast overview', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('cast overview', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('Credited cast', Page, 0);
  if LineNr = -1 then
    LineNr := FindLine('Complete credited cast', Page, 0);
  if LineNr > -1 then
  begin
    FullValue := '';
    Line := Page.GetString(LineNr);
    repeat
      BeginPos := Pos('<td class="nm">', Line);
      if BeginPos > 0 then
      begin
        Delete(Line, 1, BeginPos);
        Line := copy(Line, 26, Length(Line));
        BeginPos := pos('">', Line) + 2;
        EndPos := pos('</a>', Line);
        if EndPos = 0 then
          EndPos := Pos('</td>', Line);
        Value := copy(Line, BeginPos, EndPos - BeginPos);
        if (Value <> '(more)') and (Value <> '') then
        begin
          BeginPos := pos('<td class="char">', Line);
          if BeginPos > 0 then
          begin
            BeginPos := BeginPos + 17;
            Value2 := copy(Line, BeginPos, 7);
            if Value2 = '<a href' then
              BeginPos := BeginPos + 32;
              EndPos := pos('</td></tr>', Line);
            Value2 := copy(Line, BeginPos, EndPos - BeginPos);
            if Value2 <> '' then
            begin
              Value2 := StringReplace(Value2, '</a>', '');
              Value := Value + ' (als ' + Value2 + ')';
            end;
          end;
          if FullValue <> '' then
            FullValue := FullValue + ', ';
          FullValue := FullValue + Value;
        end;
        EndPos := Pos('</td></tr>', Line);
        Delete(Line, 1, EndPos);
      end else
      begin
        Line := '';
      end;
    until Line = '';
    HTMLDecode(FullValue);
    SetField(fieldActors, FullValue);
  end;

Posted: 2007-10-07 14:59:02
by antp
Thanks

Posted: 2008-02-19 20:30:50
by bad4u
New version 1.3.5 fixes a bug when no title is found - instead of leaving the script, it will ask for a new title.

OFDb - IMDb 1.3.5: http://www.bad4u.741.com/full/OFDb%20-% ... 8DE%29.ifs (copy link into a NEW browser window !)

Thanks moviefreak69 for his bug report (and some code) !

Posted: 2008-03-20 12:38:42
by MacLeod
Now is there a problem with german chars like 'ä', 'ö', 'ü', 'ß'.
:(

Posted: 2008-03-20 18:27:12
by bad4u
New version 1.3.6 fixes an UTF8 bug when special characters are used and adds the option 'ActorsLayout' to separate actors using linebreaks instead of comma.

OFDb - IMDb 1.3.6: http://www.bad4u.741.com/full/OFDb%20-% ... 8DE%29.ifs (copy link into a NEW browser window !)

Posted: 2008-03-20 18:49:18
by MacLeod
Great Work!
Thanks!
Happy Easter Days!

Posted: 2008-04-24 09:19:11
by Eddie
Great job, but I found a small bug.
The description isn't imported correctly, as there is still some parts of the line "Eine Inhaltsangabe von" left. Here is a correction that worked for me:

In function GetDescriptions(Address: string) search for

Code: Select all

      BeginPos := pos('</a></b><br><br>', Line) + 16;
and replace with

Code: Select all

      BeginPos := pos('</b></b><br><br>', Line) + 16;
Now the description gets imported correct.

Posted: 2008-04-24 17:31:04
by bad4u
New version 1.3.6 fixes description import. I used

Code: Select all

BeginPos := pos('</b><br><br>', Line) + 16;
to be sure it will work with both code versions (in case they change back again or use both simultaneous).

OFDb - IMDb 1.3.7: http://www.bad4u.741.com/full/OFDb%20-% ... 8DE%29.ifs (copy link into a NEW browser window !)

Thanks Eddie!

Posted: 2008-04-29 07:46:48
by Eddie
I got another problem importing descriptions :(
When the description is splitted into tow rows, the script won't import anything, as the "EndPos" couldn't be achieved.
An example of a movie that isn't working is Juno (2007).
Any idea how to fix it?

Posted: 2008-04-29 09:59:51
by bad4u
New version 1.3.8 fixes a problem with short descriptions that exceed one row.

OFDb - IMDb 1.3.8: http://www.bad4u.741.com/full/OFDb%20-% ... 8DE%29.ifs (copy link into a NEW browser window !)

Posted: 2008-11-23 16:14:15
by MacLeod
Quote from viewtopic.php?t=2493&start=260
JoeSilver wrote:Hello @all
I am sorry to say, but the marvellous OFDb - IMDb - mod (DE) script, last modified by "bad4u", does not work properly since a few days.

I get two boxes with Error "http/1.1 404 not found" and some of the informations are not collected.

Could please somebody try to fix this or post some code. I tried also to work around, but could not manage it.

Maybe it is due to the new german version of IMDb ?

Thanx a lot in advance!!
I have the same problem. Can you solve it please?

Posted: 2008-11-23 18:07:09
by bad4u
Please download latest script version from http://update.antp.be/amc/scripts/ or use the script "[ UPDATE SCRIPTS ]" for that ;)

Posted: 2008-11-23 18:28:03
by MacLeod
Thx!
But there is another Problem ;)
On Actors will be a problem with html-Tags:
Tobey Maguire (als Spider-Man / <a href="/character/ch0001354/">Peter Parker),

Posted: 2008-11-23 21:00:10
by bad4u
As I don't know about other changes on gerol's version of the script, and I want to avoid doing the same work twice, I now got his last working script as base for this update and only added the ActorsLayout option for actors listing. Maybe that's the best solution now and easier for gerol to fix next time ;)

OFDb - IMDb 1.5.0: http://www.bad4u.741.com/full/OFDb%20-% ... 8DE%29.ifs (do NOT click on it, copy link into a NEW browser window !)