Page 1 of 1

[UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-10-18 05:11:00
by fulvio53s03
Lo script viene adeguato alla nuova struttura del sito. Verificato con alcune serie TV e con alcuni film. Segnalate Eventuali errori!
The script is adapted to the new site structure. Verified with some TV series and some movies. Report any errors!
:) :) :)

Code: Select all

(***************************************************

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.4.1
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=1|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.html';                  // 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 + ' ';
var
   nuovo_anno, mese_anno, solo_anno, data_rilascio, label, stagione: String;
   Credit_address, Readdress, Page, Page_footer: String;
   film_o_serieName, ArtistName, firstcall, name, autori: String;
   Formato, Releases, artista: String;
   file_name, campo_URL: String;
   tappo_fine_ricerca: 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;
   cerca_ancora: boolean;
   BatchMode, giri, PosBar: Integer;
   titolo_e_autore, 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;

//*********************inizio variabile per ricerca google ********************
   Address, Address_all, urlmusic, album, albumtest, genre: String;
   Save_address, Title_album, indir_album, indir_title_album, campo_pick: String;
   dati_album, init_control, end_control, init_ol, end_ol: String;
   str_loop, Desc_ricerca: String;
   ctr_loop: integer;
   found: boolean;
   i, lgth_tappo, lgth_dati_album, lgth_Pag_ricerca: integer;
//***********************fine variabile per ricerca google ********************

//------------------------------------------------------------------------------
// list of film_o_series
//------------------------------------------------------------------------------
procedure GetList;   
begin
   PickTreeClear;                                                    // clear list
   ctr_loop := 0;
   desc_ricerca := file_name;
   if desc_ricerca = '' then
      desc_ricerca := film_o_serieName;
//            'https://www.google.com/search?q=star+trek+discovery+site%3Awww.comingsoon.it&ie=utf-8&oe=utf-8'
//   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 := 'https://www.google.com/search?q=' + film_o_serieName + ' trama+site%3Awww.comingsoon.it&ie=utf-8&oe=utf-8';           //fs2019-06-12
   Address := 'https://www.google.com/search?q=' + film_o_serieName + '+site%3Awww.comingsoon.it&ie=utf-8&oe=utf-8';           //fs2019-06-12
   Address := UrlEncode(Address);
   Desc_ricerca := 'Lista pagine trovate per  "' + Desc_ricerca + '"';
   PickTreeAdd(Desc_ricerca, '"');
   due_giri;
   Address := textbetween(Page_footer, '<a', '</a>');
   Address := textbetween(Address, 'href="', '"');
   if length(address) > 0 then
      begin
      Address := 'https://www.google.com' + fulltrim(Address);
      due_giri;
      end;
if not found then
   begin
      LogMessage('No album found for ' + Desc_ricerca);
      exit;
   end;
   if PickTreeExec(Address) then
      begin
//      AnalyzeMoviePage(Address);                         // Album page
      AnalyzeMoviePage;                                    // Album page
      end
   else
      LogMessage('No serie/film selected');
// ---------------------------------------
end;

procedure due_giri;
begin
   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+'comingsoonList.html', 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 := '</head>';                        //2015-11-25
   end_ol  := '</body>';
   init_control := '<a href="/url?q=https://www.comingsoon.it/';     //2016-02-10
   end_control := '<a href="/url?q=https://www.comingsoon.it/';      //2016-02-10
   tappo_fine_ricerca := init_control + 'Tappodifinericercadaticongoogle' + end_control;    //2019-06-07
   pag_ricerca := TextBetween(Page, init_ol, end_ol) + tappo_fine_ricerca + end_ol;  //elenco titoli richiesti e tappo ricerca
   page_footer := TextAfter(Page, '<footer>');
   lgth_Pag_ricerca :=  length(Pag_ricerca);
   if debug_search then
      DumpPage(folder+'googlericerca.html', pag_ricerca);                // debug

   save_pag := pag_ricerca;
   pag_ricerca := init_control + textAfter(pag_ricerca, init_control);
   lgth_tappo := length(tappo_fine_ricerca);
   dati_album := TextBetween (pag_ricerca, init_control, end_control);
   dati_album := init_control + dati_album + end_control;
//dati_album contiene recursivamente i dati delle pagine referenziate da google
   lgth_dati_album := length(dati_album);
   ctr_loop := ctr_loop + 1;
   str_loop := inttostr(ctr_loop);
   if debug_search then
      DumpPage(folder+'google_dati_album' + str_loop + '.html', dati_album);                // debug
   delete(Pag_ricerca, 1, (lgth_dati_album - length(end_control)));
   lgth_Pag_ricerca :=  length(Pag_ricerca);
   if debug_search then
      DumpPage(folder+'googlericerca-1.html', Pag_ricerca);

//****************** loop ricerca indirizzi *****************************
   cerca_ancora := false;
   if lgth_dati_album > (length(init_control) + length(end_control)) then
      cerca_ancora := true;
   while cerca_ancora  do                 //estraggo fino al tappo di fine ricerca
      begin
      initchar := 'https://';       //2017-01-04
      endchar  := '>';
      
// ******************** estrazione indirizzo *******************
      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  := '">';
      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;                // debug    fino al 2019-06-05 OK
      Address_all := Address;
      Address := textBefore(Address_all, '/&sa', '');
      if length(Address) = 0 then
         Address := textBefore(Address_all, '/%252', '');
// *************** fine estrazione indirizzo *******************

      initchar := '<div class="';
      endchar  := '</div>';
      Title_album  := textBetween(dati_album,initchar, endchar) + endchar;              //descrizione del link
      initchar := '">';
      endchar  := '</div>';
      Title_album  := textBetween(Title_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)
//fs2019.06.12     if (pos('/scheda', Address) > 0) or (pos('/serie', Address) > 0) then
      Address := Address + '/';
      if (pos('/anticipazioni/', Address) = 0)
          and (pos('/foto/', Address) = 0)
          and (pos('/games/', Address) = 0)
          and (pos('/gossip/', Address) = 0)
          and (pos('/news/', Address) = 0)
          and (pos('/personaggi/', Address) = 0)
          and (pos('/speciali/', Address) = 0)
          and (pos('/sport/', Address) = 0)
          and (pos('/streaming/', Address) = 0)
          and (pos('/video/', Address) = 0)
          then begin
//          Address := copy(Address, 1, length(Address) - 1);
          campo_pick := Title_Album + Address;
//          if length(campo_pick) > 2 then     //perchè ho aggiunto '/' a fine indirizzo
          if length(campo_pick) > (length(Title_album) + 1) then     //perchè ho aggiunto '/' a fine indirizzo
             begin
             PickTreeAdd(Title_Album, Address);
             found := True;
             end;
      end;
//2016-02-10   init_control := '<li class="g">';
//2016-02-10   end_control := '<li class="g">';
//      init_control := '<div class="g">';           //2019-06-07
//      end_control := '<div class="g">';            //2019-06-07
      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_Pag_ricerca := length(Pag_ricerca);

      ctr_loop := ctr_loop + 1;
      str_loop := inttostr(ctr_loop);
      if debug_search then
         DumpPage(folder+'google_dati_album' + str_loop + '.html', dati_album);                // debug

       cerca_ancora := false;
       if lgth_dati_album > (length(tappo_fine_ricerca)) then
          cerca_ancora := true;
   end;
//************* fine loop ricerca indirizzi *****************************
end;

//------------------------------------------------------------------------------
// ANALYZE Movie PAGE
//------------------------------------------------------------------------------
procedure AnalyzeMoviePage;
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;
           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;
      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;
      save_comments := commento_skeda;                        // + commento_episodi;
      SetField(fieldDescription, commento_episodi);
      save_description := save_desc_skeda + CRLF + commento_episodi;
      SetField(fieldComments, save_desc_skeda);
   end
end;

//------------------------------------------------------------------------------
// ESTRAE INFORMAZIONI DA SCHEDA + EPISODI SE E' UNA SERIE
//------------------------------------------------------------------------------
procedure estrazione_scheda;
begin
   Page := GetPage(Address);
   Page := UTF8decode(Page);
   HTMLdecode(Page);
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoonPageDetail.html', 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);

//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
   estrai_dati_generali;

// commenti_ le serie contengono anche l'elenco episodi //
   Value := stringReplace(Value, '>CURIOSITÀ:<', '>Curiosità:<');      //quiFS2017
   initchar := '<h2 class="h2 anchor"><span id="curiosita';
   endchar :=  '</div>';
   label := initchar + TextBetween(Value, initchar, endchar) + endchar;
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, (CRLF + ' '), 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 Attori DA SCHEDA Film (presente solamente in quella pagina)
//--------------------------------------------------------------------
Procedure Estrai_attori;
begin
   initchar := '<b>Attori:</b>';
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);           //fs fin qui i dati ci sono
   initchar := '<span>';
   endchar :=  '</span>';
   label := TextBetween(label, initchar, endchar);           //fs fin qui i dati ci sono
   HTMLRemoveTags(label);
