[REQ] Not any german script is working!

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
mumpel
Posts: 8
Joined: 2006-09-29 19:13:40

[REQ] Not any german script is working!

Post by mumpel »

Hi there,

I was using AMC for a couple of months now and it perfectly fitted my needs.

First I have to say that the import scripts are THE reason for me to switch to AMC. And I'm using the latest version of AMC and checked the board to find a solution for several weeks/months. And finally that I'm not a coder, so I have to rely on other's solutions.

The BIG problem is that since some weeks/weeks, I can't access any german script for importing data. I just can use Amazon.de (Image Only), Cinefacts.de, Filmposter-archiv.de, Lionetwork.net and IMDB.com, OFDB.de and finally OFDB-IMDB. Regulary, I used Cinefacts.de and OFDB.de to immport my data. But now, any of them worked probably.

Amazon.de (Image Only) doesn't request the movie title and always displays "No movie found".

Cinefacts.de always displays "HTTP/1.1 404 Not found".

Filmposter-archiv.de doesn't import anything.

Lionetwork.net and IMDB.com pops up with "HTTP/1.1 403 Forbidden".

OFDB always displays an empty movie list.

And OFDB-IMDB doesn't import any actors.


So what to do? I can't use AMC any more. The script-fix request has be done by others weeks ago and nothing changed. Other requested scripts for other german movie/DVD sites haven't come. So, does this mean that the support for german users has been closed? What's up Antp? Can anybody help? :cry:
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Did you try the version of cinefacts & ofdb available from www.antp.be/temp/scripts ?

I do not have time to fix all these scripts personnally (and actually most of the scripts are done by other people, not by me).
Maybe if I have some time and if I do not forget I will check some of them, but it is strange that there are no German user that can do that, like some of the French users do for the French scripts :??:
Viridarium
Posts: 7
Joined: 2006-08-02 21:06:20
Contact:

Post by Viridarium »

I've fixed the cinefacts.de-Script:

Code: Select all

program CineFactsDE;

const
  CRLF = #13#10;

var
  MovieName: string;
  MovieURL: string;

function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
var
  i: Integer;
begin
  result := -1;
  if StartAt < 0 then
    StartAt := 0;
  for i := StartAt to List.Count-1 do
    if Pos(Pattern, List.GetString(i)) <> 0 then
    begin
      result := i;
      Break;
    end;
end;

function MyTrim(str_: string): string;
var
  chars: array of char;
  StrLen, i, LastSpacePos: integer;
