POLAND site SCRIPTs

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.
goblin21
Posts: 16
Joined: 2006-10-05 18:52:58

Post by goblin21 »

Right now any script's not work.
Please HELP
:cry:
Corey
Posts: 17
Joined: 2006-08-13 13:03:30

Post by Corey »

If anyone could fix script for www.filmweb.pl I would be very gratefull.
atomek2000
Posts: 6
Joined: 2004-07-11 18:53:13

Post by atomek2000 »

06.10.2006 - Modifications script for new site design Filmweb.pl. Here you can download this script (ver. beta):
http://klub.chip.pl/atomek2000/Filmweb_ ... krypt.html
antp
Site Admin
Posts: 9639
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Thanks, I'll update it on my server
goblin21
Posts: 16
Joined: 2006-10-05 18:52:58

Post by goblin21 »

This is a new script to filmweb

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL).rar
But not everything its work.

Instead of polish fonts we see strangely signs
Nowojorski policjant (Will Smith) goni bandyte, który poźniej okazuje się... kosmita. Wkrótce tajne słuzby postanawiają wcielić go do "Facetów w Czerni". Okazuje się najlepszym kandydatem na to stanowisko i zostaje przyjety. Wraz ze swoim, doświadczonym juş partnerem musi ocalic świat. Okazuje sie, şe na Ziemi, jest pełno obcych, a wszystko to ukrywa rząd USA. Jeden z nich posiada Galaktykę. Jeśli trafi ona w złe ręce swiatu bedzie grozić zagłada. Niestety właściciel Galaktyki zostaje zamordowany, a ja sama przejmuje inny Obcy. , którego j wraz ze swoim partnerem muszą złapać. Filp prześmieszny, na którym mozna się dobrze bawić.

Jak widzicie zamiast polskich fontów ściąga krzaki
Strony filmweb'u pisane są w utf-8
Please test it and tel me what is wrong
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!

Problem is coused by FilmWeb :) they are still changing their site. Script worked fine yesterday and even today morning. I'm right now working on correcting problems, but if I change one thing the second stops working. Maybe we have to wait until they finish their improvements, or we will have to change scripts evry few days.
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!
As for now this script below works fine, but I dont know how long it will be :)

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL) 1.3.0.rar
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!
Script is still working :) so I've added new function wich somebody requested. Now from script option you can choose ActorsLayout.

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL) 1.3.1.rar
goblin21
Posts: 16
Joined: 2006-10-05 18:52:58

Post by goblin21 »

Great script :grinking:
Thanks
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!
I've corrected the year acquiring. Actual script:

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL) 1.3.2.rar
Corey
Posts: 17
Joined: 2006-08-13 13:03:30

Post by Corey »

Seems that filmweb.pl has changed page code again. I'm using filmweb 1.3.2 script made by Klemens and until today everything was fine. Now first two letters of local title are cut when reading info from web. I would be gratefull if somebody posts corrected script.

-------
Add I:
When local title is the same as original title, they both have first two letters cut.

-------
Add II:
Atomek2000 already corrected his script, but the script from Klemens has more functions (for ex: selecting one description from multiple ones on filmweb). So Klemens, pls update your script :)
admas
Posts: 90
Joined: 2006-07-23 06:54:31

Corrected script filmweb.pl

Post by admas »

All takes correctly already

Code: Select all