//   label := stringReplace(label, 'ATTORI:', '');
   if  label = '' then
       nuovo_loop_attori;
   SetField(fieldactors, label);
end;

Procedure nuovo_loop_attori;
begin
   initchar := '<!-- SLIDER HOME 7-10 -->';
   endchar :=  '<!-- /FINE SLIDER HOME 7-10 -->';
   label := initchar + TextBetween(Value, initchar, endchar) + endchar;           //fs fin qui i dati ci sono
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoon_attori.html', label);                         // debug_film_o_serie

end;

//-----------------------------------
// ESTRAE INFORMAZIONI DA SCHEDA Film
//-----------------------------------
procedure estrai_dati_generali;
begin
//   if titolo <> ''  then
//     begin
       initchar := '<h1 class="titolo h1">';
       endchar :=  '</h1>';
       label := textbetween(Value, initchar, endchar);
       label := label + stagione;
       if length(label) > 0
          then begin
          label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
          label := stringReplace(label, '/', '');
          SetField(fieldtranslatedTitle, label);
       end;
//   end;

   label := textbetween(Value, '<div class="sottotitolo h3">( ', ' )');
   label := AnsiMixedCase(AnsiLowerCase(Label), ' ');
   if pos('/serietv', campo_url) > 0  then
      begin
        if pos('/episodi', campo_url) = 0  then
           label := label + ' (Serie TV)';
      end
   SetField(fieldoriginalTitle, label);

   initchar := '<b>Genere:</b>';
   endchar :=  '</div>';
   label := TextBetween(value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
//   label := stringReplace(label, CRLF, '');
//   label := fulltrim(label);
   SetField(fieldcategory, label);

   initchar := '<b>Regia:</b>';
   endchar :=  '</div>';
   label := TextBetween(value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   SetField(fieldDirector, label);

   Estrai_attori;

   initchar := '<b>Anno:</b>';
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
//   label := stringReplace(label, CRLF, '');
   SetField(fieldyear, label);

   initchar := '<b>Paese:</b>';
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   SetField(fieldcountry, label);

   initchar := '<b>Produzione:</b>';
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   SetField(fieldproducer, label);

   initchar := '<b>Durata:</b>';
   endchar :=  'min</span></div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   SetField(fieldlength, label);
   
   initchar := 'Musiche:';
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   SetField(fieldcomposer, label);

   initchar := '<li><span>Sceneggiatura:</span>: ';      //per i film
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   SetField(fieldwriter, label);

   initchar := '<b>Ideatore:</b>';                      //per le serie
   endchar :=  '</div>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   SetField(fieldwriter, label);

end;

//-----------------------------------
// ESTRAE INFORMAZIONI DA SCHEDA Film
//-----------------------------------
procedure estrazione_film;
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.html', 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.html', 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);
   estrai_dati_generali;
   
// descrizione       fielddescription
   initchar := '<!-- Trama -->';
   endchar := '</div>';
   label := textbetween(Value, initchar, endchar) + endchar;
   label := textbetween(label, '<div>', '</div>');
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, (CRLF + ' '), CRLF);
   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;
