[ITA] Is Anyone Able to create a script for www.film.tv.it?
[ITA] Is Anyone Able to create a script for www.film.tv.it?
I'm going crazy, but i'm not able to understand how these scripts work.
So i'm not able to create a script for www.film.tv.it, maybe the most exaustive movie site in italian.
So is anyone able to help me plz?
Thank You.
ABN
So i'm not able to create a script for www.film.tv.it, maybe the most exaustive movie site in italian.
So is anyone able to help me plz?
Thank You.
ABN
time passed and no one helped me.
www.film.tv.it is simply one of the most complete databases (with pics too) written in italian.
italians can find almost everything.
plz do this work
i'm unable to understand how these scripts work
ABN
www.film.tv.it is simply one of the most complete databases (with pics too) written in italian.
italians can find almost everything.
plz do this work
i'm unable to understand how these scripts work
ABN
Simple script
Below are simple script i made for www.film.tv.it
Use this script as base for your development.
Regards
Pivello
Use this script as base for your development.
Regards
Pivello
Code: Select all
// GETINFO SCRIPTING
// Film.TV.it - by Pivello
(**************************************************
* Movie importation script for: *
* Film.TV.it, http://www.Film.TV.it *
* *
* (P)2005 Pivello *
* *
* 30.01.2005 First beta test release *
* 31.01.2005 First pubblic release *
* 02.02.2005 Add Dinolib routine for big picture *
* *
* For use with Ant Movie Catalog 3.4.1 -> *
* www.antp.be/software/moviecatalog *
* *
* The source code of the script can be used in *
* another program only if full credits to *
* script author and a link to Ant Movie Catalog *
* website are given in the About box or in *
* the documentation of the program *
***************************************************)
program FilmTVIt;
const
LargePicture = True; // CHANGE TO FALSE IF WANTED SMALL PICTURE
UrlBase = 'http://www.film.tv.it';
QueryBase = UrlBase + '/cerca.php?ricerca=avanzata&titolo=';
QueryFilm = UrlBase + '/scheda.php?film=';
ImagePath = UrlBase + '/imgbank/';
cStartId = 'Verde"><a href="scheda.php?film='; // ID start marker
cEndId = '" class="fTitolettoFilm"'; // ID end marker
cStartTitle = '/> '; // Title start marker
cEndTitle = '</a></span>'; // Title end marker
cStartTranslTitle = 'fTitoloFilmBianco">'; // Translated title start marker
cEndTranslTitle = '</span>'; // Translated title end marker
cStartImg = 'img src="imgbank/'; // Image start marker
cEndImg = '" width="'; // Image end marker
cStartGeneric = 'Lite" bgcolor="#5B6E80" valign="top">';
cEndGeneric = ' '; // Generic field marker
cStartDirector = 'fLinkBianco>'; // Director start marker
cEndDirector = '</a>'; // Director end marker
cStartCast = 'fLinkBianco>'; // Actor start marker
cEndCast = '</a>'; // Actor end marker
cEndGeneric2 = '</td>'; // Generic end marker 2
cBeginDesc = '"La Trama" /></p>'; // Description begin marker
cStartDesc = '<p class="testo">'; // Description start marker
cEndDesc = '</p>'; // Description end marker
cStartComm = '<p class="testo"><i>'; // Comment start marker
cEndComm = '</i></p>'; // Comment end marker
var
Page: TStringList;
MovieUrl, MovieName, OriginalStr, TranslatedStr, PageStr: string;
// ---------------------------------------------
// PAGE PACKING (remove extra spaces, tabs & CR)
// IN: page Url (string)
// OUT: compact page (string)
// ---------------------------------------------
function RemoveExtraChars(Url: string): string;
var
Temp: string;
PackedPage: string;
CharPos: Integer;
n: Integer;
begin
Page.Text := GetPage(Url);
for n:=0 to Page.Count-1 do
PackedPage := PackedPage + ' ' + Page.GetString(n);
repeat
CharPos := pos(' ', PackedPage);
if CharPos = 0 then
CharPos := pos(#9, PackedPage);
if CharPos <> 0 then
begin
Temp := copy(PackedPage, 1, CharPos -1);
Delete(PackedPage, 1, CharPos);
PackedPage := Temp + PackedPage;
end;
until((pos(' ', PackedPage) = 0) and (pos(#9, PackedPage) = 0));
result := PackedPage;
end;
// ---------------------------------
// GET FIELD VALUES FROM PACKED PAGE
// IN: Start marker (String)
// End marker (string)
// Cut Start Marker (bool)
// Cut End Marker (bool)
// OUT: value (string)
// ---------------------------------
function GetValue(StartMarker, EndMarker: string; CutStartMarker, CutEndMarker: boolean): string;
var
StartPos: integer;
EndPos: integer;
Value: string;
begin
Value := '';
StartPos := pos(StartMarker, PageStr);
if (StartPos > 0) then
Delete(PageStr, 1, StartPos-1);
StartPos := pos(StartMarker, PageStr);
EndPos := pos(EndMarker, PageStr);
if ((StartPos > 0)and(EndPos > 0)) then
begin
if CutStartMarker then
StartPos := StartPos + length(StartMarker);
if not CutEndMarker then
EndPos := EndPos + length(EndMarker);
Value := copy(PageStr, StartPos, EndPos-Startpos);
Delete(PageStr, 1, EndPos);
end;
result := Value;
end;
// ------------------------
// ReadPicture - by Dinolib
// IN:
// OUT:
// -----------------------
procedure ReadPicture;
var
ImageLink: string;
Begin
ImageLink := ImagePath + getValue(cStartImg, cEndImg, true, true);
if Pos('DUMMY/locandina.gif',ImageLink)>0 then
exit;
if LargePicture then
ImageLink := StringReplace(ImageLink,'/LOC/','/GALLERY/');
GetPicture(ImageLink, false);
end;
// -----------------------
// ANALYZE MOVIE DATA PAGE
// IN: none
// OUT: set Ant fields
// -----------------------
procedure AnalyzeMoviePage;
var
Cast, TempStr: string;
begin
// Get packed title main page
PageStr := RemoveExtraChars(MovieUrl);
// Translated Title field
SetField(fieldTranslatedTitle, getValue(cStartTranslTitle, cEndTranslTitle, true, true));
// Get film image
ReadPicture;
// Original Title field
SetField(fieldOriginalTitle, getValue(cStartGeneric, cEndGeneric, true, true));
if(GetField(fieldOriginalTitle)='')then
SetField(fieldOriginalTitle, GetField(fieldTranslatedTitle));
// Country field
SetField(fieldCountry, getValue(cStartGeneric, cEndGeneric, true, true));
// YearField
SetField(fieldYear, getValue(cStartGeneric, cEndGeneric, true, true));
// Director Field
SetField(fieldDirector, getValue(cStartDirector, cEndDirector, true, true));
// Actors Field
Cast := '';
repeat
TempStr := getValue(cStartCast, cEndCast, true, true);
if ((Cast<>'') and (TempStr<>'')) then
Cast := Cast + ', ';
Cast := Cast + TempStr;
until((TempStr='')or(Length(TempStr)>40));
SetField(fieldActors, Cast);
// Category Field
SetField(fieldCategory, getValue(cStartGeneric, cEndGeneric2, true, true));
// Duration field
TempStr := getValue(cStartGeneric, cEndGeneric2, true, true);
SetField(fieldLength, Copy(TempStr,1,Length(TempStr)-1));
// Producer Field
//SetField(fieldProducer, getValue( , , true, true));
// Description Field
Delete(PageStr, 1, Pos(cBeginDesc, PageStr) + Length(cBeginDesc));
SetField(fieldDescription, getValue(cStartDesc, cEndDesc, true, true));
// Comments Field
SetField(fieldComments, getValue(cStartComm, cEndComm, true, true));
// Movie URL field
SetField(fieldURL, MovieUrl);
// Display search result
DisplayResults;
end;
// ------------------------------------------------------------------
// FILL PICKTREE CONTROL WITH LINKS & TITLES or RETURN ONE PAGE LINK
// if OneFilm flag true return Film Id else populate PickTree
// IN: OneFilm flag (bool)
// OUT: one page ID (string)
// ------------------------------------------------------------------
function PopulatePickTree(OneFilm: boolean): string;
var
TempIdFilm: string;
TempTitle: string;
StartPos: integer;
EndPos: integer;
begin
if OneFilm then
begin
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
result := QueryFilm + TempIdFilm;
end
else
begin
PickTreeClear;
repeat
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
if StartPos > 0 then
begin
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
Delete(PageStr, 1, EndPos);
StartPos := pos(cStartTitle, PageStr);
EndPos := pos(cEndTitle, PageStr);
StartPos := StartPos + Length(cStartTitle);
TempTitle := copy(PageStr, StartPos, EndPos-Startpos); // Get Title
PickTreeAdd(TempTitle, QueryFilm + TempIdFilm);
end;
until(StartPos = 0);
result := '';
end
end;
// ---------------------------------
// ANALYZE FIRST SEARCH RESULT PAGE:
// IN: page Url (string)
// OUT: none
// ---------------------------------
procedure AnalyzeSearchPage(Url: string);
var
FilmId: string;
begin
PageStr := RemoveExtraChars(Url);
if pos('Non ho trovato nessun film', PageStr) > 0 then
ShowMessage('Title not found / Nessun film trovato.')
else if pos('Si è verificato un errore',PageStr) > 0 then
ShowMessage('Server not available, try later / Server non disponibile, prova più tardi')
else
begin
if pos('Ho trovato 1 film', PageStr) <> 0 then
MovieUrl := PopulatePickTree(true) // One title found
else
begin
PopulatePickTree(false); // More titles found..
if not PickTreeExec(MovieUrl) then // ..select one
exit;
end
AnalyzeMoviePage;
end;
end;
// ----------
// MAIN:
// IN: none
// OUT: none
// ----------
begin
if CheckVersion(3,4,1) then
begin
TranslatedStr := GetField(fieldTranslatedTitle);
OriginalStr := GetField(fieldOriginalTitle);
if (TranslatedStr <> '') then MovieName := TranslatedStr else MovieName := OriginalStr;
if (Input('Film.TV.It - By Pivello', 'Enter the title of the movie / Inserire titolo del film:', MovieName)) then
begin
Page := TStringList.Create;
MovieUrl := QueryBase + UrlEncode(MovieName);
AnalyzeSearchPage(MovieUrl);
Page.Free;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.1)');
end.
Last edited by P2 on 2005-02-02 21:06:22, edited 1 time in total.
un solo dettaglio da aggiungere/correggere (ad essere perfezionisti):
nel link PHOTOGALLERY in genere c'è l'immagine segnata come LOCANDINA che è il poster grande.E' possibile aggiungere questa ricerca aggiuntiva/sostitutiva x il poster?
ANCORA GRAZIE!
Translation:
One only detail for the perfection: Inside PHOTOGALLERY linkable page normally appears, under the title "LOCANDINA", the big poster.
Is it possible to add/correct this detail, plz?
THANK YOU A LOTTTTT!
ABN
nel link PHOTOGALLERY in genere c'è l'immagine segnata come LOCANDINA che è il poster grande.E' possibile aggiungere questa ricerca aggiuntiva/sostitutiva x il poster?
ANCORA GRAZIE!
Translation:
One only detail for the perfection: Inside PHOTOGALLERY linkable page normally appears, under the title "LOCANDINA", the big poster.
Is it possible to add/correct this detail, plz?
THANK YOU A LOTTTTT!
ABN
[REL]Try this...
Hi,
this is my first attempt writing a script for Ant Movie Catalog. *test in progress!!*
I've wrote It for Version 3.5.0 RC1. But I think Pivello could translate it for 3.4.x version (just change version control,erase the GetOption call and re-insert DisplayResult call)...
I'm sorry, comments are in italian.
Few words about algorithm: look for the token 'LOCANDINA' in first page of gallery and count position in table. Then search for the image link in the same position of the word LOCANDINA...
Bug known: if the picture isn't in the first page of the gallery, it's not retrieved. :-(
Bye
[Edit]ok, I've update [Infos] section and added to script source.[/Edit]
[Edit2]semplified on ABNormal directions... [/Edit2]
this is my first attempt writing a script for Ant Movie Catalog. *test in progress!!*
I've wrote It for Version 3.5.0 RC1. But I think Pivello could translate it for 3.4.x version (just change version control,erase the GetOption call and re-insert DisplayResult call)...
I'm sorry, comments are in italian.
Few words about algorithm: look for the token 'LOCANDINA' in first page of gallery and count position in table. Then search for the image link in the same position of the word LOCANDINA...
Bug known: if the picture isn't in the first page of the gallery, it's not retrieved. :-(
Bye
[Edit]ok, I've update [Infos] section and added to script source.[/Edit]
[Edit2]semplified on ABNormal directions... [/Edit2]
Code: Select all
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Pivello
Title=FilmTV
Description=Get movie info from Film TV
Site=www.Film.TV.it
Language=IT
Version=02.02.2005
Requires=3.5.0
Comments=Modified by: 02.02.2005 dinolib;
License=The source code of the script can be used in another program only if full credits to script author and a link to Ant Movie Catalog website are given in the About box or in the documentation of the program
GetInfo=1
[Options]
LargePicture=1|1|0=Get a small picture|1=Try to get the big picture
***************************************************)
program FilmTVIt;
const
UrlBase = 'http://www.film.tv.it';
QueryBase = UrlBase + '/cerca.php?ricerca=avanzata&titolo=';
QueryFilm = UrlBase + '/scheda.php?film=';
ImagePath = UrlBase + '/imgbank/';
cStartId = 'Verde"><a href="scheda.php?film='; // ID start marker
cEndId = '" class="fTitolettoFilm"'; // ID end marker
cStartTitle = '/> '; // Title start marker
cEndTitle = '</a></span>'; // Title end marker
cStartTranslTitle = 'fTitoloFilmBianco">'; // Translated title start marker
cEndTranslTitle = '</span>'; // Translated title end marker
cStartImg = 'img src="imgbank/'; // Image start marker
cEndImg = '" width="'; // Image end marker
cStartGeneric = 'Lite" bgcolor="#5B6E80" valign="top">';
cEndGeneric = ' '; // Generic field marker
cStartDirector = 'fLinkBianco>'; // Director start marker
cEndDirector = '</a>'; // Director end marker
cStartCast = 'fLinkBianco>'; // Actor start marker
cEndCast = '</a>'; // Actor end marker
cEndGeneric2 = '</td>'; // Generic end marker 2
cBeginDesc = '"La Trama" /></p>'; // Description begin marker
cStartDesc = '<p class="testo">'; // Description start marker
cEndDesc = '</p>'; // Description end marker
cStartComm = '<p class="testo"><i>'; // Comment start marker
cEndComm = '</i></p>'; // Comment end marker
var
Page: TStringList;
MovieUrl, MovieName, OriginalStr, TranslatedStr, PageStr: string;
// ---------------------------------------------
// PAGE PACKING (remove extra spaces, tabs & CR)
// IN: page Url (string)
// OUT: compact page (string)
// ---------------------------------------------
function RemoveExtraChars(Url: string): string;
var
Temp: string;
PackedPage: string;
CharPos: Integer;
n: Integer;
begin
Page.Text := GetPage(Url);
for n:=0 to Page.Count-1 do
PackedPage := PackedPage + ' ' + Page.GetString(n);
repeat
CharPos := pos(' ', PackedPage);
if CharPos = 0 then
CharPos := pos(#9, PackedPage);
if CharPos <> 0 then
begin
Temp := copy(PackedPage, 1, CharPos -1);
Delete(PackedPage, 1, CharPos);
PackedPage := Temp + PackedPage;
end;
until((pos(' ', PackedPage) = 0) and (pos(#9, PackedPage) = 0));
result := PackedPage;
end;
// ---------------------------------
// GET FIELD VALUES FROM PACKED PAGE
// IN: Start marker (String)
// End marker (string)
// Cut Start Marker (bool)
// Cut End Marker (bool)
// OUT: value (string)
// ---------------------------------
function GetValue(StartMarker, EndMarker: string; CutStartMarker, CutEndMarker: boolean): string;
var
StartPos: integer;
EndPos: integer;
Value: string;
begin
Value := '';
StartPos := pos(StartMarker, PageStr);
if (StartPos > 0) then
Delete(PageStr, 1, StartPos-1);
StartPos := pos(StartMarker, PageStr);
EndPos := pos(EndMarker, PageStr);
if ((StartPos > 0)and(EndPos > 0)) then
begin
if CutStartMarker then
StartPos := StartPos + length(StartMarker);
if not CutEndMarker then
EndPos := EndPos + length(EndMarker);
Value := copy(PageStr, StartPos, EndPos-Startpos);
Delete(PageStr, 1, EndPos);
end;
result := Value;
end;
procedure ReadPicture;
var
ImageLink: string;
Begin
ImageLink := ImagePath + getValue(cStartImg, cEndImg, true, true);
if Pos('DUMMY/locandina.gif',ImageLink)>0 then
exit;
if GetOption('LargePicture')=1 then
ImageLink := StringReplace(ImageLink,'/LOC/','/GALLERY/');
GetPicture(ImageLink);
end;
// -----------------------
// ANALYZE MOVIE DATA PAGE
// IN: none
// OUT: set Ant fields
// -----------------------
procedure AnalyzeMoviePage;
var
i, h, m: integer;
Duration, Description, Cast, TempStr, TempImg, hh, mm: string;
begin
// Get packed title main page
PageStr := RemoveExtraChars(MovieUrl);
// Translated Title field
SetField(fieldTranslatedTitle, getValue(cStartTranslTitle, cEndTranslTitle, true, true));
// Get film image
//GetPicture(ImagePath + getValue(cStartImg, cEndImg, true, true));
ReadPicture;
// Original Title field
SetField(fieldOriginalTitle, getValue(cStartGeneric, cEndGeneric, true, true));
if(GetField(fieldOriginalTitle)='')then
SetField(fieldOriginalTitle, GetField(fieldTranslatedTitle));
// Country field
SetField(fieldCountry, getValue(cStartGeneric, cEndGeneric, true, true));
// YearField
SetField(fieldYear, getValue(cStartGeneric, cEndGeneric, true, true));
// Director Field
SetField(fieldDirector, getValue(cStartDirector, cEndDirector, true, true));
// Actors Field
Cast := '';
repeat
TempStr := getValue(cStartCast, cEndCast, true, true);
if ((Cast<>'') and (TempStr<>'')) then
Cast := Cast + ', ';
Cast := Cast + TempStr;
until((TempStr='')or(Length(TempStr)>40));
SetField(fieldActors, Cast);
// Category Field
SetField(fieldCategory, getValue(cStartGeneric, cEndGeneric2, true, true));
// Duration field
TempStr := getValue(cStartGeneric, cEndGeneric2, true, true);
SetField(fieldLength, Copy(TempStr,1,Length(TempStr)-1));
// Producer Field
//SetField(fieldProducer, getValue( , , true, true));
// Description Field
Delete(PageStr, 1, Pos(cBeginDesc, PageStr) + Length(cBeginDesc));
SetField(fieldDescription, getValue(cStartDesc, cEndDesc, true, true));
// Comments Field
SetField(fieldComments, getValue(cStartComm, cEndComm, true, true));
// Movie URL field
SetField(fieldURL, MovieUrl);
end;
// ------------------------------------------------------------------
// FILL PICKTREE CONTROL WITH LINKS & TITLES or RETURN ONE PAGE LINK
// if OneFilm flag true return Film Id else populate PickTree
// IN: OneFilm flag (bool)
// OUT: one page ID (string)
// ------------------------------------------------------------------
function PopulatePickTree(OneFilm: boolean): string;
var
TempIdFilm: string;
TempTitle: string;
StartPos: integer;
EndPos: integer;
begin
if OneFilm then
begin
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
result := QueryFilm + TempIdFilm;
end
else
begin
PickTreeClear;
repeat
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
if StartPos > 0 then
begin
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
Delete(PageStr, 1, EndPos);
StartPos := pos(cStartTitle, PageStr);
EndPos := pos(cEndTitle, PageStr);
StartPos := StartPos + Length(cStartTitle);
TempTitle := copy(PageStr, StartPos, EndPos-Startpos); // Get Title
PickTreeAdd(TempTitle, QueryFilm + TempIdFilm);
end;
until(StartPos = 0);
result := '';
end
end;
// ---------------------------------
// ANALYZE FIRST SEARCH RESULT PAGE:
// IN: page Url (string)
// OUT: none
// ---------------------------------
procedure AnalyzeSearchPage(Url: string);
var
FilmId: string;
begin
PageStr := RemoveExtraChars(Url);
if pos('Non ho trovato nessun film', PageStr) > 0 then
ShowMessage('Title not found / Nessun film trovato.')
else if pos('Si è verificato un errore',PageStr) > 0 then
ShowMessage('Server not available, try later / Server non disponibile, prova più tardi')
else
begin
if pos('Ho trovato 1 film', PageStr) <> 0 then
MovieUrl := PopulatePickTree(true) // One title found
else
begin
PopulatePickTree(false); // More titles found..
if not PickTreeExec(MovieUrl) then // ..select one
exit;
end
AnalyzeMoviePage;
end;
end;
// ----------
// MAIN:
// IN: none
// OUT: none
// ----------
begin
if CheckVersion(3,5,0) then
begin
TranslatedStr := GetField(fieldTranslatedTitle);
OriginalStr := GetField(fieldOriginalTitle);
if (TranslatedStr <> '') then MovieName := TranslatedStr else MovieName := OriginalStr;
if (Input('Film.TV.It - By Pivello', 'Enter the title of the movie / Inserire titolo del film:', MovieName)) then
begin
Page := TStringList.Create;
MovieUrl := QueryBase + UrlEncode(MovieName);
AnalyzeSearchPage(MovieUrl);
Page.Free;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
Last edited by dinolib on 2005-02-02 17:31:55, edited 3 times in total.
well
just a little step more folks....
for the large poster you should change picture link:
if in main page the little cover (the one you put in your script) in called:
http://www.film.tv.it/imgbank/LOC/MA/02939703.jpg
(master & commander little cover)
the large picture is simply:
http://www.film.tv.it/imgbank/GALLERY/MA/02939703.jpg
(master & commander LARGE poster)
so you should only find the way to modify LOC with GALLERY subfolder.
Perfection should be:
1) find LARGE POSTER (imagepath + /GALLERY/ + rest of link)
2) if found exit
3) else
4) find LITTLE POSTER in main page (imagepath + /LOC/ + rest of link)
5) if little poster is http://www.film.tv.it/imgbank/DUMMY/locandina.gif ( NOT PRESENT POSTER picture) do not add picture.
too difficult? i think not
thx a lot guys
ABN
just a little step more folks....
for the large poster you should change picture link:
if in main page the little cover (the one you put in your script) in called:
http://www.film.tv.it/imgbank/LOC/MA/02939703.jpg
(master & commander little cover)
the large picture is simply:
http://www.film.tv.it/imgbank/GALLERY/MA/02939703.jpg
(master & commander LARGE poster)
so you should only find the way to modify LOC with GALLERY subfolder.
Perfection should be:
1) find LARGE POSTER (imagepath + /GALLERY/ + rest of link)
2) if found exit
3) else
4) find LITTLE POSTER in main page (imagepath + /LOC/ + rest of link)
5) if little poster is http://www.film.tv.it/imgbank/DUMMY/locandina.gif ( NOT PRESENT POSTER picture) do not add picture.
too difficult? i think not
thx a lot guys
ABN
no dino... pic is still the little one on main page.dinolib wrote:@ABNormal:
I've edited the script and used the URL you signaled.
I'm sorry, I don't know how to check for large image existance...
Let me know if it works well! I can try to change something if you need it.
bye
i've read the html text and large picture isn't called LOCANDINA, but put into a <TR> <TD> always under the word "Locandina"... so i think it will be difficult.
watching the Extreme Movie Manager i've discovered the easiest way to reach LargePoster (film.tv uses 2 parallel folders: LOC with the little pic u see in main page, and GALLERY, where there is the Large Poster with the same name of that one before)
so instead of analyzing each pic into PhotoGallery page, it will be easier the use the second solution i wrote before.
Ciao
ABN
I've edited the script for the second time. Now it shold works. I've done a lot of tests.
--
(Nella prima versione cercavo una immagine nella gallery. Ora, secondo quanto mi hai indicato, prendo il nome immagine dalla scheda, e poi vado nella cartella GALLERY.
Purtroppo c'è il logo FILM TV impresso sull'imagine(ma questo è inevitabile)
--
I hope you'll found it usefull.
ciao
Dino
--
(Nella prima versione cercavo una immagine nella gallery. Ora, secondo quanto mi hai indicato, prendo il nome immagine dalla scheda, e poi vado nella cartella GALLERY.
Purtroppo c'è il logo FILM TV impresso sull'imagine(ma questo è inevitabile)
--
I hope you'll found it usefull.
ciao
Dino
Unfortunately it is not possible currently to check through script if a URL is valid or not, and except the GetPicture procedure there is nothing available to manage the pictures of the catalog.dinolib wrote: Antp, can you suggest how to verify the existance of an image? It could be very usefull...
dinolib wrote:I've edited the script for the second time. Now it shold works. I've done a lot of tests.
--
(Nella prima versione cercavo una immagine nella gallery. Ora, secondo quanto mi hai indicato, prendo il nome immagine dalla scheda, e poi vado nella cartella GALLERY.
Purtroppo c'è il logo FILM TV impresso sull'imagine(ma questo è inevitabile)
--
I hope you'll found it usefull.
ciao
Dino
E' PERFETTO!
GRAZIE MILLE
(è vero, film.tv aggiunge il logo e la scritta sulla base e non c'è nulla da fare. ma ha tutti i titoli desiderabili. per le novità resta sempre meglio prendere la locandina da filmup -grande e "immacolata"-)
--------------translation:
It's perfect! thx a lotttt
(it's true, film.tv add a logo on their posters, but this site is the only one where italians can find about everything with posters. for newest movies maybe filmup is better: their posters are bigger and without logos)
--------------------
i'll study your script
i have to learn how to create others
ANTOINE add this script into your next release. It's a masterwork
and plz, plz, plz create a tutorial on How-To-Create-Scripts....
a script with comments explaining what each operation does and works...
(Example: // now script look for text between '.com/' and '</size')... and so on.
ancora grazie dino
ABN
Other Italian Scripts
I'm going to convert all the other Italian scipts to v.3.5.0.
I'm also testing them to update where they don't work anymore (AFDigitale.it for example).
May be this night (GMT+1) I'll send to Antoine a zip file.
If you want to suggest me something, let me know!
Bye
Dinolib
I'm also testing them to update where they don't work anymore (AFDigitale.it for example).
May be this night (GMT+1) I'll send to Antoine a zip file.
If you want to suggest me something, let me know!
Bye
Dinolib
well i tried to add a function (Rating) to dino's script.
film.tv.it uses 4 ratings:
mediocre (not so good)
sufficiente (so so)
buono (good)
ottimo (excellent).
i've "translated" these ratings into 3, 5, 7, 9 into Rating field.
It seems it works
so here is the script:
bye
ABN
film.tv.it uses 4 ratings:
mediocre (not so good)
sufficiente (so so)
buono (good)
ottimo (excellent).
i've "translated" these ratings into 3, 5, 7, 9 into Rating field.
It seems it works
so here is the script:
Code: Select all
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Pivello
Title=FilmTV
Description=Get movie info from Film TV
Site=www.Film.TV.it
Language=IT
Version=02.02.2005
Requires=3.5.0
Comments=Modified by: 02.02.2005 dinolib; 03feb2004 ABN
License=The source code of the script can be used in another program only if full credits to script author and a link to Ant Movie Catalog website are given in the About box or in the documentation of the program
GetInfo=1
[Options]
LargePicture=1|1|0=Get a small picture|1=Try to get the big picture
***************************************************)
program FilmTVIt;
const
UrlBase = 'http://www.film.tv.it';
QueryBase = UrlBase + '/cerca.php?ricerca=avanzata&titolo=';
QueryFilm = UrlBase + '/scheda.php?film=';
ImagePath = UrlBase + '/imgbank/';
cStartId = 'Verde"><a href="scheda.php?film='; // ID start marker
cEndId = '" class="fTitolettoFilm"'; // ID end marker
cStartTitle = '/> '; // Title start marker
cEndTitle = '</a></span>'; // Title end marker
cStartTranslTitle = 'fTitoloFilmBianco">'; // Translated title start marker
cEndTranslTitle = '</span>'; // Translated title end marker
cStartImg = 'img src="imgbank/'; // Image start marker
cEndImg = '" width="'; // Image end marker
cStartGeneric = 'Lite" bgcolor="#5B6E80" valign="top">';
cEndGeneric = ' '; // Generic field marker
cStartDirector = 'fLinkBianco>'; // Director start marker
cEndDirector = '</a>'; // Director end marker
cStartCast = 'fLinkBianco>'; // Actor start marker
cEndCast = '</a>'; // Actor end marker
cStartVal = 'class="fTestoBiancoLite">';
cEndVal = '</td>';
cEndGeneric2 = '</td>'; // Generic end marker 2
cBeginDesc = '"La Trama" /></p>'; // Description begin marker
cStartDesc = '<p class="testo">'; // Description start marker
cEndDesc = '</p>'; // Description end marker
cStartComm = '<p class="testo"><i>'; // Comment start marker
cEndComm = '</i></p>'; // Comment end marker
var
Page: TStringList;
MovieUrl, MovieName, OriginalStr, TranslatedStr, PageStr: string;
// ---------------------------------------------
// PAGE PACKING (remove extra spaces, tabs & CR)
// IN: page Url (string)
// OUT: compact page (string)
// ---------------------------------------------
function RemoveExtraChars(Url: string): string;
var
Temp: string;
PackedPage: string;
CharPos: Integer;
n: Integer;
begin
Page.Text := GetPage(Url);
for n:=0 to Page.Count-1 do
PackedPage := PackedPage + ' ' + Page.GetString(n);
repeat
CharPos := pos(' ', PackedPage);
if CharPos = 0 then
CharPos := pos(#9, PackedPage);
if CharPos <> 0 then
begin
Temp := copy(PackedPage, 1, CharPos -1);
Delete(PackedPage, 1, CharPos);
PackedPage := Temp + PackedPage;
end;
until((pos(' ', PackedPage) = 0) and (pos(#9, PackedPage) = 0));
result := PackedPage;
end;
// ---------------------------------
// GET FIELD VALUES FROM PACKED PAGE
// IN: Start marker (String)
// End marker (string)
// Cut Start Marker (bool)
// Cut End Marker (bool)
// OUT: value (string)
// ---------------------------------
function GetValue(StartMarker, EndMarker: string; CutStartMarker, CutEndMarker: boolean): string;
var
StartPos: integer;
EndPos: integer;
Value: string;
begin
Value := '';
StartPos := pos(StartMarker, PageStr);
if (StartPos > 0) then
Delete(PageStr, 1, StartPos-1);
StartPos := pos(StartMarker, PageStr);
EndPos := pos(EndMarker, PageStr);
if ((StartPos > 0)and(EndPos > 0)) then
begin
if CutStartMarker then
StartPos := StartPos + length(StartMarker);
if not CutEndMarker then
EndPos := EndPos + length(EndMarker);
Value := copy(PageStr, StartPos, EndPos-Startpos);
Delete(PageStr, 1, EndPos);
end;
result := Value;
end;
procedure ReadPicture;
var
ImageLink: string;
Begin
ImageLink := ImagePath + getValue(cStartImg, cEndImg, true, true);
if Pos('DUMMY/locandina.gif',ImageLink)>0 then
exit;
if GetOption('LargePicture')=1 then
ImageLink := StringReplace(ImageLink,'/LOC/','/GALLERY/');
GetPicture(ImageLink);
end;
// -----------------------
// ANALYZE MOVIE DATA PAGE
// IN: none
// OUT: set Ant fields
// -----------------------
procedure AnalyzeMoviePage;
var
i, h, m: integer;
Valutaz, Val2, Duration, Description, Cast, TempStr, TempImg, hh, mm: string;
begin
// Get packed title main page
PageStr := RemoveExtraChars(MovieUrl);
// Translated Title field
SetField(fieldTranslatedTitle, getValue(cStartTranslTitle, cEndTranslTitle, true, true));
// Get film image
//GetPicture(ImagePath + getValue(cStartImg, cEndImg, true, true));
ReadPicture;
// Original Title field
SetField(fieldOriginalTitle, getValue(cStartGeneric, cEndGeneric, true, true));
if(GetField(fieldOriginalTitle)='')then
SetField(fieldOriginalTitle, GetField(fieldTranslatedTitle));
// Country field
SetField(fieldCountry, getValue(cStartGeneric, cEndGeneric, true, true));
// YearField
SetField(fieldYear, getValue(cStartGeneric, cEndGeneric, true, true));
// Director Field
SetField(fieldDirector, getValue(cStartDirector, cEndDirector, true, true));
SetField(fieldRating, Val2);
// Actors Field
Cast := '';
repeat
TempStr := getValue(cStartCast, cEndCast, true, true);
if ((Cast<>'') and (TempStr<>'')) then
Cast := Cast + ', ';
Cast := Cast + TempStr;
until((TempStr='')or(Length(TempStr)>40));
SetField(fieldActors, Cast);
// Category Field
SetField(fieldCategory, getValue(cStartGeneric, cEndGeneric2, true, true));
// Duration field
TempStr := getValue(cStartGeneric, cEndGeneric2, true, true);
SetField(fieldLength, Copy(TempStr,1,Length(TempStr)-1));
//Rating - Added by ABNormal
Valutaz := (getValue(cStartVal, cEndVal, true, true));
if (Valutaz='mediocre') then
Val2 := '3';
if (Valutaz='sufficiente') then
Val2 := '5';
if (Valutaz='buono') then
Val2 := '7';
if (Valutaz='ottimo') then
Val2 := '9';
if (Valutaz='') then
Valutaz := '0';
// Producer Field
//SetField(fieldProducer, getValue( , , true, true));
// Description Field
Delete(PageStr, 1, Pos(cBeginDesc, PageStr) + Length(cBeginDesc));
SetField(fieldDescription, getValue(cStartDesc, cEndDesc, true, true));
// Comments Field
SetField(fieldComments, getValue(cStartComm, cEndComm, true, true));
// Movie URL field
SetField(fieldURL, MovieUrl);
end;
// ------------------------------------------------------------------
// FILL PICKTREE CONTROL WITH LINKS & TITLES or RETURN ONE PAGE LINK
// if OneFilm flag true return Film Id else populate PickTree
// IN: OneFilm flag (bool)
// OUT: one page ID (string)
// ------------------------------------------------------------------
function PopulatePickTree(OneFilm: boolean): string;
var
TempIdFilm: string;
TempTitle: string;
StartPos: integer;
EndPos: integer;
begin
if OneFilm then
begin
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
result := QueryFilm + TempIdFilm;
end
else
begin
PickTreeClear;
repeat
StartPos := pos(cStartId, PageStr);
EndPos := pos(cEndId, PageStr);
if StartPos > 0 then
begin
StartPos := StartPos + Length(cStartId);
TempIdFilm := copy(PageStr, StartPos, EndPos-Startpos); // Get ID
Delete(PageStr, 1, EndPos);
StartPos := pos(cStartTitle, PageStr);
EndPos := pos(cEndTitle, PageStr);
StartPos := StartPos + Length(cStartTitle);
TempTitle := copy(PageStr, StartPos, EndPos-Startpos); // Get Title
PickTreeAdd(TempTitle, QueryFilm + TempIdFilm);
end;
until(StartPos = 0);
result := '';
end
end;
// ---------------------------------
// ANALYZE FIRST SEARCH RESULT PAGE:
// IN: page Url (string)
// OUT: none
// ---------------------------------
procedure AnalyzeSearchPage(Url: string);
var
FilmId: string;
begin
PageStr := RemoveExtraChars(Url);
if pos('Non ho trovato nessun film', PageStr) > 0 then
ShowMessage('Title not found / Nessun film trovato.')
else if pos('Si è verificato un errore',PageStr) > 0 then
ShowMessage('Server not available, try later / Server non disponibile, prova più tardi')
else
begin
if pos('Ho trovato 1 film', PageStr) <> 0 then
MovieUrl := PopulatePickTree(true) // One title found
else
begin
PopulatePickTree(false); // More titles found..
if not PickTreeExec(MovieUrl) then // ..select one
exit;
end
AnalyzeMoviePage;
end;
end;
// ----------
// MAIN:
// IN: none
// OUT: none
// ----------
begin
if CheckVersion(3,5,0) then
begin
TranslatedStr := GetField(fieldTranslatedTitle);
OriginalStr := GetField(fieldOriginalTitle);
if (TranslatedStr <> '') then MovieName := TranslatedStr else MovieName := OriginalStr;
if (Input('Film.TV.It - By Pivello', 'Enter the title of the movie / Inserire titolo del film:', MovieName)) then
begin
Page := TStringList.Create;
MovieUrl := QueryBase + UrlEncode(MovieName);
AnalyzeSearchPage(MovieUrl);
Page.Free;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.
ABN
Last edited by ABNormal on 2005-02-03 20:32:40, edited 1 time in total.
ABN, be carefull!
Your script has a little mistake...
PageStr is managed progressively. Every time you call GetVal, pageStr is cut! So, if you place the Rating step before Actors and Category, you lost them!
Here the change you have to apply: move your code after the fieldLength step.
In this way you get all the infos! (infact length was already computed, but you break it )
ciao!
Dino
Your script has a little mistake...
PageStr is managed progressively. Every time you call GetVal, pageStr is cut! So, if you place the Rating step before Actors and Category, you lost them!
Here the change you have to apply: move your code after the fieldLength step.
In this way you get all the infos! (infact length was already computed, but you break it )
ciao!
Dino
Well, as i wrote elsewhere, i don't know anything about pascal and about these scripts, so i didn't know that they delete html after each GetVal.dinolib wrote:ABN, be carefull!
Your script has a little mistake...
PageStr is managed progressively. Every time you call GetVal, pageStr is cut! So, if you place the Rating step before Actors and Category, you lost them!
Here the change you have to apply: move your code after the fieldLength step.
In this way you get all the infos! (infact length was already computed, but you break it )
ciao!
Dino
So i hope that now, after this correction, there aren't other mistakes.
I'm sorry i "destroyed" your previous script, so i'm happy if my added part now will work without creating probs to your great script.
ciao
ABN