(***************************************************

Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/

[Infos]
Authors=(c) 2002 Piotr Kardasz
Title=Filmweb (PL)
Description=Movie importation script for Filmweb info & picture
Site=http://www.filmweb.pl
Language=PL
Version=1.3.3
Requires=3.5.0.1
Comments=05.10.2003 Improvements made by Adma's|07.10.2003 Modifications by Adma's to import small picture|03.03.2004 Modyfications by BestiaPL support for new movie database links|20.12.2004 Modyfications by Atomek2000 support for new site design Filmweb|14.02.2005 Improvements made by Adma's|02.05.2005 Small modyfication by Mi$ta$|08.05.2005 Modyfications by Atomek2000 for correct rating, requirement AMC 3.5.0.1 for correct download pictures (bug in AMC 3.5.0.0)|29.08.2005 Modyfications by Atomek2000 to import Producer and change URL|13.07.2006 Powrocil Rok Produkcji i naprawiony zostal ucinany Polski Tytul. Poprawki: snorek@gmail.com|29.07.2006 Powrocil kraj produkcji i URL do filmu.|04.10.2006 Modifications after FilmWeb has changed construction of their Pages, Added Multiple selection of Descriptions. Changes: Klemens (klemensble@gmail.com)|06.10.2006 Adding UTF-8, correcting some minor problems. Changes: Klemens (klemensble@gmail.com)|07.10.2006 Added script option for choosing"ActorsLayout". Changes: Klemens (klemensble@gmail.com)|07.10.2006 Modyfikacji w opcji wyboru układu obsady (dodanie 5 opcji) by Adma's|12.10.2006 Corrected Year acquiring.
License=This program is free software; you can redistribute it and/or modify it under the  terms of the GNU General Public License as published by the Free Software Foundation;  either version 2 of the License, or (at your option) any later version. |
GetInfo=1

[Options]
AktorzyUklad=5|3|0=Tylko nazwiska aktorów, rozdzielone przecinkami|1=Tylko nazwiska aktorów, każde w nowej lini|2=Nazwiska aktorów i odgrywanych postaci '-', rozdzielone przecinkami|3=Nazwiska aktorów i odgrywanych postaci '-', każde w nowej lini|4=Nazwiska aktorów i odgrywanych postaci 'jako', każde w nowej lini

***************************************************)

program FilmWeb;
uses
  StringUtils1;

var
  MovieName: string;
  Link: string;

procedure DelSpace(var Value: String);
var
  FullValue: String;
  Counter: Integer;
begin
  if Value <> '' then
  begin
    FullValue := FullValue + StrGet(Value, 1);
    for Counter := 2 to Length(Value) do
    begin
      if StrGet(Value, Counter) <> ' ' then
        FullValue := FullValue + StrGet(Value, Counter)
      else
        if StrGet(FullValue, Length(FullValue)) <> ' ' then
          FullValue := FullValue + ' ';
    end;
    Value := FullValue;
  end
end;

procedure DecodeHTML(var Value: String);
var
  FullValue, CharCode: String;
  Counter: Integer;