Begin
   Page := GetPage(Address);
   Page := UTF8decode(Page);
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoonepisodes.html', 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);
   initchar := '<title>';
   endchar  := '</title>';
   value := TextBetween(Page, initchar, endchar);
   label := TextBefore(value, ' Episodi', '');
   SetField(fieldOriginalTitle, label);
   value := stringReplace(value, ' Episodi ', ' (');
   value := Value + ')';
   SetField(fieldTranslatedTitle, value);                           //fs2019.10.14 fin qui tutto bene

   if (BatchMode = 0)  and (tipo_ricerca = 'ep sk') then
      SetField(fieldURL, Address);
   campo_URL := getfield(fieldurl);
   initchar := '<h2 class="h2">Lista episodi';
   endchar  := '<!-- /LISTA EPISODI SERIE TV  -->';
   Value  := initchar + TextBetween(Page, initchar, endchar) + endchar;
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoonepisodesExtr_original.html', Value);            // debug_film_o_serie

   HTMLRemoveTags(Value);
//fs2019-10-14   Value := stringReplace(Value, ' min', (' min' + CRLF) );                  //fs2019-10-14
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoonepisodesExtr.html', Value);            // debug_film_o_serie
   value := FormatText(value);
   if debug_film_o_serie  then
      DumpPage(folder+'comingsoonepisodesExtrFormat.html', Value);            // debug_film_o_serie
   Value := StringReplace(Value, (' ' + CRLF), ' ');
   Value := StringReplace(Value, ('  '), CRLF);
   Value := StringReplace(Value, (CRLF + CRLF + CRLF), CRLF);
   Value := StringReplace(Value, (CRLF + CRLF + CRLF), CRLF);
   Value := StringReplace(Value, (CRLF + CRLF), CRLF);
   Value := StringReplace(Value, (CRLF +' '), CRLF);
   Value := StringReplace(Value, (CRLF +'Regia:'), '      Regia:');
   Value := StringReplace(Value, (CRLF +'Sceneggiatura:'), '      Sceneggiatura:');
   Value := StringReplace(Value, (CRLF +'Durata:'), '     Durata:');
   Value := Value + CRLF;
