[UPD ITA] Comingsoon.it

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

[UPD ITA] Comingsoon.it

Post by fulvio53s03 »

Aggiornamento: Nelle stagioni delle serie, la descrizione è costituita dall'elenco degli episodi

U P D A T E D

:)
Last edited by fulvio53s03 on 2017-01-01 18:49:52, edited 2 times in total.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Thanks :)
otreux
Posts: 194
Joined: 2008-10-22 16:55:46

Post by otreux »

thank's but, for me, don't work. I see a msg:
IOHandler value is not valid :(
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Indeed; something has changed on the site I suppose
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

antp wrote: Indeed; something has changed on the site I suppose
Surely something changed on the site (last 2016.12.14 script was OK) but i think it is the same problem as discogs.it .... site changed from http to https .... i don't know what to do... :??: :(
Last edited by fulvio53s03 on 2016-12-30 23:11:27, edited 1 time in total.
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

certificate problems?

Post by mrobama »

This is my 1% (but I'm not sure about it)

The site forces https instead of http and if you try to access to http it redirects to https. So you should replace this line:

Address := Address := 'http://' + textBetween(dati_album, initchar, endchar);

with this one:

Address := 'https://' + textBetween(dati_album, initchar, endchar);

BUT there is a problem with ssl certificate. That is you have to access in "insecure mode". To understand the difference, try these curl commands:

curl -I "https://www.comingsoon.it/film/il-grand ... 57/scheda/"

and:

curl -i -k "https://www.comingsoon.it/film/il-grand ... 57/scheda/"

so: how we can skip ssl validation in GetPage? By the way, where function GetPage() is defined?
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

What is the problem with the SSL certificate?
It seems to work for me with the change you suggested (using 4.2.1 beta version)
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

Post by mrobama »

I still get "IOHandler value is not valid" when accessing to https://www.comingsoon.it/..."
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Do you use the latest 4.2.1 beta version? As https was added only in that one
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

antp wrote:Do you use the latest 4.2.1 beta version? As https was added only in that one
New script version vill be ready in a few time.
Have a good 2017! :grinking:
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

Updated to version 1.2.2

:)
Last edited by fulvio53s03 on 2017-01-05 15:07:39, edited 1 time in total.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Thanks ;)
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

Post by mrobama »

Just a little fix. Change this line:

ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 4.2.0)');

in:

ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 4.2.1)');

By the way, I'm doing other fixes, script is not working ...
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

Post by mrobama »

Little fixes, please try now
(to test the difference between old and new version search for Heidi and try to download Heidi 2015). I also modify the first input box (when you drag a movie in AMC the title is in original title field, so I also check for this field) and now only non void fields are set (if fieldvalue <> '' then setfield(fieldname, fieldvalue)).

All the credits to Fulvio53s03, these are only minor fixes

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.2.0
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;
   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: 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 := film_o_serieName;
   Address := 'https://www.google.it/search?as_q=' + film_o_serieName;
   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 := comingsoonUrl + '/cerca/?q=' + film_o_serieName + '&gsc.page=1';
//   Address := Address + '#gsc.tab=0&gsc.q=' + film_o_serieName + '&gsc.page=1';
// https://www.google.it/search?as_q=Teen%20Wolf&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_site
// search=www.comingsoon.it&as_occt=any&safe=images&as_filetype=&as_rights=
   Address := UrlEncode(Address);
   Page := GetPage(Address);
   Save_address := Address;
   SetField(fieldURL, Address);
   if debug_search then
      DumpPage(folder+'googleListPage.html', Page);                // debug
   HTMLdecode(Page);

   found := True;
//   PickTreeAdd('List of albums found for' + '"' + AlbumName + '"', '');
   PickTreeAdd('Lista articoli trovati per "' + 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

//   Normalizza_Page(pag_ricerca);
//   if debug_search then
//      DumpPage(folder+'googlericercanorm.html', pag_ricerca);                // debug

   save_pag := pag_ricerca;
//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;
   //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
//2016-02-10      initchar := '<a href="/url?q=';
//2016-03-04      initchar := '<a class="_Zkb" href="';
//2016-03-04      endchar  := '"';
      initchar := ':https://';       //2016-03-04     :http://
      endchar  := '/%252';

      Address  := 'https://' + textBetween(dati_album, initchar, endchar);
//      endchar  := '&sa=';
//      Address  := 'http://' + textBefore(Address, endchar, '');

      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);
      PickTreeAdd(Title_Album, Address);
      found := True;

//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('/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;
      if (FullTrim(save_comments) <> '') then
         SetField(fieldcomments, save_comments);     // commenti + elenco episodi           end
      save_description := save_desc_skeda;
      if (FullTrim(save_description) <> '') then
         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
      if (FullTrim(commento_episodi) <> '') then
         SetField(fieldDescription, commento_episodi);
      save_description := save_desc_skeda + CRLF + commento_episodi;
//      SetField(fieldDescription, save_description);
      if (FullTrim(save_desc_skeda) <> '') then
         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);
   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);
   SetField(fieldDate, DateToStr(Date));
   Normalizza_Page(Page);