begin
  result := '';

  str_ := StringReplace(str_, #9, '');
  str_ := StringReplace(str_, #10, '');
  str_ := StringReplace(str_, #13, '');

  while Pos(' ', str_) = 1 do
  begin
    Delete(str_, Pos(' ', str_), 1);
  end;

  StrLen := Length(str_);
  SetArrayLength(chars, StrLen);
  for i := 0 to StrLen-1 do
  begin
    chars[i] := Copy(str_,i+1,1);
  end;

  str_ := '';
  LastSpacePos := StrLen - 1;
  if LastSpacePos > -1 then
  begin
    while chars[LastSpacePos] = ' ' do
    begin
      LastSpacePos := LastSpacePos - 1;
    end;
    for i:= 0 to LastSpacePos do
    begin
      str_ := str_ + chars[i];
    end;
  end;

  str_ := StringReplace(str_, '  ', ' ');
  while result <> str_ do
  begin
    result := str_;
    str_ := StringReplace(str_, '  ', ' ');
  end;
  result := StringReplace(result, ' ,', ',');

end;

procedure CutAfter(var str_: string; Pattern: string);
begin
  str_ := Copy(str_, Pos(Pattern, str_) + Length(Pattern), Length(str_));
end;

procedure CutBefore(var Str: string; Pattern: string);
begin
  Str := Copy(Str, Pos(Pattern, Str), Length(Str));
end;

function GetStringBetween(str_, StartTag, EndTag: string): string;
var
  BeginPos, EndPos: integer;
begin
  result := '';
  if EndTag = '' then
  begin
    EndPos := Length(str_);
  end
  else
    EndPos := Pos(EndTag, str_);

  BeginPos := Pos(StartTag, str_) + Length(StartTag);
  if StartTag = '' then BeginPos := 1;
  if BeginPos > 0 then result := Copy(str_, BeginPos, EndPos - BeginPos);

end;

function GetTrimmedStringBetween(str_, StartTag, EndTag: string): string;
begin
  result := MyTrim(GetStringBetween(str_, StartTag, EndTag));
end;

// Extracts single movie detail (like director, genre) from page
function GetStringFromHTML(Page, StartTag, CutTag, EndTag: string): string;
begin
  Result := '';
  Page := StringReplace(Page, 'ß','ß');
  // recognition tag - if present, extract detail from page, otherwise assume detail is not present
  if Pos(StartTag, Page) > 0 then begin
    CutBefore(Page, StartTag);
    // optional cut tag helps finding right string in html page
    if Length(CutTag) > 0 then
      CutAfter(Page, CutTag);
    // movie detail copied with html tags up to end string
    Result := Copy(Page, 0, Pos(EndTag, Page) - 1);
    // remove html tags and decode html string
//    HTMLRemoveTags(Result);
    HTMLDecode(Result);
  end;
end;

function StripHTMLTags(str_: string): string;
var
  temp_char : char;
  StrLen, i, CharPos : integer;
  DoCopy : boolean;
begin
  DoCopy := true;
  CharPos := 0;
  result := '';
  StrLen := Length(str_);
  for i := 1 to StrLen do
  begin
    temp_char := Copy(str_,i,1);
    if temp_char = '<' then
    begin
      DoCopy := false;
      continue;
    end
    else if temp_char = '>' then
    begin
      DoCopy := true;
      continue;
    end
    else
    begin
      if DoCopy then
      begin
        result := result + temp_char;
      end;
    end;
  end;

end;

procedure AnalyzeIndexPage(Address: string);
var
  IndexPage: TStringList;
  Page : String;
begin
  IndexPage := TStringList.Create;
  Address := URLEncode(Address);
  IndexPage.Text := GetPage(Address);

  PickTreeClear;
  PickTreeAdd('Search results', '');
  AddMoviesTitles(IndexPage);

  if PickTreeExec(Address) then
  begin
    Page := GetPage(Address);
    AnalyzeMoviePage(Page, Address);
  end;
  IndexPage.Free;
end;



procedure AnalyzeMoviePage(Page, Address :String);
var
  TomString, Line, Temp, Value: string;
  LineNr, IntValue: Integer;
  BeginPos, EndPos: Integer;

  StrPosition: Integer;
  StrTemp,srcPic, MovieID: string;

  OriginalTitle, Country, Year, Genre, Studio, Region, EAN_Number, Distributor, AFK, Duration: string;
  VideoFormat, ScreenFormat, ScreenSystem, Language, AudioFormat, Subtitle, MediaType, Disks: string;
  Comments, Bonusmaterial, Packaging, TranslatedTitle, Director, Cast, Producer, Description: string;
  Music, Screenplay: string;

begin
// Initializing the very important Comments
  Comments := '';
// URL
  SetField(fieldURL, Address);

// Translated title
  TranslatedTitle := MyTrim(GetStringFromHTML(Page,'span class="headline">','">','<br>'));
  SetField(fieldTranslatedTitle, TranslatedTitle);

// Original-Title, Country and Year
  OriginalTitle := MyTrim(GetStringFromHTML(Page, 'Originaltitel:','"first">','(<a href="'));
  StrTemp := MyTrim(GetStringFromHTML(Page, '"land_list.php?name=','">','</dd>'));
  StrTemp := StripHTMLTags(StrTemp);
  StrTemp := GetTrimmedStringBetween(StrTemp,'(',')');
  Country := Copy(StrTemp,1,Length(StrTemp)-4);
  Year := Copy(StrTemp,Length(StrTemp)-4,Length(StrTemp));

  SetField(fieldOriginalTitle, OriginalTitle);
  SetField(fieldCountry, Country);
  SetField(fieldYear, Year);

// EAN-Number

  EAN_Number := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">EAN-Nummer:','', '</dd>')));
  EAN_Number := StringReplace(EAN_Number,'EAN-Nummer:','');
  Comments := Comments + 'EAN-Nummer: ' + EAN_Number + CRLF;

// Genre
  Genre := '';
  Genre := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Genre:', '', '</dd>')));
  Genre := StringReplace(Genre,'Genre: ','');
  setField(fieldCategory, Genre);

// Studio
  Studio := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Studio:','', '</dd>')));
  Studio := StringReplace(Studio,'Studio: ','');
  Comments := Comments + 'Studio: ' + Studio + CRLF;

// Distributor
  Distributor := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Vertrieb:','', '</dd>')));
  Distributor := StringReplace(Distributor,'Vertrieb: ','');
  Comments := Comments + 'Vertrieb: ' + Distributor + CRLF;

// Altersfreigabe
  AFK := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">FSK:','', '</dd>')));
  AFK := StringReplace(AFK,'FSK: ','');
  Comments := Comments + 'Altersfreigabe: ' + AFK + CRLF;

// CountryCode
  Region := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Ländercode:','', '</dd>')));
  Region := StringReplace(Region,'Ländercode: ','');
  VideoFormat := 'DVD Zone '+Region;
  setField(fieldVideoFormat,VideoFormat);

// Duration
  Duration := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Länge:','', '</dd>')));
  Duration := StringReplace(Duration,'Länge: ','');
  Duration := StringReplace(Duration,' Minuten','');
  setField(fieldLength,Duration);

// Description
  Description := GetStringFromHTML(Page, '<li class="text c1">','', '</li>');
  Description := StringReplace(Description, '<br />','*');
  Description := MyTrim(StripHTMLTags(Description));
  Description := StringReplace(Description, '*',CRLF);
  setField(fieldDescription,Description);

// Actors
  Cast := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Schauspieler:','', '</dd>')));
  Cast := StringReplace(Cast,'Schauspieler: ','');
  setField(fieldActors,Cast);

// Director
  Director := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Regie:','', '</dd>')));
  Director := StringReplace(Director,'Regie: ','');
  setField(fieldDirector,Director);

// Production
  Producer := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Produzent:','', '</dd>')));
  Producer := StringReplace(Producer,'Produzent: ','');
  setField(fieldProducer,Producer);

// Music
  Music := '';
  Music := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Musik:','', '</dd>')));
  Music := StringReplace(Music,'Musik:','');
  Music := StringReplace(Music,' Minuten','');
  Comments := Comments + 'Musik:' + Music + CRLF;

// Screenplay
  Screenplay := '';
  Screenplay := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Drehbuch:','', '</dd>')));
  Screenplay := StringReplace(Screenplay,'Drehbuch: ','');
  Comments := Comments + 'Drehbuch: ' + Screenplay + CRLF;

// Screen format & system
  ScreenFormat := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Format:','', '</dd>')));
  ScreenFormat := StringReplace(ScreenFormat,'Format: ','');
  ScreenSystem := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">System:','', '</dd>')));
  ScreenSystem := StringReplace(ScreenSystem,'System: ','');
  setField(fieldResolution,ScreenSystem + ' - ' + ScreenFormat);

// Audioformat/Language
  AudioFormat := '';
  Language := '';
  StrTemp := GetStringFromHTML(Page, '<dt class="c1">Tonformat:', '', '<dt class="c1">Untertitel:');

  StrTemp := StringReplace(StrTemp, '</dd>','*');
  StrTemp := MyTrim(StripHTMLTags(StrTemp));
  StrTemp := StringReplace(StrTemp,'Tonformat: ','');
 
  while Pos('*',StrTemp) > 0 do
  begin
    AudioFormat := AudioFormat + ', ' + MyTrim(Copy(StrTemp,1,Pos(' in ',StrTemp)));
    Language := Language + ', ' + MyTrim(Copy(StrTemp,Pos(' in ',StrTemp)+4,Pos('*',StrTemp)-(Pos(' in ',StrTemp)+4)));
    CutAfter(StrTemp,'*');
  end;
  AudioFormat := Copy(AudioFormat,3,Length(AudioFormat));
  Language := Copy(Language,3,Length(Language));

  setField(fieldAudioFormat, AudioFormat);
  setField(fieldLanguages, Language);

// Subtitles
  Subtitle := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Untertitel:', '', '</dd>')));
  Subtitle := StringReplace(Subtitle,'Untertitel: ','');
  if Subtitle = 'Keine Untertitel' then Subtitle := '';
  setField(fieldSubtitles, Subtitle);

// Mediatype
  MediaType := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Medientyp:','', '</dd>')));
  MediaType := StringReplace(MediaType,'Medientyp: ','');
  setField(fieldMediaType, MediaType);

// Disks
  Disks := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Medienanzahl:','', '</dd>')));
  Disks := StringReplace(Disks,'Medienanzahl: ','');
  setField(fieldDisks, Disks);

// Package
  Packaging := MyTrim(StripHTMLTags(GetStringFromHTML(Page, '<dt class="c1">Verpackung:', '', '</dd>')));
  Packaging := StringReplace(Packaging,'Verpackung:','');
  Comments := Comments + 'Verpackung: ' + Packaging + CRLF;

// Bonusmaterial
  Bonusmaterial := MyTrim(GetStringFromHTML(Page, ' BONUS-MATERIAL </li>', '', '</ul>'));
  Bonusmaterial := StringReplace(Bonusmaterial,'</span>','*');
  Bonusmaterial := StringReplace(Bonusmaterial,'<li>','-');
  Bonusmaterial := MyTrim(StripHTMLTags(Bonusmaterial));
  Bonusmaterial := StringReplace(Bonusmaterial,'BONUS-MATERIAL','');
  Bonusmaterial := StringReplace(Bonusmaterial,'*',CRLF);
  Comments := Comments + CRLF + 'Bonusmaterial' + CRLF + '===========' + CRLF + Bonusmaterial + CRLF;
  setField(fieldComments,Comments);
  if CanSetPicture then
  begin
    MovieID := Copy(Address,Pos('?id=',Address)+4,Length(Address));
    if GetOption('BigPicture') = 1 then
      srcPic := 'http://www.cinefacts.de/bild.php?id=' + MovieID + '&type=db&studio=' + StringReplace(Studio,' ','')
    else
      srcPic := 'http://www.cinefacts.de/bild.php?id=' + MovieID + '&type=ds&studio=' + StringReplace(Studio,' ','');
    GetPicture(srcPic);
  end;
  //DisplayResults;
end;

procedure AddMoviesTitles(ResultsPage: TStringList);
var
  Page,str_: string;
  sNr,pNr,aPage : Integer;
  MovieTitle, MovieAddress: String;
begin
  Page := ResultsPage.Text;
  snr := 0;
  str_ := MyTrim(StripHTMLTags(GetStringFromHTML(Page, 'Anzahl Ergebnisse gesamt:', '', '</li>')));
  str_ := StringReplace(str_,'Anzahl Ergebnisse gesamt: ','');
  pNr := StrToInt(StringReplace(str_,')',''),1);
  aPage := 1;
  while sNr < pNr do
  begin
    while Pos('details.php?id=', Page) > 0 do
    begin
      CutBefore(Page, 'details.php?id=');
      MovieAddress := 'http://www.cinefacts.de/dvd/db/' + GetStringFromHTML(Page, 'details.php?id=', '', '"');
      MovieTitle := MyTrim(GetStringFromHTML(Page, 'details.php?id=', '">', '</tr>'));
      MovieTitle := StringReplace(MovieTitle, '</td>', ' | ');
      MovieTitle := MyTrim(StripHTMLTags(MovieTitle));
      CutAfter(Page, '</tr>');
      PickTreeAdd(MovieTitle, MovieAddress);
    end;
    sNr := sNr + 50;
    aPage := aPage + 1;
    if sNr < pNr then
    Page := GetPage(URLEncode('http://www.cinefacts.de/suche/suche.php?akseite='+IntToStr(aPage)+'&startwert='+IntToStr(sNr)+'&name='+MovieName));
  end;
end;

begin
  if CheckVersion(3,5,0) then
  begin
    MovieName := GetField(fieldTranslatedTitle);
    if MovieName = '' then
      MovieName := GetField(fieldOriginalTitle);
    if Input('cinefacts.de Import', 'Filmtitel eingeben:', MovieName) then
    begin
      AnalyzeIndexPage('http://www.cinefacts.de/suche/suche.php?name='+MovieName+'&go.x=0&go.y=0');
    end;
  end
  else
  ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
willow23
Posts: 1
Joined: 2006-09-30 09:55:36

Post by willow23 »

THANK YOU Viridarium!!!

The fixed script works well! Good job ! I realy apprecaite your effort! I've tried to fix the script myself, but because I'm not a programmer I failed :-)

THX,
Willow
Bad Joker
Posts: 81
Joined: 2002-06-10 12:46:38
Location: Hamburg, Germany
Contact:

Post by Bad Joker »

the ofdb-imdb script is also working again! check this thread:

viewtopic.php?p=21044
mumpel
Posts: 8
Joined: 2006-09-29 19:13:40

Post by mumpel »

@ antp:
Of course I was looking for updates scripts and I surely updated the scripts immediately before I posted. ;) And of course I'm not blaming you. I respect your work very much. But I just mentioned the situation for a german user and the immediate need of help.


@ Viridarium:
Thanks a lot for the fix! I really appreciate this. :grinking:


@ Bad Joker:
I found this fix before. Well, at least it's now running better than before ;) Which means that I'll get data but no actors, like I posted in the starter's post. Now I posted this into the thread additionally. Maybe someone can help. :/
Post Reply