//_____________________________________________________________________________________\\ //------ SCRIPT : Allocine_Movie_Essai \\ //------ Author : Pra15 \\ //------ Date : 12/02/2015 \\ //_____________________________________________________________________________________\\ // const pauseBeforeLoad = 2000; // Pause before loading (in millisecond) nMaxAffiches = 6; // Nombre Maximum de photos affiches a télécharger nMaxPhotos = 2; // Nombre Maximum de photos a telecharger const //Script modes smSearch = 0; smNormal = 1; smCasting = 2; smBA = 3; smSecrets = 4; smAwards = 5; smPrePhoto = 6; smPhoto = 7; smFinished = 8; //Parse results prError = 0; prFinished = 1; prList = 2; prListImage = 3; prDownload = 4; //Credits types ctActors = 0; ctDirectors = 1; ctWriters = 2; ctComposers = 3; ctProducers = 4; //Script data SCRIPT_VERSION = '0.0.0.1'; SCRIPT_NAME = 'Allocine.fr(Essai)'; SCRIPT_DESC = '[FR] Get movie information from Allocine.com'; SCRIPT_LANG = $0c; //French SCRIPT_TYPE = 0; //Movies CODE_PAGE = 65001; //Autodetect 65001 RATING_NAME = 'ADE'; BASE_URL = 'http://www.allocine.fr'; SEARCH_STR = BASE_URL +'/recherche/1/?q=%s'; //Global Variables : var Mode: Byte; ELI, countPhoto : Integer; numMovie : String; ExtraLinks : Array [smCasting..smPhoto] of string; LinksPreAffiche, LinksAffiche, LinksPrePhoto, LinksPhoto : Array of String; 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; end; function GetScriptType: Byte; begin Result := SCRIPT_TYPE; end; function GetCurrentMode: Byte; begin Result := Mode; end; function GetDownloadURL: AnsiString; begin LogMessage('GetdownloadURL demarre'); if Mode = smSearch then begin Result := SEARCH_STR end else if Mode = smPhoto then begin If countPhoto <= High(LinksPreAffiche) then begin Result := LinksPreAffiche[countPhoto]; end else if (countPhoto > High(LinksPreAffiche)) AND (countPhoto <= High(LinksPrePhoto)) then begin Result := LinksPrePhoto[countPhoto]; end; end else begin Result := ExtraLinks[Mode]; end; LogMessage('Mode sortie getdownloadURL:' + IntTostr(Mode)); end; function NextMode(curMode : Integer) : Integer; var I : Integer; begin Result := smFinished; if curMode < Low(ExtraLinks) - 1 then curMode := Low(ExtraLinks) - 1; for I := curMode + 1 to (High(ExtraLinks)-1) do if ExtraLinks[I] <> '' then begin Result := I; Break; end; If curMode = smPhoto then begin If countPhoto < (High(LinksPreAffiche)+High(LinksPrePhoto)) then begin Result := curMode; end else begin Result := curMode+1; end; end; end; ////////// PARSE FIRST PAGE ////////// procedure ParseFirstPage(MovieURL : String; HTML : String); Var CurPos, EndPos : Integer; Title : String; BEGIN LogMessage('Informations sur page principale du film:'); //Titre : //Addresse du film : AddFieldValueXML('url', MovieURL); //Titre du Film : CurPos := Pos('/breadcrumbs -->',HTML); CurPos := PosFrom('content="',HTML,CurPos)+9; EndPos := PosFrom('" />',HTML,CurPos); Title := Trim(Copy(HTML,CurPos,EndPos-CurPos)); LogMessage('Titre du Film: ' + Title); AddFieldValue(2, Title); //Numero Index du Film : CurPos := Pos('