begin
  if Value <> '' then
  begin
    FullValue := '';
    Counter := 1;
    repeat
      if StrGet(Value, Counter) <> '&' then
        begin
          CharCode := copy(Value, Counter, 1);
          case CharCode of
            '±': CharCode := 'ą';
            '¶': CharCode := 'ś';
            'ˇ': CharCode := 'Ą';
            'Ľ': CharCode := 'ź';
            '¦': CharCode := 'Ś';
            '¬': CharCode := 'Ź';
          end;
          FullValue := FullValue + CharCode;
          Counter := Counter + 1;
        end
      else
        begin
          CharCode := copy(Value, Counter, 7);
          case CharCode of
            'ą': FullValue := FullValue + 'ą';
            'ć': FullValue := FullValue + 'ć';
            'ę': FullValue := FullValue + 'ę';
            'ł': FullValue := FullValue + 'ł';
            'ń': FullValue := FullValue + 'ń';
            'ó': FullValue := FullValue + 'ó';
            'ś': FullValue := FullValue + 'ś';
            'ź': FullValue := FullValue + 'ź';
            'ż': FullValue := FullValue + 'ż';
            'Ą': FullValue := FullValue + 'Ą';
            'Ć': FullValue := FullValue + 'Ć';
            'Ę': FullValue := FullValue + 'Ę';
            'Ł': FullValue := FullValue + 'Ł';
            'Ń': FullValue := FullValue + 'Ń';
            'Ó': FullValue := FullValue + 'Ó';
            'Ś': FullValue := FullValue + 'Ś';
            'Ź': FullValue := FullValue + 'Ź';
            'Ż': FullValue := FullValue + 'Ż';
            'Š': FullValue := FullValue + ' ';
            'š': FullValue := FullValue + 'ˇ';
            'Ţ': FullValue := FullValue + 'ˇ';
            'ţ': FullValue := FullValue + 'Ł';
            'Ť': FullValue := FullValue + '¤';
            'ť': FullValue := FullValue + 'Ą';
            'Ŧ': FullValue := FullValue + 'Ś';
            'ŧ': FullValue := FullValue + '§';
            'Ũ': FullValue := FullValue + '¨';
            'ũ': FullValue := FullValue + '©';
            'Ű': FullValue := FullValue + 'Ş';
            'ű': FullValue := FullValue + '«';
            'Ų': FullValue := FullValue + '¬';
            'ų': FullValue := FullValue + '­';
            'Ŵ': FullValue := FullValue + '®';
            'ŵ': FullValue := FullValue + 'Ż';
            'Ŷ': FullValue := FullValue + '°';
            'ŷ': FullValue := FullValue + '±';
            'Ÿ': FullValue := FullValue + '˛';
            'ƀ': FullValue := FullValue + '´';
            'Ɓ': FullValue := FullValue + 'µ';
            'Ƃ': FullValue := FullValue + '¶';
            'ƃ': FullValue := FullValue + '·';
            'Ƅ': FullValue := FullValue + '¸';
            'ƅ': FullValue := FullValue + 'ą';
            'Ɔ': FullValue := FullValue + 'ş';
            'Ƈ': FullValue := FullValue + '»';
            'ƈ': FullValue := FullValue + 'Ľ';
            'Ɖ': FullValue := FullValue + '˝';
            'Ɛ': FullValue := FullValue + 'ľ';
            'Ƒ': FullValue := FullValue + 'ż';
            'ƒ': FullValue := FullValue + 'Ŕ';
            'Ɠ': FullValue := FullValue + 'Á';
            'Ɣ': FullValue := FullValue + 'Â';
            'ƕ': FullValue := FullValue + 'Ă';
            'Ɩ': FullValue := FullValue + 'Ä';
            'Ɨ': FullValue := FullValue + 'Ĺ';
            'Ƙ': FullValue := FullValue + 'Ć';
            'ƙ': FullValue := FullValue + 'Ç';
            'Ȁ': FullValue := FullValue + 'Č';
            'ȁ': FullValue := FullValue + 'É';
            'Ȃ': FullValue := FullValue + 'Ę';
            'ȃ': FullValue := FullValue + 'Ë';
            'Ȅ': FullValue := FullValue + 'Ě';
            'ȅ': FullValue := FullValue + 'Í';
            'Ȇ': FullValue := FullValue + 'Î';
            'ȇ': FullValue := FullValue + 'Ď';
            'Ȉ': FullValue := FullValue + 'Đ';
            'ȉ': FullValue := FullValue + 'Ń';
            'Ȑ': FullValue := FullValue + 'Ň';
            'ȑ': FullValue := FullValue + 'Ó';
            'Ȓ': FullValue := FullValue + 'Ô';
            'ȓ': FullValue := FullValue + 'Ő';
            'Ȕ': FullValue := FullValue + 'Ö';
            'ȕ': FullValue := FullValue + '×';
            'Ȗ': FullValue := FullValue + 'Ř';
            'ȗ': FullValue := FullValue + 'Ů';
            'Ș': FullValue := FullValue + 'Ú';
            'ș': FullValue := FullValue + 'Ű';
            'Ƞ': FullValue := FullValue + 'Ü';
            'ȡ': FullValue := FullValue + 'Ý';
            'Ȣ': FullValue := FullValue + 'Ţ';
            'ȣ': FullValue := FullValue + 'ß';
            'Ȥ': FullValue := FullValue + 'ŕ';
            'ȥ': FullValue := FullValue + 'á';
            'Ȧ': FullValue := FullValue + 'â';
            'ȧ': FullValue := FullValue + 'ă';
            'Ȩ': FullValue := FullValue + 'ä';
            'ȩ': FullValue := FullValue + 'ĺ';
            'Ȱ': FullValue := FullValue + 'ć';
            'ȱ': FullValue := FullValue + 'ç';
            'Ȳ': FullValue := FullValue + 'č';
            'ȳ': FullValue := FullValue + 'é';
            'ȴ': FullValue := FullValue + 'ę';
            'ȵ': FullValue := FullValue + 'ë';
            'ȶ': FullValue := FullValue + 'ě';
            'ȷ': FullValue := FullValue + 'í';
            'ȸ': FullValue := FullValue + 'î';
            'ȹ': FullValue := FullValue + 'ď';
            'ɀ': FullValue := FullValue + 'đ';
            'Ɂ': FullValue := FullValue + 'ń';
            'ɂ': FullValue := FullValue + 'ň';
            'Ƀ': FullValue := FullValue + 'ó';
            'Ʉ': FullValue := FullValue + 'ô';
            'Ʌ': FullValue := FullValue + 'ő';
            'Ɇ': FullValue := FullValue + 'ö';
            'ɇ': FullValue := FullValue + '÷';
            'Ɉ': FullValue := FullValue + 'ř';
            'ɉ': FullValue := FullValue + 'ů';
            'ɐ': FullValue := FullValue + 'ú';
            'ɑ': FullValue := FullValue + 'ű';
            'ɒ': FullValue := FullValue + 'ü';
            'ɓ': FullValue := FullValue + 'ý';
            'ɔ': FullValue := FullValue + 'ţ';
            'ɕ': FullValue := FullValue + '˙';
            '&#x%DF;': FullValue := FullValue + 'ß';
            '4': FullValue := FullValue + '"';
            '–': FullValue := FullValue + '-';
            '‘': FullValue := FullValue + '"';
            '’': FullValue := FullValue + '"';
            '“': FullValue := FullValue + '"';
            '”': FullValue := FullValue + '"';
            '„': FullValue := FullValue + '"';
          else
            FullValue := FullValue + CharCode;  
          end;
          Counter := Counter + 7;
        end;
    until Counter > Length(Value);
    HTMLDecode(FullValue);
    Value := FullValue;
  end
