Update OFDb - IMDb (DE)

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
gerol
Posts: 37
Joined: 2006-08-08 16:12:03

Update OFDb - IMDb (DE)

Post 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;
antp
Site Admin
Posts: 9636
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Thanks
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post 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) !
MacLeod
Posts: 11
Joined: 2006-08-30 13:27:07

Post by MacLeod »

Now is there a problem with german chars like 'ä', 'ö', 'ü', 'ß'.
:(
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post 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 !)
MacLeod
Posts: 11
Joined: 2006-08-30 13:27:07

Post by MacLeod »

Great Work!
Thanks!
Happy Easter Days!
Eddie
Posts: 40
Joined: 2005-07-29 07:04:08

Post 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.
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post 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!
Eddie
Posts: 40
Joined: 2005-07-29 07:04:08

Post 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?
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post 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 !)
MacLeod
Posts: 11
Joined: 2006-08-30 13:27:07

Post 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?
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post by bad4u »

Please download latest script version from http://update.antp.be/amc/scripts/ or use the script "[ UPDATE SCRIPTS ]" for that ;)
MacLeod
Posts: 11
Joined: 2006-08-30 13:27:07

Post 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),
bad4u
Posts: 1148
Joined: 2006-12-11 22:54:46

Post 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 !)
Post Reply