//************** elimina durata episodi *************
   initchar := '     Durata:';
   endchar  := CRLF;
   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, CRLF);    // elimino durata dei singoli episodi
     end;
//********* fine elimina durata episodi *************

   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, '<BLOCKQUOTE', '<blockquote');
   initchar := '<blockquote>';
   endchar :=  '</blockquote>';
   label := TextBetween(Page, initchar, endchar);
   label := stringReplace(label, '>CURIOSITÀ<', '>Curiosità<');
   initchar := '<div class="h3">Curiosità</div>';
//   endchar :=  '</div>';
   label := TextAfter(label, initchar);
   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="link-bar serie-tv">';
      endchar  := '</nav>';
      label := Textbetween(Page, initchar, endchar);
      initchar := '<li';
      endchar  := '">';
      label    := Textbetween(label, initchar, endchar);
      label    := Textafter(label, 'href="');                      //fs 2019-10-14
      if length(label) > 0 then
         begin
         label := 'https://www.comingsoon.it' + label;
         Address := label;
         estrazione_scheda;
         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);
   address := film_o_serieName;
   if address = '' then
      begin
         ShowMessage('Lo script funziona solamente fornendo un campo indirizzo (URL) corretto!');
         exit;
      end;

   if (film_o_serieName <> '') and (Pos(UrlBase, film_o_serieName) > 0) then
      AnalyzeMoviePage
   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.

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-10-20 15:43:35
by antp
Thanks

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-10-22 19:31:27
by otreux
Grazie!!! :clapping: :clapping: :clapping:
come mai importa i titoli con tutte le lettere in maiuscolo?

