(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Fulvio53s03
Title=comingsoon
Description=import film e serie TV
Site=http://www.comingsoon.it
Language=IT
Version=1.3.3
Requires=4.2.1
Comments=puo' essere usato per ricerca informazioni tramite google (mode=0) oppure per estrarle direttamente da comingsoon.it (mode=1) inserendo l'URL direttamente.
License=* The source code of the script can be used in |* another program only if full credits to Fulvio53s03*
GetInfo=1
RequiresMovies=1
[Options]
Mode=0|0|0=normal mode|1=batch mode (url)
[Parameters]
***************************************************)
// TypeSearch=1|1|1=search for exact expression|2=search for any word
// TypeOrder=3|3|1=order by Artist|2=order by film_o_serie Title|3=order by relevance
// needs the following units
// StringUtils7552.pas
//
program comingsoon;
uses
StringUtils7552;
const
comingsoonUrl = 'https://www.comingsoon.it'; // base url
UrlBase = 'https://www.comingsoon.it'; // base url
batchlogfic = 'c:\comingsoon_batch.txt'; // log for batch mode
debug_search = false; // debuga mode on/off su ricerca dischi
debug_film_o_serie = false; // debug mode on/off su estrazione dati film_o_serie
folder = 'f:\prova\'; // directory where to save files
CRLFspace = CRLF + ' ';
//2016-02-10 tappo_fine_ricerca = '<li class="g">Tappodifinericercadaticongoogle</li><li class="g">';
tappo_fine_ricerca = '<div class="g">Tappodifinericercadaticongoogle</div><div class="g">'; //2016-02-10
var
nuovo_anno, mese_anno, solo_anno, data_rilascio, label, stagione: String;
Credit_address, Readdress, Page: String;
film_o_serieName, ArtistName, firstcall, name, autori: String;
Formato, Releases, artista: String;
file_name, campo_URL: String;
tipo_ricerca, pag_ricerca, save_value, ordine_lista, Salva_autore: String;
value, episodi, lista_episodi: string;
CharNormal, CharAbNormal: string;
film_o_serie_ok: boolean;
BatchMode, giri, PosBar: Integer;
titolo_e_autore, titolo, autore, durata, cover: String;
save_comments, commento_episodi, commento_skeda: String;
save_description, save_desc_skeda, save_desc_episodi: String;
batchlog, confbatch: TstringList;
save_pag, artist, initchar, endchar: string;
film_o_serieok: boolean;
//------------------------------------------------------------------------------
// list of film_o_series
//------------------------------------------------------------------------------
procedure GetList;
var
Address, urlmusic, album, albumtest, genre: String;
Save_address, Title_album, indir_album, indir_title_album: String;
dati_album, init_control, end_control, init_ol, end_ol: String;
Desc_ricerca: String;
ctr_loop: integer;
found: boolean;
i, lgth_dati_album: integer;
begin
PickTreeClear; // clear list
desc_ricerca := file_name;
if desc_ricerca = '' then
desc_ricerca := film_o_serieName;
// Address := 'https://www.google.it/search?as_q=' + film_o_serieName;
Address := 'https://www.google.it/search?as_q="' + film_o_serieName + '"'; //fs2017-11-01
Address := Address + '&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all';
Address := Address + '&as_sitesearch=www.comingsoon.it&as_occt=any&safe=images&as_filetype=&as_rights=';
Address := UrlEncode(Address);
Page := GetPage(Address);
Page := UTF8decode(Page); //2019.01.28 FS accenti
Save_address := Address;
SetField(fieldURL, Address);
HTMLdecode(Page);
if debug_search then
DumpPage(folder+'googleListPage.html', Page); // debug
found := True;
Desc_ricerca := 'Lista pagine trovate per "' + Desc_ricerca + '"';
PickTreeAdd(Desc_ricerca, '"');
if debug_search then
DumpPage(folder+'discogsList.txt', Page); // debug
if Pos('find anything', Page) <> 0 then
begin
LogMessage('Error while reading selection page - no results found for ' + Desc_ricerca);
Found := False;
exit;
end;
init_ol := '<ol>'; //2015-11-25
end_ol := '</ol>';
pag_ricerca := TextBetween(Page, init_ol, end_ol) + tappo_fine_ricerca + end_ol; //elenco titoli richiesti e tappo ricerca
if debug_search then
DumpPage(folder+'googlericerca.html', pag_ricerca); // debug
save_pag := pag_ricerca;
init_control := '<div class="g">'; //2016-02-10
end_control := '<div class="g">'; //2016-02-10
dati_album := init_control + TextBetween (pag_ricerca, init_control, end_control) + end_control;
//dati_album contiene recursivamente i dati delle pagine referenziate da google
lgth_dati_album := length(dati_album);
if debug_search then
DumpPage(folder+'google_dati_album.html', dati_album); // debug
delete(Pag_ricerca, 1, (lgth_dati_album - length(end_control)));
if debug_search then
DumpPage(folder+'googlericerca-1.html', Pag_ricerca); // debug
while (dati_album <> tappo_fine_ricerca) do //estraggo fino al tappo di fine ricerca
begin
initchar := 'https://'; //2017-01-04
endchar := '/%252';
Address := textBetween(dati_album, initchar, endchar);
if length(address) < 1 then
begin
initchar := 'http://'; //2017-01-04
Address := textBetween(dati_album, initchar, endchar);
end;
initchar := 'https://'; //2017-01-04
endchar := '/&sa';
Address := textBetween(dati_album, initchar, endchar);
if length(address) < 1 then
begin
initchar := 'http://'; //2017-01-04
Address := textBetween(dati_album, initchar, endchar);
end;
Address := 'https://' + Address;
initchar := '<h3 class="r">';
endchar := '</h3>';
Title_album := textBetween(dati_album,initchar, endchar); //descrizione del link
HTMLRemoveTags(Title_album);
// Title_album := copy(Title_album, 1, 42);
//fs2017-11-01 test se serie o scheda (film e serie TV)
if (pos('/scheda', Address) > 0) or (pos('/serie', Address) > 0) then
begin
PickTreeAdd(Title_Album, Address);
found := True;
end;
//2016-02-10 init_control := '<li class="g">';
//2016-02-10 end_control := '<li class="g">';
init_control := '<div class="g">'; //2016-02-10
end_control := '<div class="g">'; //2016-02-10
dati_album := init_control + TextBetween (pag_ricerca, init_control, end_control) + end_control;
lgth_dati_album := length(dati_album);
delete(Pag_ricerca, 1, (lgth_dati_album - length(end_control)));
lgth_dati_album := length(Dati_album) - (length(init_control) + length(end_control));
end;
// end;
if not found then
begin
LogMessage('No album found for ' + Desc_ricerca);
exit;
end;
if PickTreeExec(Address) then
begin
AnalyzeMoviePage(Address); // Album page
end
else
LogMessage('No serie/film selected');
// ---------------------------------------
end;
//------------------------------------------------------------------------------
// ANALYZE Movie PAGE
//------------------------------------------------------------------------------
procedure AnalyzeMoviePage(Address: string);
var
urlmusic, Lenght, Pays: String;
Autore, style, Commenti, str_min, campo_note: String;
minu, minuti, ore, lgth_comm, save_lgth_comm, i: integer;
j: Real;
begin
if pos('/film/', Address) > 1 //fs2017-10-29
then begin
stagione := '';
// tipo_ricerca := 'sk ep';
estrazione_film(Address);
exit;
end
if pos('/scheda', Address) > 1
then begin
stagione := '';
tipo_ricerca := 'sk ep';
end
else if pos('/episodi', Address) > 1
then begin
tipo_ricerca := 'ep sk';
// stagione := ' (' + (textbetween(Address,'/episodi/', '/') + ')';
stagione := ' (' + (textafter(Address, '/episodi/') + ')';
end
else begin
ShowMessage('indirizzo di estrazione non appropriato. Né scheda né episodi!');
exit;
end;
save_comments := '';
commento_episodi := '';
commento_skeda := '';
if tipo_ricerca = 'sk ep' then
begin
estrazione_scheda(Address);
save_comments := commento_skeda + CRLF + commento_episodi; //quiFS2017
SetField(fieldcomments, save_comments); // commenti + elenco episodi end
save_description := save_desc_skeda;
SetField(fieldDescription, save_description);
end
if tipo_ricerca = 'ep sk' then // inizio variazioni fs2016-11-17
begin
estrazione_episodi(Address);
save_comments := commento_skeda; // + commento_episodi;
// SetField(fieldcomments, save_comments); // commenti + elenco episodi end
SetField(fieldDescription, commento_episodi);
save_description := save_desc_skeda + CRLF + commento_episodi;
// SetField(fieldDescription, save_description);
SetField(fieldComments, save_desc_skeda);
end
end;
//------------------------------------------------------------------------------
// ESTRAE INFORMAZIONI DA SCHEDA + EPISODI SE E' UNA SERIE
//------------------------------------------------------------------------------
procedure estrazione_scheda(Address: string);
begin
Page := GetPage(Address);
Page := UTF8decode(Page);
HTMLdecode(Page);
if debug_film_o_serie then
DumpPage(folder+'comingsoonPageDetail.txt', Page); // debug_film_o_serie
// HTMLdecode(Page);
if (BatchMode = 0) and (tipo_ricerca = 'sk ep') then
SetField(fieldURL, Address);
campo_URL := getfield(fieldurl);
SetField(fieldDate, DateToStr(Date));
// Normalizza_Page(Page);
film_o_serieok := True;
if debug_film_o_serie then
DumpPage(folder+'comingsoonPageDetailHTMLdecode.html', Page); // debug_film_o_serie
Value := Page;
//*** cover locandina jpg
cover := TextBetween(value, '<link rel="image_src" href="', '">');
// setfield(fieldborrower, cover);
if tipo_ricerca = 'sk ep' then
GetPicture(cover);
// if length(Getfield(fieldtranslatedTitle)) < 1 then
// begin
//fs2016-06-26 initchar := '<h1 itemprop="name" class="titolo scheda col-sm-10">';
initchar := '<h1 class="titolo scheda col-sm-10">'; //fs2016-06-26
endchar := '</h1>';
label := textbetween(Value, initchar, endchar);
label := label + stagione;
if length(label) > 0
then begin
label := stringReplace(label, '/', '');
label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
SetField(fieldtranslatedTitle, label);
end;
label := textbetween(Value, 'Titolo originale: ', '</p>');
if pos('/scheda', campo_url) > 1 then
label := label + ' (Serie TV)';
label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
SetField(fieldoriginalTitle, label);
//inizio estrazione dati per fielddescription (da save_desk_skeda)
// estrae-descrizione_vecchia //FS debug: procedura ante 2019.01.18
//*************************************** estrae_descrizione //FS introdotta 2019.01.18
initchar := '<!-- Trama -->';
endchar := '<!-- Curiosità -->';
label := TextBetween(Value, initchar, endchar) + endchar;
initchar := '<div>';
endchar := '</div>';
label := TextBetween(label, initchar, endchar);
initchar := '<p>';
endchar := '</p>';
label := TextBetween(label, initchar, endchar);
save_desc_skeda := label;
initchar := '<!-- Curiosità -->';
endchar := '<!-- voci full -->';
label := TextBetween(Value, initchar, endchar) + endchar;
initchar := '<h2 class="anchor">';
endchar := '<!-- voci full -->';
label := TextBetween(label, initchar, endchar) + endchar;
initchar := '<p>';
endchar := '</p>';
label := TextBetween(label, initchar, endchar);
save_desc_skeda := save_desc_skeda + CRLF + label;
HTMLRemoveTags(save_desc_skeda);
//*************************************** Fine estrae_descrizione //FS introdotta 2019.01.18
initchar := '<span>GENERE</span>:';
endchar := '</li>';
label := TextBetween(value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
// label := fulltrim(label);
SetField(fieldcategory, label);
initchar := '<li><span>REGIA</span>: ';
endchar := '</li>';
label := TextBetween(value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fieldDirector, label);
initchar := '<li><span>ATTORI</span>:';
endchar := '</li>';
label := initchar + TextBetween(Value, initchar, endchar) + endchar;
HTMLRemoveTags(label);
label := stringReplace(label, 'ATTORI: ', '');
SetField(fieldactors, label);
initchar := '<li><span>ANNO</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldyear, label);
initchar := '<li><span>PAESE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldcountry, label);
initchar := '<li><span>PRODUZIONE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldproducer, label);
initchar := '<li><span>IDEATORE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldwriter, label);
initchar := '<li><span>DURATA</span>: ';
endchar := ' Min</meta></li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fieldlength, label);
// commenti_ le serie contengono anche l'elenco episodi //
Value := stringReplace(Value, '>CURIOSITÀ:<', '>Curiosità:<'); //quiFS2017
initchar := '<div class="h5 pad-tlr-18">Curiosità:</div>';
endchar := '</div>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
commento_skeda := label;
// save_comments := label;
if tipo_ricerca = 'sk ep' then
begin
// per le serie, aggiungo l'elenco episodi
initchar := '<nav class="col-xs-12 tab-menu tab-12 serietv">';
endchar := '</nav>';
label := Textbetween(Value, initchar, endchar);
initchar := '<li class="item1"><a href="';
endchar := '">';
label := Textbetween(label, initchar, endchar);
if length(label) > 0 then
begin
label := 'https://www.comingsoon.it' + label;
Address := label;
estrazione_episodi(Address);
save_comments := commento_skeda + CRLF + commento_episodi;
// SetField(fieldcomments, save_comments); // commenti + elenco episodi
end;
end
end;
//-----------------------------------
// ESTRAE INFORMAZIONI DA SCHEDA Film
//-----------------------------------
procedure estrazione_film(Address: string);
begin
Page := GetPage(Address);
//****************************************
PosBar := AnsiLastPosEx('/scheda', Address, true, true);
if PosBar = 0 then
begin
showmessage('Questa non è la scheda di un film! Riprova.');
exit;
end
//****************************************
Page := UTF8decode(Page);
if debug_film_o_serie then
DumpPage(folder+'comingsoonFilm.txt', Page); // debug_film_o_serie
HTMLdecode(Page);
if (BatchMode = 0) then
SetField(fieldURL, Address);
campo_URL := getfield(fieldurl);
SetField(fieldDate, DateToStr(Date));
// Normalizza_Page(Page); //fs2017-10-31 appesantisce l'esecuzione!
film_o_serieok := True;
if debug_film_o_serie then
DumpPage(folder+'comingsoonPageDetailHTMLdecode.txt', Page); // debug_film_o_serie
Value := Page;
//*** cover locandina jpg
cover := TextBetween(value, '<link rel="image_src" href="', '">');
if pos('def_ico.gif', cover) = 0 then
GetPicture(cover);
initchar := '<h1 itemprop="name" class="titolo scheda col-sm-10">'; //fs2016-06-26
endchar := '</h1>';
label := textbetween(Value, initchar, endchar);
label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
SetField(fieldtranslatedTitle, label);
label := textbetween(Value, 'Titolo originale: ', '</p>');
label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
SetField(fieldoriginalTitle, label);
initchar := '<div class="contenuto-scheda-destra col-xs-8">';
endchar := '<div class="box-descrizione">';
label := TextBetween(Value, initchar, endchar) + endchar;
initchar := '<!-- Paragrafo -->';
// label := TextBetween(label, initchar, endchar); // era per solo serie
label := TextAfter(label, initchar); //sia serie che film
initchar := '<p>';
endchar := '</p>';
label := TextBetween(label, initchar, endchar);
label := stringReplace(label, '<strong>', ' $%&$%&$%&');
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
label := stringReplace(label, ' $%&$%&$%&', CRLF); //se presenti descrizioni di serie multiple
label := stringReplace(label, '$%&$%&$%&', ''); //eventuale prima riga della descrizione
save_desc_skeda := label;
initchar := '<span>GENERE</span>:';
endchar := '</li>';
label := TextBetween(value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
// label := fulltrim(label);
SetField(fieldcategory, label);
initchar := '<li><span>REGIA</span>: ';
endchar := '</li>';
label := TextBetween(value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fieldDirector, label);
initchar := '<li><span>ATTORI</span>:';
endchar := '</li>';
label := initchar + TextBetween(Value, initchar, endchar) + endchar;
HTMLRemoveTags(label);
label := stringReplace(label, 'ATTORI: ', '');
SetField(fieldactors, label);
initchar := '<li><span>ANNO</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldyear, label);
initchar := '<li><span>PAESE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldcountry, label);
initchar := '<li><span>PRODUZIONE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldproducer, label);
initchar := '<li><span>MUSICHE</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldcomposer, label);
initchar := '<li><span>SCENEGGIATURA</span>: ';
endchar := '</li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
SetField(fieldwriter, label);
initchar := '<li><span>DURATA</span>: ';
endchar := ' Min</meta></li>';
label := TextBetween(Value, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fieldlength, label);
// descrizione fielddescription
endchar := '</div>';
label := textbetween(Value, '<div class="box-descrizione show">', endchar) + endchar; //fs2017-10-29
label := textbetween(label, '</h2>', '</div>'); //fs2017-10-29
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fielddescription, label);
// commento fieldcomments
initchar := '<!-- Critica -->';
endchar := '</div>';
label := textbetween(Value, initchar, endchar) + endchar; //fs2017-10-29
label := textbetween(label, '</h2>', '</div>'); //fs2017-10-29
HTMLRemoveTags(label);
label := FormatText(label);
SetField(fieldcomments, label);
end;
//------------------------------------------------------------------------------
// ESTRAE INFORMAZIONI DA EPISODI DI UNA SERIE + SCHEDA DELLA SERIE
//------------------------------------------------------------------------------
Procedure estrazione_episodi(Address: string);
Begin
Page := GetPage(Address);
Page := UTF8decode(Page);
if debug_film_o_serie then
DumpPage(folder+'comingsoonepisodes.txt', Page); // debug_film_o_serie
HTMLdecode(Page);
//*** cover locandina jpg
cover := TextBetween(Page, '<link rel="image_src" href="', '">');
if tipo_ricerca = 'ep sk' then
GetPicture(cover);
if (BatchMode = 0) and (tipo_ricerca = 'ep sk') then
SetField(fieldURL, Address);
campo_URL := getfield(fieldurl);
initchar := '<div class="articoli-piu-recenti-xl box-main" id="box-lista-episodi-serietv" role="tablist">';
endchar := '<div class="box-share-tasti-sociali">';
Value := initchar + TextBetween(Page, initchar, endchar) + endchar;
if debug_film_o_serie then
DumpPage(folder+'comingsoonepisodesExtr.txt', Value); // debug_film_o_serie
Value := StringReplace(Value, '<div class="col-sm-6 titolo">', '$%&$%&$%&');
// formatta episodi //
//1. Sotto assedio (A'ohe Kahi e Pe'e Ai) - REGIA: Bryan Spicer - SCENEGG.: Peter M. Lenkov, Ken Solarz.......
Value := stringReplace(Value, '<div class="col-sm-6 descrizione">', '<div class="col-sm-6 descrizione">seispazi (');
// Value := stringReplace(Value, '<li class="h6 anno"><strong>REGIA', '<li class="h6 anno"><strong>)seispazi - REGIA');
Value := stringReplace(Value, '<li class="h6 anno"><strong>REGIA', '<li class="h6 anno"><strong>) - REGIA');
Value := stringReplace(Value, '<li class="h6 anno"><strong>SCENEGGIATURA', '<li class="h6 anno"><strong> - SCENEGG.');
Value := stringReplace(Value, '<li class="h6 anno"><strong>TRAMA</strong>: ', '<li class="h6 anno"><strong>$%&$%&$%&TRAMA</strong>: ');
// Value := stringReplace(Value, ' )', ')');
initchar := '<li class="h6 anno"><strong>DURATA';
endchar := '</li>';
durata:= initchar + TextBetween(Value, initchar, endchar) + endchar;
while length(durata) > (length(initchar) + length(endchar)) do
begin
durata:= initchar + TextBetween(Value, initchar, endchar) + endchar;
Value := stringReplace(Value, durata, ''); // elimino durata dei singoli episodi
end;
// fine formatta episodi //
HTMLRemoveTags(Value);
if debug_film_o_serie then
DumpPage(folder+'comingsoonepisodesExtr.txt', Value); // debug_film_o_serie
value := FormatText(value);
Value := StringReplace(Value, CRLF, '');
Value := stringReplace(Value, '$%&$%&$%&', CRLF);
Value := stringReplace(Value, 'seispazi', ' '); //eventuale prima riga della descrizione
Value := stringReplace(Value, ' )', ')');
Value := stringReplace(Value, ' ', ' ');
Value := stringReplace(Value, ' ', '');
commento_episodi := Value; //fs2016-11-17
//fs 2016-06-02 -------------- aggiungo commenti per la serie ----------------------------------
// commenti_ le serie contengono anche l'elenco episodi //
Page := stringReplace(Page, '>CURIOSITÀ:<', '>Curiosità:<');
initchar := '<div class="h5 pad-tlr-18">Curiosità:</div>';
endchar := '</div>';
label := TextBetween(Page, initchar, endchar);
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
commento_episodi := commento_episodi + CRLF + label;
// save_comments := label;
//fine fs 2016-06-02 ------------------------------------------------
if tipo_ricerca = 'ep sk' then
begin
// per le serie, aggiungo l'elenco episodi
initchar := '<nav class="col-xs-12 tab-menu tab-12 serietv">';
endchar := '</nav>';
label := Textbetween(Page, initchar, endchar);
initchar := '<li class="item1"><a href="';
endchar := '">';
label := Textbetween(label, initchar, endchar);
label := Textbefore(label, '"', ''); //fs 2017-10-26
if length(label) > 0 then
begin
label := 'https://www.comingsoon.it' + label;
Address := label;
estrazione_scheda(Address);
end;
end
end;
// ********************* fine estrazione episodi *****************************************
Procedure Normalizza_page(Pagina: string); // elimina i crlf, trasforma delimiters maiuscoli in minuscoli
begin
pagina := RegExprSetReplace('<([^>]+)>', pagina, '<\L\1>', true);
CharAbNormal := crlf;
CharNormal := ' ';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '<B';
CharNormal := '<b';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</B';
CharNormal := '</b';
pagina := StringReplace(Value, CharAbNormal, CharNormal);
CharAbNormal := '<FONT';
CharNormal := '<font';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</FONT';
CharNormal := '</font';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '<TR';
CharNormal := '<tr';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</TR';
CharNormal := '</tr';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '<TD';
CharNormal := '<td';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</TD';
CharNormal := '</td';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '<DIV';
CharNormal := '<div';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</DIV';
CharNormal := '</div';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '<Ol';
CharNormal := '<ol';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
CharAbNormal := '</Ol';
CharNormal := '</ol';
pagina := StringReplace(pagina, CharAbNormal, CharNormal);
end;
//------------------------------------------------------------------------------
// set show warning (normal mode) or add to log (batch mode)
//------------------------------------------------------------------------------
procedure LogMessage(m: string);
begin
if BatchMode > 0 then
AddToLog('item '+GetField(fieldNumber)+': '+m)
else
ShowWarning(m);
end;
//------------------------------------------------------------------------------
// add a message in the batch log and save to disk
// (because I don't know when it's finished...)
//------------------------------------------------------------------------------
procedure AddToLog(m: string);
begin
//fs2016-12-31 batchlog.Add(m);
//fs2016-12-31 batchlog.SaveToFile(batchlogfic);
end;
//------------------------------------------------------------------------------
// process batch mode
//------------------------------------------------------------------------------
procedure comingsoonBatch;
begin
film_o_serieName := GetField(fieldUrl); // if no url or another site then ignore
if (film_o_serieName <> '') and (Pos(UrlBase, film_o_serieName) > 0) then
AnalyzeMoviePage(film_o_serieName)
else
LogMessage('ignored url="'+film_o_serieName+'"');
end;
//------------------------------------------------------------------------------
// process normal mode
//------------------------------------------------------------------------------
procedure comingsoonNorm;
begin
film_o_serieok := False;
file_name:= getField(fieldfilepath);
if (file_name <> '') and (pos('\', file_name) = 0) then
film_o_serieName := file_name
else
if (GetField(fieldTranslatedTitle) <> '') then //mrobama
film_o_serieName := GetField(fieldTranslatedTitle) // get film_o_serie name
else //mrobama
film_o_serieName := GetField(fieldOriginalTitle); //mrobama
// get film_o_serie name//fs20160205 ArtistName := getField(fieldOriginalTitle); // get artist
repeat
if not Input('comingsoon = ' + ArtistName + ' - ' + film_o_serieName, 'Scrivi il nome del film o della serie:'
+ crlf, film_o_serieName) or (film_o_serieName = '') then exit;
formato := getfield(FieldOriginalTitle);
if pos(formato, 'serie') > 0 then
formato:= 'serie';
GetList;
until film_o_serieok;
end;
Procedure estrae_descrizione_vecchia;
begin
initchar := '<div class="contenuto-scheda-destra col-xs-8">';
endchar := '<div class="box-descrizione">';
label := TextBetween(Value, initchar, endchar) + endchar;
initchar := '<!-- Paragrafo -->';
// label := TextBetween(label, initchar, endchar); // era per solo serie
label := TextAfter(label, initchar); //sia serie che film
initchar := '<p>';
endchar := '</p>';
label := TextBetween(label, initchar, endchar);
label := stringReplace(label, '<strong>', ' $%&$%&$%&');
HTMLRemoveTags(label);
label := FormatText(label);
label := stringReplace(label, CRLF, '');
label := stringReplace(label, ' $%&$%&$%&', CRLF); //se presenti descrizioni di serie multiple
label := stringReplace(label, '$%&$%&$%&', ''); //eventuale prima riga della descrizione
save_desc_skeda := label;
end;
//------------------------------------------------------------------------------
// start here
//------------------------------------------------------------------------------
begin
if not CheckVersion(4,2,2) then
begin
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 4.2.1)');
exit;
end;
// get user's parms (used more than once)
BatchMode := GetOption('Mode');
// *********************************************************************
if BatchMode = 1 then
comingsoonBatch;
if BatchMode = 0 then
comingsoonNorm;
end.
[UPD ITA] comingsoon.it
-
- Posts: 764
- Joined: 2007-04-28 05:46:43
- Location: Italy
[UPD ITA] comingsoon.it
Original and tranlated Title in Mixed letter mode (i.e. La Notte Dei Morti Viventi).
Re: [UPD ITA] mymovies.it
Thanks
Though that it looks like an update of the "comingsoon.it" script rather than "mymovies.it" as stated in the title
Though that it looks like an update of the "comingsoon.it" script rather than "mymovies.it" as stated in the title

-
- Posts: 764
- Joined: 2007-04-28 05:46:43
- Location: Italy
Re: [UPD ITA] comingsoon.it
Sorry... You are right (as usual).
Is it possible to change the title? Could you do that (I think I'm not authorized) ?


Is it possible to change the title? Could you do that (I think I'm not authorized) ?
