(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=Claudio Rinaldi ( rinaldiclaudio@gmail.com ) Title=IBS Description=Get movie info from ibs.it Site=www.ibs.it Language=IT Version=1.2 Requires=3.5.1 Comments= License= GetInfo=1 [Options] ***************************************************) program InternetBookShop; uses LibSeraph; // Seraphico's functions library const UrlBase = 'http://www.ibs.it'; QueryBase = UrlBase + '/dvd/ser/serpge.asp?ty=kw&x='; QueryFilm = UrlBase + '/dvd/'; ImagePath = UrlBase + '/locandine/'; cStartNumRis = 'Titoli 1-'; // Result Number start Marker cEndNumRis = ' di '; // Result Number end Marker cStartId = ' '' then GetPicture(cField); // TRANSLATED TITLE cValue := GetValue(cStartTitle, cEndTitle, true, true); SetField(fieldTranslatedTitle, AnsiUpFirstLetter(AnsiLowerCase(cValue))); // ORIGINAL TITLE cValue := GetValue(cStartTranslTitle, cEndTranslTitle,true,true); SetField(fieldOriginalTitle, AnsiUpFirstLetter(AnsiLowerCase(cValue))); cValue := GetValue(cStartCountry, cEndCountry, true, true); iPos := pos(',',cValue); if ( iPos > 0 ) then begin cField := Copy(cValue,1,iPos-1); SetField(fieldCountry,cField); cField := Copy(cValue,iPos+2,Length(cValue)); SetField(fieldYear, cField); end; SetField(fieldActors, GetValue(cStartCast, cEndCast, true, true)); SetField(fieldCategory, GetValue(cStartCategory, cEndCategory, true, true)); SetField(fieldProducer, GetValue(cStartProducer, cEndProducer, true, true)); SetField(fieldLength, GetValue(cStartDuration, cEndDuration, true, false)); SetField(fieldDescription, GetValue(cStartDesc, cEndDesc, true, false)); SetField(fieldURL, MovieUrl); end; // ------------------------------------------------------------------ // FILL PICKTREE CONTROL WITH LINKS & TITLES // IN: // OUT: // ------------------------------------------------------------------ procedure PickTreeFill; var cFilmId,cFilmTitle: string; StartPos,EndPos: integer; begin PickTreeClear; repeat StartPos := pos(cStartId, Page); if StartPos > 0 then begin cFilmId := GetValue(cStartId,cEndId,true,false); // Get ID cFilmTitle := GetValue(cStartTitleList,cEndTitleList,true,false); // Get Title PickTreeAdd(cFilmTitle, QueryFilm + cFilmId); end; until(StartPos = 0); end; // --------------------------------- // ANALYZE FIRST SEARCH RESULT PAGE: // IN: page Url (string) // OUT: none // --------------------------------- procedure AnalyzeSearchPage; var NumRisultati : string; begin GetCleanPage(MovieUrl); NumRisultati := GetValue(cStartNumRis, cEndNumRis, true, false); if (NumRisultati = '0') or (pos('Nessun titolo trovato', Page) > 0) then begin MovieURL := ''; ShowMessage('Title not found / Nessun film trovato.'); exit; end if (NumRisultati = '1') or (pos('Un solo titolo trovato', Page) > 0) then MovieUrl := QueryFilm + GetValue(cStartId,cEndId,false,false) else begin PickTreeFill; if not PickTreeExec(MovieUrl) then // ..select one exit; end end; // ---------- // MAIN: // IN: none // OUT: none // ---------- begin if not CheckVersion(3,5,0) then begin ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)'); exit; end; TranslatedStr := GetField(fieldTranslatedTitle); MovieName := GetField(fieldOriginalTitle); if (TranslatedStr <> '') then MovieName := TranslatedStr; if(Input('IBS.it', 'Enter the title of the movie', MovieName)) then begin MovieUrl := QueryBase + URLEncode(MovieName); AnalyzeSearchPage; if MovieURL <> '' then AnalyzeMoviePage; end; end.