Thank you, why does it import titles with all capital letters?

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-10-24 13:52:16
by fulvio53s03
otreux wrote: 2019-10-22 19:31:27 Grazie!!! :clapping: :clapping: :clapping:
come mai importa i titoli con tutte le lettere in maiuscolo?

Thank you, why does it import titles with all capital letters?
Con i titoli che ho provato non succede. Fammi un esempio, per favore.
With the titles I have tried it does not happen. Give me an example, please.

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-17 14:00:03
by otreux
con tutti i film, ad esempio:

"Mio Fratello Rincorre I Dinosauri"


Non so come rinomini tu i titoli dei film ma io uso solo la prima lettera del titolo in maiuscolo, secondo me dovrebbe essere così:

"Mio fratello rincorre i dinosauri"

Grazie :)

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 11:46:29
by fulvio53s03
Io uso la nomenclatura inglese che prevede il maiuscolo per tutte le parole, escluse congiunzioni e preposizioni (su cui si dovrebbe lavorare, in verità).
I use the English nomenclature which includes the capitalization for all words, excluding conjunctions and prepositions (about which one should actually work on).
;)

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 16:17:04
by otreux
Per quel poco che ricordo in inglese si scrive esattamente come in italiano ma forse ricordo male io :)

Conosci uno script che mi possa trasformare i titoli (sia l'originale che il tradotto) con la sola lettera iniziale in maiuscolo?

Grazie :grinking:

For what little I remember in English you write exactly as in Italian but maybe I remember correctly :)

Do you know a script that can transform the titles (both the original and the translated) with the only initial capital letter?

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 18:03:38
by fulvio53s03
otreux wrote: 2019-11-18 16:17:04 ... in inglese si scrive esattamente come in italiano .....
non mi pare! cfr. https://www.imdb.com/
I don't think! cfr https://www.imdb.com/
:hihi:

forse "Update fields" può fare quel che desideri.
maybe "Update fields" can do what you would like.
;)

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 18:31:41
by otreux
hai ragione ma, ringraziando il cielo, io sono italiano e continuo a rinominare i film nel modo italiano :innocent:

you are right but, I am Italian and I continue to rename the films in the Italian way

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 20:18:07
by fulvio53s03
otreux wrote: 2019-11-18 18:31:41 hai ragione ma...
"Update fieds" può essere utile (con qualcuna delle sue opzioni)?
:ha:

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2019-11-18 20:27:50
by otreux
thanks but the Update fieds don't work :(

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2021-04-20 10:45:03
by Pacomania
Ciao Fulvio,

ti ringrazio in anticipo per il tuo lavoro, ho aggiornato lo script ma riscontro sempre lo stesso errore http//1.1.400 bad request.

Chicco

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2021-04-21 16:57:58
by fulvio53s03
se usi lo script Italian Multisite, funziona?
;)

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2021-04-24 14:51:48
by Pacomania
no, non mi parte lo script mi si apre subito la pagina dell'editor e non mi fa andare avanti

Grazie
Chicco

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2021-04-24 17:08:41
by fulvio53s03
non capisco. Hai le ultime versioni?
manda le videate delle versioni, e del blocco che ti succede, per capire di più.
:shaking:

Re: [UPD ITA] comingsoon.it ver. 1.4.1

Posted: 2021-04-26 10:48:44
by Pacomania
Ciao Fulvio,
ho risolto scaricando i file postati in italian multisite 4.0.0 e li ho sostituiti.

Grazie
Chicco