//   Page := UTF8Decode(Page);                                              //fs2015-01-15
   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, '/', '');
          SetField(fieldtranslatedTitle, label);
       end;                                       //artista in original title

   label := textbetween(Value, 'Titolo originale: ', '</p>');
   if (label <> '') then
      SetField(fieldoriginalTitle, label);                                       //artista in original title

   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);
   if (label <> '') then
      SetField(fieldcategory, label);

   initchar := '<li><span>REGIA</span>: ';
   endchar :=  '</li>';
   label := TextBetween(value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   if (label <> '') then
      SetField(fieldDirector, label);

   initchar := '<li><span>ATTORI</span>:';
   endchar :=  '</li>';
   label := initchar + TextBetween(Value, initchar, endchar) + endchar;
   HTMLRemoveTags(label);
   label := stringReplace(label, 'ATTORI: ', '');
   if (label <> '') then
      SetField(fieldactors, label);

   initchar := '<li><span>ANNO</span>: ';
   endchar :=  '</li>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   if (label <> '') then
      SetField(fieldyear, label);

   initchar := '<li><span>PAESE</span>: ';
   endchar :=  '</li>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   if (label <> '') then
      SetField(fieldcountry, label);

   initchar := '<li><span>PRODUZIONE</span>: ';
   endchar :=  '</li>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   if (label <> '') then
      SetField(fieldproducer, label);

   initchar := '<li><span>IDEATORE</span>: ';
   endchar :=  '</li>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   label := stringReplace(label, CRLF, '');
   if (label <> '') then
      SetField(fieldwriter, label);

   initchar := '<li><span>DURATA</span>: ';
   endchar :=  ' Min</meta></li>';
   label := TextBetween(Value, initchar, endchar);
   HTMLRemoveTags(label);
   label := FormatText(label);
   if (label <> '') then
      SetField(fieldlength, label);

// commenti_ le serie contengono anche l'elenco episodi //
   Value := stringReplace(Value, '>CURIOSITÀ:<', '>Curiosità:<');
   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 EPISODI DI UNA SERIE + SCHEDA DELLA SERIE
//------------------------------------------------------------------------------
Procedure estrazione_episodi(Address: string);
Begin
//    normalizza_page(Value);                       //fs2015.01.15

   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);
   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);
      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;
   if (GetField(fieldTranslatedTitle) <> '') then
      film_o_serieName := GetField(fieldTranslatedTitle)          // get film_o_serie name
   else
      film_o_serieName := GetField(fieldOriginalTitle);           // get film_o_serie name
   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;
//------------------------------------------------------------------------------
//  start here
//------------------------------------------------------------------------------                                             
begin
      if not CheckVersion(4,2,1) 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.
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

Thanks; I changed the version to 1.2.1 though
otreux
Posts: 194
Joined: 2008-10-22 16:55:46

Post by otreux »

"This script requires a newer version of Ant Movie Catalog (at least the version 4.2.1"

I don't want install a beta version of AMC for use this script :(
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

otreux wrote:"This script requires a newer version of Ant Movie Catalog (at least the version 4.2.1"

I don't want install a beta version of AMC for use this script :(
mi spiace ma solo nella beta 4.2.1. esiste la possibilità di gestire gli https\\
:ha:

Sorry but only AMC 4.2.1. uses https.
:ha:
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Post by antp »

otreux wrote: I don't want install a beta version of AMC for use this script :(
It is used by so many people since long time, it can be considered as stable :D
otreux
Posts: 194
Joined: 2008-10-22 16:55:46

Post by otreux »

antp wrote:
otreux wrote: I don't want install a beta version of AMC for use this script :(
It is used by so many people since long time, it can be considered as stable :D
ohhhh...ok, good news, thanks ;)
fulvio53s03
Posts: 764
Joined: 2007-04-28 05:46:43
Location: Italy

Post by fulvio53s03 »

mrobama wrote:Little fixes, please try now......
Apprezzo la variazione relativa alla ricerca tramite titolo originale se il titolo tradotto è vuoto.
Le altre modifiche (non aggiornare campi con altre informazioni vuote) temo siano pleonastiche: già nelle opzioni di esecuzione (in alto a destra nella videata di esecuzione dello script) si contempla la possibilità di aggiornare o non aggiornare con campi vuoti: nei prossimi aggiornamenti dello script, quindi, eliminerò tali verifiche.
Sto lavorando sulla compatibilità nelle ricerche con indirizzi http e/o https: ogni aiuto sarà gradito.

:)
I appreciate the change to "Search using original title" if "translated title" is empty.
Other changes (don't update fields with other information if empty) I fear are pleonastic: already in the run options (top right of the screen execution script) you contemplate the possibility to update or not to update with empty fields: in future script updates, therefore, I will delete these tests.
I'm working on compatibility with addresses in searches http and/or https: any help is appreciated.

P.S. http & https OK!
Last edited by fulvio53s03 on 2017-01-05 16:16:49, edited 1 time in total.
Post Reply