Как добавить поддержку нового сайта в Movienizer?

Movienizer использует скрипты, написанные на Pascal, для получения данных из Интернета. Доступные скрипты хранятся в %APPDATA%\Movienizer\Scripts\ и имеют имя *_movie.pas, где '*' должно быть изменено на имя сайта.

Используйте существующие скрипты как пример для создания нового. Там используются переменные и функции, описанные ниже.

Функции скрипта, которые вызываются из главной программы.

  • function GetMovieNameByUPC(barcode: string): string;  //Get the name of the movie by its UPC Barcode.
  • function GetSearchURLbyName(MovieName: string): string; //Generate a search URL to search for the requested title.
  • function DownloadSearchURL(url: string): integer; //Load the HTML page with search results.
  • function GetMovieURL(code: string; images_only: boolean): string; //Generate URL of the page that contains information about the movie by movie's code in the website's format.
  • function SaveFrontCover(url, Filename: string): boolean; //Save picture from its URL to the given file.
  • procedure GetImages; //Loading images.
  • function GetInfo(url: string; images_only: boolean): string; //Get information about the movie by its URL. If 'images_only' is true, only images will be loaded.

The function GetInfo sets the following variables:

  • title - title of the movie.
  • original_title - original title of the movie (if translated)
  • year - the year of publishing.
  • country - the country that produced.
  • description - description of the movie.
  • duration - in minutes.
  • imdb_code - IMDB code of the movie.
  • movie_code - code of the movie in the format of the website.
  • movie_site_url - URL of movie's website
  • imdb_rating - IMDB rating of the movie
  • script_name - name of the script
  • mpaa - MPAA rating (G, PG etc.)
  • mpaa_rating - MPAA rating (reason for being rated so)

Custom functions can also be defined, if needed.

Передача полученных данных в главную программу.

  • procedure SetGenre(name: string); //Set genre of the movie.
  • procedure SetCountry(name: string); //Set country that produced the movie.
  • procedure SetPersonName(name, character: string; mode: integer; code: string); //Set people that participated in the movie.
    name - name of the person
    character - character in the movie played by the person
    mode - 1=director, 2=writer, 3=actor/actress
  • procedure SetSearchResult(name, code: string; ind: integer); //Set search results.
    name - of what has been found
    code - code in the format of the website
    ind - number of the result (won't be used in future)
  • procedure SetMovieName(name, character: string; mode: integer; code, year: string); //Set movies where the given person participated.
    name - name of the person
    character - character in the movie played by the person
    mode - 1=director, 2=writer, 3=actor/actress
    code - code of the person in the website's format
    year - year the movie was published
  • procedure SetImageName(path, url, description: string; mode: integer); //Set list of images.
    path - filename
    url - URL of the image
    description - description of the image
    mode - type of the image:
    1=Front cover
    2=Back cover
    3=Shot from the movie
    5=User image
  • procedure SaveLoginInfo(UserName, UserPassword, ScriptName: string); //Save user related information required to enter and search the website.

Some information is transferred using global variables in the script: title, year, rating etc. The above procedures are used only for the fields that can contain multiple entries: genre, country etc.

Функции главной программы, которые вызываются из скриптов.

  • var DecimalSeparator: char; //Decimal symbol
  • var ResponseCode; //Response code from the server
  • var UserName; //Username for logging in
  • var UserPassword; //User password for logging in
  • function ParseString(all, s: string; nom: integer): string; //Parse a string using regular expressions.
  • function RemoveEndLines(all: string): string; //Remove end of line symbols using regular expressions. Not recommended.
  • function RemoveTags(all: string): string; //Convert HTML to plain-text
  • function DecodeHTML(all: string): string; //Convert HTML-codes of symbols into plain text symbols
  • function DownloadURL(URL: string): string; //Download page from the URL and return it as a string. If not successful, returns -1. Server's response can be seeing with GetResponseCode.
  • function DownloadURLWithReferer(url, referer: string): string; //Download URL using HTTP_REFERER. If referer=post, POST-method will be used for GET-inquiries.
  • function ReplaceStr(s, s1, s2: string; ind: integer): string; //Searches s for s1-occurancies and replaces them with s2. For example, url:=ReplaceStr(url, ' ', '+') will replace all spaces with pluses in url.
  • function MyPos(substr, s: string; ind: integer): string; //Searches for substr in s starting from the position ind.
  • function ClearExtraSpaces(s: string): string; //Remove extra spaces at the beginning/end.
  • function ClearExtraCharacters(s: string): string: //Remove beginning/end codes <32

Загрузка данных.

Для получения информации о фильме программа должна:

  1. Найти фильм.
  2. Скачать необходимую информацию.

1. Поиск фильма.

If UPC Barcode is provided, we search for the title with the help of GetMovieNameByUPC. If the title is known, we generate URL for searching using GetSearchURLbyName. Then DownloadSearchURL is called to get a list of movies with similar titles. In this function, the script should create a list using SetSearchResult.

2. Загрузка информации о фильме.

For downloading information, GetInfo function is called. It should parse HTML code and set all necessary variables, like title, year, genres, actors, directors etc., images should be downloaded.

If you wish to share your script, please contact us. We will include it into the main package, and other people will be able to enjoy the new functionality. If you have any questions, please feel free to contact support any time.

Скачать бесплатно

Скачать Movienizer
Версия 10.1. Сборка 596 от 30.06.19


История одного киномана. Часть 1