end;

procedure AddMoviesTitles(Page: TStringList; var LineNr: Integer);
var
  Line: string;
  MovieTitle, MovieAddress: string;
  StartPos, EndPos: Integer;
begin
  LineNr := FindLine('<b>filmy</b>:', Page, LineNr);
  if LineNr > -1 then
  begin
    PickTreeAdd('Znaleziono filmy:', '');
    Line := Page.GetString(LineNr);
    repeat
      if (Pos('<a title=', Line) > 0) and (Pos('zobacz więcej', Line) <= 0) then
      begin
        StartPos := pos('<a title=', Line) + 10;
        Line := copy(Line, StartPos, Length(Line) - StartPos);
        MovieTitle := copy(Line, 1, pos('href', Line) - 3);
        DecodeHTML(MovieTitle);
        HTMLRemoveTags(MovieTitle);
        StartPos := pos('href=', Line) + 6;
        Line := copy(Line, StartPos, Length(Line));
          if pos('"', Line) > 0
            then MovieAddress:= Copy(Line, 1, Pos('"', Line) - 1)
            else MovieAddress:= Copy(Line, 1, Pos('class=', Line) - 3);
        PickTreeAdd(MovieTitle, MovieAddress);
      end;
      LineNr := LineNr + 1;
      Line := Page.GetString(LineNr);
    until Pos('</table>', Line) > 0;
  end
  else
    break;
end;

procedure AnalyzePage(Address: string);
var
  Page: TStringList;
  LineNr: Integer;
begin
  Page := TStringList.Create;
  Page.Text := UTF8Decode(GetPage(Address));
  Link:=Address;
  if pos('<div id="filmTitle">', Page.Text) > 0 then
    AnalyzeMoviePage(Page)
  else if pos('href=', Page.Text) > 0 then
  begin
    PickTreeClear;
    LineNr := 0;
    AddMoviesTitles(Page, LineNr);
    if PickTreeExec(Address) then
      AnalyzePage(Address);
  end;
  Page.Free;
end;

procedure AnalyzeMoviePage(Page: TStringList);
var
  Line, Value, FullValue: string;
  LineNr, Counter: Integer;
  StartPos, EndPos: Integer;
  PageOpis: TStringList;
  LineNrOpis: Integer;
  AddressOpis: String;
  PagePelnaObsada: TStringList;
  AddressPelnaObsada: String;
