How to make Movienizer support new sites?

How to make Movienizer support new sites. Customize Movienizer.
Locked
User avatar
Vlad
Developer
Posts: 2969
Joined: Wed Jan 23, 2008 11:37 am

How to make Movienizer support new sites?

Post by Vlad » Thu Jan 24, 2008 11:41 am

If you like some website about movies, but Movienizer doesn't support it, you can add the site yourself. There's nothing extremely difficult about it, especially if you really want to do it.

Movienizer uses scripts written in Pascal programming language to fetch information. No compilers or other special software is required to add new scripts. All you need is a simple text editor, preferably with the syntax highlighting feature.

Do you need to have programming experience with Pascal? Actually, no. An experience with some programming language will work for you, but it is not required either. You can simply take an existing script and adjust it so that it will work for a new site.

A short summary of functions and variables that should be implemented in a script you can find here: http://www.movienizer.com/movienizer-scripts.htm

Let's take a closer look on how we adjust scripts.

Movienizer fetches data the same way your browser does. It generates URLs and requests pages. Then it extracts useful information, like actors, directors, description etc.

So, to add a movie, we should find its URL on the given site.

Most websites allow you to search through their pages for the information that you need. As you submit some data, the search function generates a special kind of URL - a search URL. You can see it in the address field of your browser after submitting data.

That's the first thing you need for your script. So, go to your favorite site and perform a search for some title.

Copy the URL from your browser. Go to the script that you are adjusting. Find the GetSearchURLbyName function, see for a line that looks like the following:

Code: Select all

url:=format('http://www.imdb.com/find?q=%%5E%s%%24&type=regexp&tv=both&from_year=1890&to_year=2009&sort=smart;tt=1', [MovieName]);
Replace the existing URL with the one that you have copied from your browser. Find in the URL the title that you have submitted on the page, replace it with %s
%s is a variable that will be replaced with the value of 'MovieName'.

This way the program will be able to search for movies that we enter. It will download a page with search results.

Now our task is to extract all movies from this page with links to their URLs. This is done in the MovieSearch function. The idea is pretty simple: we open a search results page in our browser, make the browser show the source code of the page, then look for unique combinations of code that surrounds what we need. As there can be many results, we build a loop to extract all of them, one after another. The results are transferred to the main program by using SetSearchResult.

Let's take a look from the 'user side'. After completing the MovieSearch function, Movienizer shows us a list of movies. We select a particular title and click "Next".

That's where the GetInfo function of the script is called. We download the page about the movie and extract information from it using unique portions of HTML-code, loops, and other tricks. Use the source code of the page for reference.

If you are not sure about what exactly happens with your code, and why the program doesn't do what it is supposed to do, you can insert

Code: Select all

showMessage(s);
in any place of your code. This will result in showing a dialog box with the content of the variable 's', while you search for titles or extract information with Movienizer using your script.

When finished, post your script here to make it available to the community, or just send it at support. If you don't understand something, just post your question.

Good luck!
ImageImage

Locked