(*
SCRIPT INFO:
This scripts don't use the GET PVdB function for download page (this allows use HTTPS pages).
For do that it use curl free program https://curl.haxx.se.
External files needed in PVdB Scripts folder:
curl-ca-bundle.crt
curl.exe
libcurl.dll
you can get it from curl page (Windows 32- Generic ) https://curl.haxx.se/download.html
For instance: curl-7.50.2-win32-mingw.7z file from https://bintray.com/artifact/download/vszakats/generic/curl-7.50.2-win32-mingw.7z (Thanks Viktor Szakáts).
(The needed files were in "curl-7.50.2-win32-mingw\bin\" folder)
---------------------------------------------
SCRIPT: Rottentomatoes Script
AUTHOR: Ivek23
VERSION: 0.1.1.7
VERSION: 0.2.0.2 -> Ivek23: Fixed procedure Parse Movie.
0.2.0.1 -> VVV: Automatic detects script folder. New Global variable DownloadURL for trace curl page.
0.2.0.0 -> VVV: Download with curl.exe not with PVdB GET function.
0.1.1.7 -> Ivek23: Cretion
DATE: 04/11/2016
---------------------------------------------
*)
//SCRIPT BEGINS HERE...
//Some useful constants
const
//Script types
stMovies = 0;
stPeople = 1;
stPoster = 2;
//Script modes
smSearch = 0;
smNormal = 1;
smCast = 2;
smReview = 3;
//smCredits = 4;
//smDVDReleases = 5;
//smBiography = 6;
//smGenreindex = 7;
//smAwards = 8;
//smMiscellaneous = 9;
smPoster = 10;
smFinished = 11;
//Parse results
prError = 0;
prFinished = 1;
prList = 2;
prListImage = 3;
prDownload = 4;
//Prefix modes
pmNone = 0;
pmEnd = 1;
pmBegin = 2;
pmRemove = 3;
//Download methods
dmGET = 0;
dmPOST = 1;
//Movie fields
mfURL = 0;
mfTitle = 1;
mfOrigTitle = 2;
mfAka = 3;
mfYear = 4;
mfGenre = 5;
mfCategory = 6;
mfCountry = 7;
mfStudio = 8;
mfMPAA = 9;
mfRating = 10;
mfTags = 11;
mfTagline = 12;
mfDescription = 13;
mfDuration = 14;
mfFeatures = 15;
//People fields
pfURL = 0;
pfName = 1;
pfTransName = 2;
pfAltNames = 3;
pfBirthday = 4;
pfBirthplace = 5;
pfGenre = 6;
pfBio = 7;
pfDeathDate = 8;
//pfComment = 9;
//pfBookmark = 10;
//pfPid = 11;
//pfCareer = 12;
//Credits types
ctActors = 0;
ctDirectors = 1;
ctWriters = 2;
ctComposers = 3;
ctProducers = 4;
//Script data
SCRIPT_VERSION = '0.2.0.0';
SCRIPT_NAME = 'Rottentomatoes [HTTPS]';
SCRIPT_DESC = '[EN] Get Movie Information about from Rottentomatoes.com';
SCRIPT_LANG = $09; //English
SCRIPT_TYPE = stMovies;
BASE_URL = 'http://www.rottentomatoes.com'; //The traditional BASE_URL used to get movie ID if the movie is stored for instance 'http://www.rottentomatoes.com/m/godfather'.
BASE_URL_TRUE = 'https://www.rottentomatoes.com'; //True actual link to movie ID 'httpS://www.rottentomatoes.com/m/godfather'.
BASE_URL_RONDABOUT = 'RONDABOUT'; //Used for cheat GET PVdB funtion and rondabout the "https" fail.
BASE_DOWNLOAD_FILE = 'downpage.htm'; //File to store curl page download and then it's not necesary use GET PVdB funtion to download.
BASE_URL_DUMMY = 'DUMMY'; //Used for cheat GET PVdB funtion and rondabout the "https" fail.
RATING_NAME = 'Rottentomatoes';
SEARCH_STR_TRUE = 'https://www.rottentomatoes.com/search/?search=%s'; // Search string for '%s' title
CODE_PAGE = 28591; //Use 0 for Autodetect
//CODE_PAGE = 65001; //Use 0 for Autodetect
//CODE_PAGE = 0; //Use 0 for Autodetect
//User Options
// GET_THEMES = True; //Set to False to ensure ~mfCategory~ not added even if 'Overwrite fields' setting allows
// GET_POSTER = False; //Set to False or True
GET_RATING = True; //Set to False to ensure ~mfRating~ not set even if 'Overwrite setting' fields setting allows
//Global variables
var
ELI : Integer;
Mode : Byte;
DownloadURL : String;
ExtraLinks : array [smCast..smPoster] of String;
//Functions
function GetScriptVersion : String;
begin
Result := SCRIPT_VERSION;
end;
function GetScriptName : String;
begin
Result := SCRIPT_NAME;
end;
function GetScriptDesc : String;
begin
Result := SCRIPT_DESC;
end;
function GetRatingName : String;
begin
Result := RATING_NAME;
end;
function GetScriptLang: Cardinal;
begin
Result := SCRIPT_LANG;
end;
function GetCodePage : Cardinal;
begin
Result := CODE_PAGE;
end;
function GetBaseURL : AnsiString;
begin
Result := BASE_URL_RONDABOUT; //Used for cheat GET PVdB funtion and rondabout the "https" fail.
end;
function GetDownloadURL : AnsiString;
var
curPos,endPos:Integer;
ScriptPath,ItemValue:String;
begin
LogMessage('Function GetDownloadURL|');
LogMessage('Global Var-Mode|'+IntToStr(Mode)+'|');
LogMessage('Global Var-DownloadURL|'+DownloadURL+'|');
ScriptPath:=GetAppPath+'Scripts\';
LogMessage(' Local Var-ScriptPath|'+ScriptPath+'|');
//FileExecute('del ',ScriptPath+BASE_DOWNLOAD_FILE); //Delete the ancient downloaded page only for security. -> Don't work, I don' know why.
if (Mode=smSearch) then begin //DownloadURL don't have the movie URL. If the URL is stored, get and download the movie page and change mode. If not stored download search page.
//Get TheMoviedb_ID if exist.
ItemValue:=StringReplace(GetFieldValueXML('url'),BASE_URL,BASE_URL_TRUE,True,True,False); //Resolves have two diferent stored movie URL.
curPos:=Pos(BASE_URL_TRUE,ItemValue);
if 0