begin

  // Tytuł polski
  LineNr := FindLine('<div id="filmTitle">', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Line := Page.GetString(LineNr+1);
    StartPos := 14;
    Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
    DecodeHTML(Line);
    SetField(fieldTranslatedTitle, Line);
  end

  // Tytuł oryginalny
  Value:=Line;
  LineNr := FindLine('<span class="otherTitle">', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    if (pos('<span class="otherTitle">(', Line) > 0) or (pos('<span class="otherTitle"> </span>', Line) > 0) or (pos('</span>', Line) = 0)
      then Line:=Value
      else begin
        StartPos := pos('<span class="otherTitle">', Line) + 25;
        Line := copy(Line, StartPos, Length(Line) - StartPos);
        StartPos := pos('</', Line) - 1;
        Line := copy(Line, 1, StartPos);
        if copy(Line, Length(Line), 1) = ' ' then Line := copy(Line, 1, Length(Line) - 1);
      end;
    DecodeHTML(Line);
    SetField(fieldOriginalTitle, Line);
  end

  // Średnia ocena  
  LineNr := FindLine('</b>/10', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('">', Line) + 2;
    Line := copy(Line, StartPos, Length(Line) - StartPos);
    StartPos := pos('</b>', Line);
    Line := copy(Line, 1, StartPos - 1);
    //Line:=IntToStr(Round(StrToInt(copy(Line, 1, Length(Line)-3),0)*10+StrToInt(copy(Line, 3, 2), 0) / 10)); //zaokrąglenie oceny do dziesiętnej
    Delete(Line, 2, 1);
    if Length(Line) = 3 then
      Line := IntToStr(Round(StrToInt(Line, 0) / 10));
    Value := copy(Line, 1, 1) + ',' + copy(Line, 2, 1);
    SetField(fieldRating, Value);
  end
 
  // Kategoria
  LineNr := FindLine('genre.id', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Value := '';
    while Pos('genre.id=', Line) > 0 do
    begin
      StartPos := pos('genre.id=', Line) + 9;
      Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
      StartPos := pos('">', Line) + 2;
      Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
      StartPos := pos('</', Line);
      Value:= Value + copy(Line,1, StartPos - 1) + ', ';
    end;
    Value := copy(Value, 1, Length(Value) - 2);
    DecodeHTML(Value);
    SetField(fieldCategory, Value);
  end
    
  // Kraj
  LineNr := FindLine('produkcja:', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    Value := '';
    while Pos('country.id=', Line) > 0 do
    begin
      StartPos := pos('country.id=', Line) + 11;
      Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
      StartPos := pos('">', Line) + 2;
      Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
      StartPos := pos('</', Line);
      Value:= Value + copy(Line,1, StartPos - 1) + ', ';
    end;
    Value := copy(Value, 1, Length(Value) - 2);
    DecodeHTML(Value);
    SetField(fieldCountry, Value);
  end

  // Rok produkcji
  LineNr := FindLine('<div id="filmTitle">', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    while (Pos('(20', Line) = 0) and (Pos('(19', Line) = 0) do
    begin
      LineNr := LineNr +1;
      Line := Page.GetString(LineNr);
    end;
    StartPos := Pos('(', Line);
    Value := copy(Line, StartPos+1, 4);
    SetField(fieldYear, Value);
  end
  

  // Reżyseria
{  LineNr := FindLine('reżyseria', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos:= Pos('scenariusz', Line) - 1;
    Line:= Copy(Line, 1, StartPos);
    StartPos:= Pos('reżyseria', Line) + 9;
    Line:= Copy(Line, StartPos, Length(Line));
    Value:='';
    repeat
      StartPos:= Pos('">', Line) + 2;
      Line:= Copy(Line, StartPos, Length(Line) - StartPos);
      Value:= Value + Copy(Line, 1, Pos('</a>', Line) - 1) + ', ';
    until Pos('">', Line) <= 0;
    Value:= Copy(Value, 1, Length(Value) - 2);
    DecodeHTML(Value);
    SetField(fieldDirector, Value);
  end}

  // URL, Reżyseria, Producent i Obsada
  //LineNr := FindLine('obsada</a>', Page, 0);
  LineNr := FindLine('obsada</a>', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('href="', Line) + 6;
    Line := copy(Line, StartPos, Length(Line) - StartPos);
    StartPos := pos('">', Line);
    Line := copy(Line, 1, StartPos - 1);
    AddressPelnaObsada := Line;
    PagePelnaObsada := TStringList.Create;
    PagePelnaObsada.Text := UTF8Decode(GetPage(AddressPelnaObsada));

    LineNr := FindLine('">o filmie', PagePelnaObsada, 0);
    if LineNr > -1 then
    begin
      Line := PagePelnaObsada.GetString(LineNr);
      StartPos := pos('href="', Line) + 6;
      Line := copy(Line, StartPos, Length(Line));
      StartPos := pos('">', Line);
      Line := copy(Line, 1, StartPos - 1);
      Value := Line;
      SetField(fieldURL, Value);
    end
    
    // Reżyseria
    LineNr := FindLine('reżyseria</div>', PagePelnaObsada, 0);
    if LineNr > -1 then
    begin
      LineNr := LineNr + 1;
      Line := PagePelnaObsada.GetString(LineNr);
      While Pos('<a class="filmActor"', Line) <= 0 do
      begin
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      end;
      Value := '';
      repeat
        if Pos('<a class="filmActor"', Line) > 0 then
        begin
          //Line:= Copy(Line, Pos('title=', Line) + 7, Length(Line));
          StartPos:= Pos('">', Line) + 2;
          Line:= Copy(Line, StartPos, Length(Line));
          Value:= Value + Copy(Line, 1, Pos('</a', Line) - 1) + ', ';
        end;
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      until (Pos('class="rolesLabel"', Line) > 0) or (Pos('class="clr"', Line) > 0);
      Value := copy(Value, 1, Length(Value) - 2);
      DecodeHTML(Value);
      SetField(fieldDirector, Value);
    end;
    
    //Producent
    LineNr := FindLine('producent</div>', PagePelnaObsada, 0);
    if LineNr > -1 then
    begin
      LineNr:= LineNr + 1;
      Line := PagePelnaObsada.GetString(LineNr);
      While Pos('<a class="filmActor"', Line) <= 0 do
      begin
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      end;
      Value := '';
      repeat
        if Pos('<a class="filmActor"', Line) > 0 then
        begin
          //Line:= Copy(Line, Pos('title=', Line) + 7, Length(Line));
          StartPos:= Pos('">', Line) + 2;
          Line:= Copy(Line, StartPos, Length(Line));
          Value:= Value + Copy(Line, 1, Pos('</a', Line) - 1) + ', ';
        end;
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      until (Pos('class="rolesLabel"', Line) > 0) or (Pos('class="clr"', Line) > 0);
      Value := copy(Value, 1, Length(Value) - 2);
      DecodeHTML(Value);
      SetField(fieldProducer, Value);
    end;
    
    //Obsada
    LineNr := FindLine('aktorzy</div>', PagePelnaObsada, 0);
    if LineNr > -1 then
    begin
      LineNr:= LineNr + 1;
      Line := PagePelnaObsada.GetString(LineNr);
      While Pos('<a class="filmActor"', Line) <= 0 do
      begin
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      end;
      Value := '';
      repeat
        if Pos('<a class="filmActor"', Line) > 0 then
        begin
          //Line:= Copy(Line, Pos('title=', Line) + 7, Length(Line));
          StartPos := Pos('">', Line) + 2;
          Line := Copy(Line, StartPos, Length(Line));
          //Value := Value + Copy(Line, 1, Pos('</a', Line) - 1) + ', ';
          Value := Value + Copy(Line, 1, Pos('</a', Line) - 1);
          case GetOption('AktorzyUklad') of
            0:Value := Value + ', ';
            1:Value := Value + #13#10;
            2,3,4,5:begin
              Line := PagePelnaObsada.GetString(LineNr+4);
              Line := StringReplace(Line, #9, '');
              case GetOption('AktorzyUklad') of
                2:Value := Value + ' - ' + Line + ', ';
                3:Value := Value + ' - ' + Line + #13#10;
                4:Value := Value + ' jako ' + Line + #13#10;
                5:Value := Value + ': (jako '+ Line +')'+', ';
              end
            end;
          end;
        end;
        LineNr:= LineNr + 1;
        Line := PagePelnaObsada.GetString(LineNr);
      until (Pos('class="rolesLabel"', Line) > 0) or (Pos('class="clr"', Line) > 0);
      Value := copy(Value, 1, Length(Value) - 2);
      DecodeHTML(Value);
      SetField(fieldActors, Value);
    end;
    
    PagePelnaObsada.Free;
  end

  // Czas trwania
  LineNr := FindLine('czas trwania:', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('czas trwania:', Line) + 14;
    Line := copy(Line, StartPos, Length(Line) - StartPos + 1);
    StartPos := pos(#9, Line);
    Line := copy(Line, 1, StartPos - 1);
    SetField(fieldLength, Line);
  end
  
  // Opis filmu
  LineNr := FindLine('">opisy</a>', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('href="', Line) + 6;
    Line := copy(Line, StartPos, Length(Line) - StartPos);
    StartPos := pos('">', Line);
    Line := copy(Line, 1, StartPos - 1);
    AddressOpis := Line;
    SetField(fieldComments, 'Dodatkowe opisy filmu na stronie: ' + AddressOpis);
    PageOpis := TStringList.Create;
    //PageOpis.Text := GetPage(AddressOpis);
    PageOpis.Text := UTF8Decode(GetPage(AddressOpis));
    PickListClear;
    Value := '';
    LineNr := FindLine('<div align="justify">', PageOpis, 0);
    if LineNr > -1 then
    begin
    while LineNr > -1 do
      begin
        Line := PageOpis.GetString(LineNr);
        while pos('</div></li>', Line) = 0 do
        begin
          LineNr := LineNr + 1;
          Line := Line + PageOpis.GetString(LineNr);
        end;
        
        Value := TextBetween(Line, '<li><div align="justify">', '</div></li>');

        Value := StringReplace(Value, #13#10, ' ');
        Value := StringReplace(Value, '<br/>', #13#10);
        HTMLRemoveTags(Value);
        DecodeHTML(Value);
        while Pos('  ', Value) > 0 do
          Value := StringReplace(Value, '  ', ' ');
        {PickListAdd(Trim(Value));}
        PickListAdd(Value);
        LineNr := FindLine('<div align="justify">', PageOpis, LineNr + 1);
      end;
      if not PickListExec('Wybierz opis dla "' + GetField(fieldOriginalTitle) + '"', Value) then
        Value := '';
    end;
    SetField(fieldDescription, Value);
    PageOpis.Free;
  end
  
  // Obsada - obecnie jest czytana przy okazji czytania producentów

  //URL
{  LineNr := FindLine('">o filmie', Page, 0);
  if LineNr > -1 then
  begin
    Line := Page.GetString(LineNr);
    StartPos := pos('href="', Line) + 6;
    Line := copy(Line, StartPos, Length(Line));
    StartPos := pos('">', Line);
    Line := copy(Line, 1, StartPos - 1);
    Value:=Line;
    SetField(fieldURL, Value);
  end}

 //Foto
  Value:= '';
  //LineNr:= FindLine('<img  src="http://gfx.filmweb.pl', Page, 0);
  LineNr:= FindLine('<a href="http://gfx.filmweb.pl', Page, 0);
  if LineNr > -1
  then begin
    Line:= Page.GetString(LineNr);
    //StartPos:= Pos('src=', Line) + 5;
    StartPos:= Pos('href=', Line) + 6;
    Line:= Copy(Line, StartPos, Length(Line));
    Line:= Copy(Line, 1, Pos('alt=', Line) - 3);
    Line:= Copy(Line, 1, Pos('"', Line) - 1);
    HTMLRemoveTags(Line);
    DecodeHTML(Line);
    DelSpace(Line);
    GetPicture(Line);
  end;
end;

begin
  if CheckVersion(3,5,0) then
  begin
    MovieName := GetField(fieldOriginalTitle);
    if MovieName = '' then
      MovieName := GetField(fieldTranslatedTitle);
    if Input('FilmWeb Import', 'Podaj tytuł filmu:', MovieName) then
    begin
      MovieName:=StringReplace(MovieName, 'ą', chr(177));  // Zamiana na ISO-8859-2
      MovieName:=StringReplace(MovieName, 'ć', chr(230));
      MovieName:=StringReplace(MovieName, 'ę', chr(234));
      MovieName:=StringReplace(MovieName, 'ł', chr(179));
      MovieName:=StringReplace(MovieName, 'ń', chr(241));
      MovieName:=StringReplace(MovieName, 'ó', chr(243));
      MovieName:=StringReplace(MovieName, 'ś', chr(182));
      MovieName:=StringReplace(MovieName, 'ź', chr(188));
      MovieName:=StringReplace(MovieName, 'ż', chr(191));
      MovieName:=StringReplace(MovieName, 'Ą', chr(161));
      MovieName:=StringReplace(MovieName, 'Ć', chr(198));
      MovieName:=StringReplace(MovieName, 'Ę', chr(202));
      MovieName:=StringReplace(MovieName, 'Ł', chr(163));
      MovieName:=StringReplace(MovieName, 'Ń', chr(209));
      MovieName:=StringReplace(MovieName, 'Ó', chr(211));
      MovieName:=StringReplace(MovieName, 'Ś', chr(166));
      MovieName:=StringReplace(MovieName, 'Ź', chr(172));
      MovieName:=StringReplace(MovieName, 'Ż', chr(175));
      MovieName:=StringReplace(MovieName, ' ', '+');
      AnalyzePage('http://filmweb.pl/Find?query=' + MovieName + '&category=1');
    end;
  end else
    ShowMessage('Skrypt wymaga programu Ant Movie Catalog w wersji 3.5.0.1 lub nowszej');
end.
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!
I've corrected the script, here is the actual link:

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL) 1.3.3.rar
Corey
Posts: 17
Joined: 2006-08-13 13:03:30

Post by Corey »

Thx for quick response. I've found another "bug" (if I can call it that). Script acquires informations about actors and show it like this: "Actor Name - Role Played". But when there is only actor name on filmweb, info looks like that: "Actor Name - <div class="filmRoleRow">. Maybe you can fix it, that in case of missing "Role Played" it would show only actor name.

If you want to check it by yourself, try the movie "Nic Śmiesznego" with Cezary Pazura.
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!

Unfotunately it was realy a bug. When there wasn't Character description in the line with actor name, the script was adding some trashes after actor name. Now it is fixed in this script:

Code: Select all

http://www.amcskrypt.republika.pl/Filmweb (PL) 1.3.4.rar
Corey
Posts: 17
Joined: 2006-08-13 13:03:30

Post by Corey »

Thx for the fix :) You are really quick in fixing things :P I think this script is by far the best script for making polish database. And with this kind of "customer support" :lol: it will stay like this for a long time.
Bialy-
Posts: 10
Joined: 2006-11-25 22:51:46
Location: Krakow / Poland
Contact:

Post by Bialy- »

I have a small problem with filmweb script. As you know, there is a line like that: 'AktorzyUklad=...'. No matter, what i set there, I don't have any commas and spaces between actors names.
Could you help me, and tell, what (and how) should I set there to have names in one line with commas? :)

I would be very grateful ;)
Klemens
Posts: 19
Joined: 2006-10-06 19:31:20
Location: Poland

Post by Klemens »

Hi!

I'm not sure if I guess where is your problem, but this will not work if you are changing this value directly in the script file on disk. You must set value 'AktorzyUklad' inside the program - to do that after pressing F6, select Filmweb script and then in window ("Opcje skryptu") at right top corner double click on "AktorzyUklad" and select proper value.
Bialy-
Posts: 10
Joined: 2006-11-25 22:51:46
Location: Krakow / Poland
Contact:

Post by Bialy- »

Oh, it works :P Thank's a lot! I wonder why I haven't seen it before :P

Thanks again ;)
goblin21
Posts: 16
Joined: 2006-10-05 18:52:58

Post by goblin21 »

Filmweb.pl change something in site, and script not work.
HELP
Locked