[UPD ITA] Comicsbox

New scripts, templates and translation files that allows to use Ant Movie Catalog to manage other things than movies
Post Reply
fulvio53s03
Posts: 745
Joined: 2007-04-28 05:46:43
Location: Italy

[UPD ITA] Comicsbox

Post by fulvio53s03 »

Script update.
Lo script consente di estrarre informazioni riguardanti molti informazioni su fumetti anche internazionali.
Poichè esso estrae da una lista che deve essere già presente nel D.B. Ant Movie Catalog, per un suo corretto utilizzo si deve:
- Eseguire preventivamente una ricerca su https://www.comicsbox.it/
- individuare l'estensione URL della serie interessata. es. ZAGOR da https://www.comicsbox.it/serie/ZAGOR
- creare una tabella .xls (1 riga per ogni fumetto da estrarre) 3 colonne per ogni riga:
- numero (necessario per l'estrazione informazioni)
- serie (necessario per l'estrazione informazioni)
- titolo originale (necessario per il nome della serie).
- salvare la tabella come .csv per importarla con AMC

Tutti i contributi migliorativi sono bene accetti!

The script allows you to extract information about many comics, including international comics.
Since it extracts from a list that must already be present in the D.B. Ant Movie Catalog, for its correct use you must:
- Perform a search in advance on https://www.comicsbox.it/
- identify the URL extension of the interested series. eg. ZAGOR from https://www.comicsbox.it/serie/ZAGOR
- create an .xls table (1 row for each comic to be extracted) 3 columns for each row:
- number (required for information extraction)
- series (required for information extraction)
- original title (needed for series name)
- - save the table as .csv to import it using AMC

All contributions for improvement are welcome!

Code: Select all

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

Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/

[Infos]
Authors=Italian_AMC
Title=COMICSBOX
Description=estrae fumetti
Site=
Language=IT
Version=1.0
Requires=4.2.1
Comments=puo' essere usato per estrarre direttamente da Comicsbox.
License=*  The source code of the script can be used in   |*  another program only if full credits to Italian_AMC*
GetInfo=1
RequiresMovies=1

[Options]

[Parameters]

***************************************************)

program COMICSBOX;
uses
  ItalianSharedPas;   // Script needs external unit StringUtils1.pas in scripts folder !
const
  UrlSite = 'https://www.comicsbox.it/';
  debug_search = false;                                   	// debug mode on/off su ricerca dischi
  folder = 'f:\prova\';                                   		// directory where to save files
  apice  = #39;
  CRLF1 = 'xxx yyy zzz';
var
  ComicURL, MediaType: string;   // Define some script variables
//  UrlSite: String;
  chars_to_delete, tappo_fine_ricerca: string;
  Page, Pagestr, save_page, pag_ricerca, value : string;
  serie, low_serie: string;
  save_attori, save_autori, sinossi, save_sinossi: string;
  InitChar, EndChar, CharAbNormal, CharNormal : String;
  posizione_sinossi, lunghezza:   integer;
  charCut, StartDelimiter, endDelimiter, startdelete, enddelete : string;
  LgthPage, length_all_episodi, pos_CRLF: integer;

  StartPos, EndPos: integer;

  distanzia_episodi, pulisci_episodi : string;
  numero_episodi, length_value_puliti: integer;

  film_o_serieok: boolean;
  file_name, film_o_serieName: string;

Procedure NormalizePage;
begin
  CharAbNormal := 'Soggetto e Sceneggiatura:';
  CharNormal := 'Soggetto e sceneggiatura:';
  Pagestr := StringReplace(Pagestr, CharAbNormal, CharNormal);
  CharAbNormal := '<B';
  CharNormal := '<b';
  Pagestr := StringReplace(Pagestr, CharAbNormal, CharNormal);
  CharAbNormal := '</B';
  CharNormal := '</b';
  Pagestr := StringReplace(Pagestr, CharAbNormal, CharNormal);
  CharAbNormal := '<DIV ';
  CharNormal := '<div ';
  Pagestr := StringReplace(Pagestr, CharAbNormal, CharNormal);
  CharAbNormal := '</DIV>';
  CharNormal := '</div>';
  Pagestr := StringReplace(Pagestr, CharAbNormal, CharNormal);
end;

// ***** Analyze Item's Page *****
procedure AnalyzePageAlbo(URL: String);
var
  Titolo, Descr_Img: string;
  Attori, Autori, attori_puliti, sinossi_puliti, copertina, desc_edizione, sorgente: string;
  editore, periodo: string;

begin
  film_o_serieok := True;
  Page := GetPage(URL);   				// Fetch source code from website and store inside "Page"
  if debug_search then
     DumpPage(folder+'1 ComicsboxOriginal_Page.text', Page);  
  
//  HTMLdecode(Page);                                                             //spostato il 2023-05-22
  Page := UTF16ToCP1252(Page);

  startdelimiter := '<div class="linea_alboita"></div>';                         //2023-05-22
	enddelimiter   := '<div style="width:100%" class="alboita_right">';            //2023-05-22
  charcut := TextBetween(Page, startdelimiter, enddelimiter);                    //2023-05-22
  charcut := startdelimiter + charcut + enddelimiter;                            //2023-05-22
  page := StringReplace(page, charcut, (' ' + CRLF + 'zzzmxptlkzzz'));
//
  startdelimiter := '<div class="linea_alboita"></div>';                         //2023-05-25
	enddelimiter   := '<div class="alboita_left">';                                //2023-05-25
  charcut := TextBetween(Page, startdelimiter, enddelimiter);                    //2023-05-25
  charcut := startdelimiter + charcut + enddelimiter;                            //2023-05-25
  page := StringReplace(page, charcut, (' ' + CRLF + 'zzzmxptlkzzz'));

  HTMLdecode(Page);

  pagestr := page;
  save_page := page;
  if pos('<meta name="title" content="Errore 404 - Pagina non trovata"', pagestr) > 1 then
     begin
       ShowMessage('fumetto non esistente - verificare serie e numero ' + CRLF + film_o_seriename + CRLF + URL);
       exit;
     end
  NormalizePage;
  if debug_search  then
     DumpPage(folder+'2 ComicsboxPageDetail.text', Pagestr);                         // debug_film_o_serie// Data di aggiornamento
  SetField(fieldDate, DateToStr(Date));
  SetField(fieldURL, URL);

  startDelimiter := '<div style="width:100%" class="alboita_right">';
  endDelimiter := '<div style="width:100%" class="alboita_right">';                  //questo dice quanti racconti/episodi ci sono nel volume
  value := TextBetween(Pagestr, startdelimiter, enddelimiter);
  value := removespaces(value,True);                                        // cancella spazi tra ><
  value := StringReplace(value, '<span class="nome">', (CRLF + '<span class="nome">'));
  HTMLDecode(value);                            // Clean HTML codes (if some exist)

// ********************* inizio estrazione dati **************************
  startDelimiter := '<div class="albinpd">';
  endDelimiter := '</div>';
  sorgente := Textbetween(pagestr, startDelimiter, endDelimiter);
  startDelimiter := '<span id="editore_issue">';
  endDelimiter := '</span>';
  editore := Textbetween(sorgente, startDelimiter, endDelimiter);
  startDelimiter := '<span style="border:0" id="data_issue">';
  endDelimiter := '</span>';
  periodo := Textbetween(sorgente, startDelimiter, endDelimiter);
  sorgente := periodo + ' - ' + editore;
//  HTMLRemoveTags(sorgente);
//  HTMLDecode(sorgente);
  sorgente := fulltrim(sorgente);
  setfield(fieldsource, sorgente);

  startDelimiter := '<span id="subtitolo_issue">';
  endDelimiter := '</span>';
  titolo := Textbetween(pagestr, startDelimiter, endDelimiter);

  titolo := stringreplace(titolo, ' |', '');
  chars_to_delete := startDelimiter + titolo + endDelimiter;
  HTMLRemoveTags(Titolo);
  value := Titolo;
  Titolo := fulltrim(value);
  setfield(fieldtranslatedtitle, Titolo);
  value := stringreplace(value, chars_to_delete, '');

//estrazione  autori (per campo fieldactors)
  startDelimiter := '<div id="maintext_albo">';                                       //autori
  endDelimiter := '<div class="sinossi">';
  attori := startDelimiter + Textbetween(pagestr, startDelimiter, endDelimiter);
  if attori = startdelimiter then
     attori := '';
  attori_puliti := stringReplace(attori, CRLF, '');
  lunghezza := length(attori_puliti);
//  if lunghezza <> 0   then                                               //2023-06-05
//     begin;                                                              //2023-06-05
      startDelimiter := '<a href="';                                       //autori
      endDelimiter := '</div>';
      attori := startDelimiter + Textbetween(attori, startDelimiter, endDelimiter) + enddelimiter;
      attori := stringreplace(attori, ' <br />', CRLF);
      HTMLRemoveTags(attori);
      attori := fulltrim(attori);
      startDelimiter := '<div id="col-left-albo">';
      endDelimiter := '<div id="altre_versioni">';
      value := startDelimiter + textbetween(Pagestr, startdelimiter, enddelimiter);
      startDelimiter := '<div id="cover_autore">';
      endDelimiter := '</div>';
      autori := textBetween(value, startdelimiter, enddelimiter);
      save_autori := autori;
      HTMLRemoveTags(save_autori);
      attori := attori + CRLF + save_autori;
      startDelimiter := '<div id="note_ita" class="nonemobile">';       //altre edizioni e descrizione
      endDelimiter := '<div id="altre_versioni">';
      desc_edizione := textBetween(pagestr, startdelimiter, enddelimiter);
      HTMLRemoveTags(desc_edizione);
      save_attori := attori;
      attori := attori + CRLF + desc_edizione;
      value := attori;
      attori := value;
//     end;                                                                //2023-06-05
  if debug_search  then
     DumpPage(folder+'ComicsboxAttori.html', attori);
  attori := fulltrim(attori) + ' ';
  pos_CRLF := pos(CRLF, attori);
  if pos_CRLF = 0 then                           //2023-06-04
     attori := copy(attori, 1, Length(attori) - 1);
  value := attori;
  pulisci_CRLF(value);                            //2023-06-05 pulisce CRLF finali
  attori := value;                                //2023-06-05 pulisce CRLF finali
  attori := fulltrim(attori);
  setfield(fieldactors, attori);
// fine estrazione  autori (per campo fieldactors)        //2023-06-04

// estrazione copertina
  startDelimiter := 'container_cover_cb';
  endDelimiter := '</a>';
  copertina := textbetween(Pagestr, startdelimiter, enddelimiter);
  startDelimiter := '<img src="/';
  endDelimiter := '"';
  copertina := textbetween(copertina, startdelimiter, enddelimiter);
  copertina := urlsite + copertina;
  GetPicture(copertina);

//******************************** inizio estrazione filddesc(trama) da pagestr ******************
  startDelimiter := '<div id="col-left-albo">';
  endDelimiter := '<div id="altre_versioni">';                                        //2023-06-01 endDelimiter := '</div>';
  sinossi := textbetween(Pagestr, startdelimiter, enddelimiter) + endDelimiter;       //2023-06-01
  sinossi := fulltrim(sinossi);                               //2023-06-01
  if debug_search  then
     DumpPage(folder+'ComicsboxSinossi.html', sinossi);
  if sinossi = '' then
    begin
    startDelimiter := '<div id ="funzioni_albo">';
    endDelimiter := '<div id="altre_versioni">';                //2023-06-01 endDelimiter := '<!-- Commenti -->';
    sinossi := textbetween(Pagestr, startdelimiter, enddelimiter) + endDelimiter;
    startDelimiter := '<div id="maintext_albo">';
    endDelimiter := '<!-- Commenti -->';
    sinossi := textbetween(sinossi, startdelimiter, enddelimiter);
    sinossi := fulltrim(sinossi);
    end
  if debug_search  then
     DumpPage(folder+'2b ComicsboxSinossi.html', sinossi);                         // debug_film_o_serie// Data di aggiornamento

//-------------------------
  startdelimiter := '<script';
  enddelimiter   := '</script>';
  chars_to_delete := startdelimiter + textbetween(sinossi, startdelimiter, enddelimiter) + enddelimiter;   //2023-06-02
  sinossi := StringReplace(sinossi, chars_to_delete, '');                                   //2023-06-02

  startdelimiter := '</span>';
  enddelimiter   := 'class="nonemobile">';
  chars_to_delete := startdelimiter + textbetween(sinossi, startdelimiter, enddelimiter) + enddelimiter;   //2023-06-02
  sinossi := StringReplace(sinossi, chars_to_delete, '');                                   //2023-06-02
//-------------------------

  sinossi := StringReplace(sinossi, '<p>', ('<p>' + CRLF));
//  HTMLRemoveTags(sinossi);                    //2023-06-02

  sinossi := stringReplace(sinossi, '<em>Ristampa:</em>', (CRLF + '<em>Ristampa:</em>'));   //2023-05-25
  startdelimiter := '<div class="addthis_inline_share_toolbox">';                           //2023-06-01
  enddelimiter := '<div id="descrizione_ita" class="nonemobile">';                          //2023-06-01
  chars_to_delete := startdelimiter + textbetween(sinossi, startdelimiter, enddelimiter) + enddelimiter;   //2023-06-01
  sinossi := StringReplace(sinossi, chars_to_delete, '');;      //2023-06-01
  if debug_search  then
     DumpPage(folder+'2b ComicsboxPageDetail.text', value);                         // debug_film_o_serie// Data di aggiornamento

  startDelimiter := '<span style';    //2023-06-01
  endDelimiter := '">';              //2023-06-01
  chars_to_delete := startdelimiter + textbetween(sinossi, startdelimiter, enddelimiter) + enddelimiter;      //2023-06-01
  sinossi := StringReplace(sinossi, chars_to_delete, '');                              //2023-06-01

  HTMLRemoveTags(sinossi);
  save_sinossi:= sinossi;                             //20223-05-25 sinossi

//  startDelimiter := '<span style';
//  endDelimiter := '">';
//  chars_to_delete := startdelimiter + textbetween(sinossi, startdelimiter, enddelimiter) + enddelimiter;
//  sinossi := StringReplace(sinossi, chars_to_delete, '');
  sinossi := stringreplace(sinossi, (CRLF + ' '), CRLF);
  HTMLdecode(sinossi);
  
  sinossi := StringReplace(sinossi, '<br />', CRLF);
  sinossi := StringReplace(sinossi, '<br>', CRLF);
  sinossi := StringReplace(sinossi, '<div>', '');
  sinossi := StringReplace(sinossi, '</span>', '');
  sinossi := StringReplace(sinossi, '</p>', '');
  sinossi := StringReplace(sinossi, '<p class="MsoNormal">', '');
  sinossi := StringReplace(sinossi, '<strong>', '');
  sinossi := StringReplace(sinossi, '</strong>', '');
  sinossi := stringreplace(sinossi, 'zzzmxptlkzzz', '');               //2023-06-01
  sinossi := stringreplace(sinossi, 'vinsanto', '  -  ');                   //2023-06-05
  save_sinossi := sinossi;
  value := sinossi;
  pulisci_CRLF(value);                                                 //2023-06-04 pulisce CRLF finali
  sinossi := value;
  setfield(fieldcomments, sinossi);
//********************************** fine estrazione filddesc(trama) da pagestr ******************

// ********************* inizio creazione commenti estesi ***********************
  estrai_commenti(value);
  if debug_search then
     DumpPage(folder+ '+++ fielddescription.html', value);               // debug
  posizione_sinossi := pos(save_sinossi, value);
//  if pos(value) =
  value := stringreplace(value, 'zzzmxptlkzzz', '');                  //2022-05-22
  value := stringreplace(value, 'vinsanto', '  -  ');                      //2023-06-05
  value := StringReplace(value, 'Prima pubblicazione', (CRLF + 'Prima pubblicazione'));                              //2023-06-07
  value := StringReplace(value, 'Ristampa', (CRLF + 'Ristampa'));                              //2023-06-07
//2023-06-07  value := StringReplace(value, 'paginePrima', ('pagine' + CRLF  + 'Prima'));                              //2023-06-07
  pulisci_CRLF(value);                            //2023-06-04 pulisce CRLF finali
  setfield(fielddescription, value);                                     //scrivi campo commenti
// ********************* fine   creazione commenti estesi ***********************
end;

function estrai_commenti(str: string): string; 					//************* estrai commenti **************
var
  sub_episodio, pulisci_episodio, salta_riga: string;               //estrazione dato per singolo episodio contenuto
  episodi: string;                    //campo fieldsize
  episodi_completi: string;           //accumulo dati per descrizione
  debug_giri, lgth_value: integer;
  lgth_pulisci_episodio: integer;
begin
  length_all_episodi := length(Pagestr);
//2023/06/04  distanzia_episodi :=('<div style="width:100%" class="alboita_right">');
  distanzia_episodi := ('<span class="titolo_storia">');                    //2023/06/04 riconta storie contenute
  numero_episodi := length(distanzia_episodi);
  pulisci_episodi := stringreplace(Pagestr, distanzia_episodi, '');
  length_value_puliti := length (pagestr) - length(pulisci_episodi);
  numero_episodi := length_value_puliti div numero_episodi;               		//per sapere quanti episodi contenuti.
  if numero_episodi = 1 then
      episodi := IntToStr(numero_episodi) + ' storia'
  else begin
      episodi := IntToStr(numero_episodi) + ' storie'
  end;
  SetField(fieldSize, episodi);                                               //numero episodi contenuti

  value := '';
  lgth_value := 0;
  lgth_pulisci_episodio := 0;
  initchar := '<div id="maintext_albo">';
  endchar := '<!-- Commenti -->';
  tappo_fine_ricerca := '<div class="alboita_dettagli">';
  value := FullTrim(TextBetween(Pagestr, initchar, endchar));        //tutti gli episodi contenuti nell'albo
  value := value + tappo_fine_ricerca;
  lgth_value := length(value);
  if debug_search then
      DumpPage(folder+ '$$$ episodi.html', value);                // debug
//tutti gli episodi + tappo fine ricerca

  debug_giri := 0;
  initchar := '<div class="alboita_dettagli">';
  endchar  := '<div class="alboita_dettagli">';

  episodi_completi := '';
  sub_episodio := TextBetween(value, initchar, endchar);
  if debug_search then
     DumpPage(folder+ '$$$ episodio 1.html', sub_episodio);       // debug
  pulisci_episodio := initchar + sub_episodio;
  lgth_value := length(value);
  value := StringReplace(value, pulisci_episodio, '');                //il primo è già estratto
  lgth_value := length(value);
//  if debug_search then
//     DumpPage(folder+ '$$$ episodi 2 e seguito.html', value);               //debug
   numero_episodi := numero_episodi;                                          //debug
// ****************** qui  estrarre e cumulare i dati
//  while sub_episodio <> '' do
  while debug_giri <= numero_episodi do                      //2023-06-05
  begin
    debug_giri := debug_giri + 1;
//  trattamento del sub episodio
//    pulisci_episodio :=  tappo_fine_ricerca + sub_episodio;
//    pulisci_episodio := sub_episodio;
    lgth_pulisci_episodio := length(pulisci_episodio);
    sub_episodio := fulltrim(sub_episodio);
    sub_episodio := stringReplace(sub_episodio, ('<br />' + CRLF), 'vinsanto');
    sub_episodio := stringReplace(sub_episodio, '<br /><span class="titolo_storia"><strong>', '  - zibibbo -');
    sub_episodio := stringReplace(sub_episodio, '<br /><a href="/autore/', (CRLF + '<br /><a href="/autore/'));         //2023-05-20 AUTORI
    sub_episodio := stringReplace(sub_episodio, '<em>protagonisti:</em>', (CRLF + '<em>protagonisti:</em>'));
    sub_episodio := stringReplace(sub_episodio, '<div class="sinossi">', (CRLF + '<div class="sinossi">'));
//2023-06-07    sub_episodio := stringReplace(sub_episodio, '<div class="pages">', ('<div class="pages">' + CRLF));
    sub_episodio := stringReplace(sub_episodio, '<div class="pages">', ('<div class="pages">' + '  -- '));                 //2023-06-07
    sub_episodio := stringReplace(sub_episodio, (CRLF + '<div>'), '<div>');
    sub_episodio := stringReplace(sub_episodio, '<em>Ristampa:</em>', (CRLF + '<em>Ristampa:</em>'));

    if  debug_giri > 1 then
        sub_episodio := stringReplace(sub_episodio, '<br /><span class="titolo_storia">',
                     (CRLF + '<br /><span class="titolo_storia">'));        //impone riga vuota per episodi successivi al 1
    HTMLRemoveTags(sub_episodio);
//  fine riformattazione **************************************

    episodi_completi := episodi_completi + sub_episodio;
//  proseguo la ricerca di altri sub episodi
    sub_episodio := TextBetween(value, initchar, endchar) + endchar;                 //2023-06-05 pomeriggio
    pulisci_episodio := sub_episodio;
    value := StringReplace(value, pulisci_episodio, '');    //2023-05-20
    lgth_value := length(value);

//    if debug_search then
//      DumpPage(folder+ '$$$ episodi 3 e seguito.html', sub_episodio);                // debug
  end;
//  ****************** fine estrarre e cumulare i dati

// ********************* fine   creazione commenti estesi ***********************
  episodi_completi := episodi_completi + sub_episodio;
  episodi_completi := stringReplace(episodi_completi, (CRLF + CRLF), CRLF);
  episodi_completi := stringReplace(episodi_completi, endchar, '');
  value := fulltrim(episodi_completi);
end;

function pulisci_CRLF(str: string):string;
begin
  lunghezza := length(str);
  pos_CRLF := lunghezza;
  str := str + ' ';                    //2023-06-04 aggiungo tappo per non perdere l'ultimo carattere (https://www.comicsbox.it/albo/DYDGMAG_004)
  while (pos_CRLF = lunghezza) and (lunghezza <>0)  do
    begin
    str := copy(str, 1, Length(str) - 1);
    str := fullTrim(str);
    lunghezza := length(str);
    pos_CRLF := pos(CRLF, str);
  end
  value := str;
end;

function UTF16ToCP1252(str: string):string;
begin
  str := StringReplace(str, (chr(195) + chr(162) + chr(194) + chr(128) + chr(194)), (chr(226) + chr(128)));
  str := StringReplace(str, (chr(226) + chr(128) + chr(128)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(129)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(130)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(131)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(132)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(133)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(134)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(135)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(136)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(137)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(138)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(144)), '-');
  str := StringReplace(str, (chr(226) + chr(128) + chr(145)), '-');
  str := StringReplace(str, (chr(226) + chr(128) + chr(146)), '-');
  str := StringReplace(str, (chr(226) + chr(128) + chr(147)), '–');
  str := StringReplace(str, (chr(226) + chr(128) + chr(148)), '—');
  str := StringReplace(str, (chr(226) + chr(128) + chr(149)), '-');
  str := StringReplace(str, (chr(226) + chr(128) + chr(150)), '|');
  str := StringReplace(str, (chr(226) + chr(128) + chr(151)), '=');
  str := StringReplace(str, (chr(226) + chr(128) + chr(152)), '‘');
  str := StringReplace(str, (chr(226) + chr(128) + chr(153)), '’');
  str := StringReplace(str, (chr(226) + chr(128) + chr(154)), '‚');
  str := StringReplace(str, (chr(226) + chr(128) + chr(155)), '''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(156)), '“');
  str := StringReplace(str, (chr(226) + chr(128) + chr(157)), '”');
  str := StringReplace(str, (chr(226) + chr(128) + chr(158)), '„');
  str := StringReplace(str, (chr(226) + chr(128) + chr(159)), '"');
  str := StringReplace(str, (chr(226) + chr(128) + chr(160)), '†');
  str := StringReplace(str, (chr(226) + chr(128) + chr(161)), '‡');
  str := StringReplace(str, (chr(226) + chr(128) + chr(162)), '•');
  str := StringReplace(str, (chr(226) + chr(128) + chr(163)), '>');
  str := StringReplace(str, (chr(226) + chr(128) + chr(164)), '.');
  str := StringReplace(str, (chr(226) + chr(128) + chr(165)), '..');
  str := StringReplace(str, (chr(226) + chr(128) + chr(166)), '...');
  str := StringReplace(str, (chr(226) + chr(128) + chr(167)), '·');
  str := StringReplace(str, (chr(226) + chr(128) + chr(175)), ' ');
  str := StringReplace(str, (chr(226) + chr(128) + chr(176)), '‰');
  str := StringReplace(str, (chr(226) + chr(128) + chr(177)), '‰');
  str := StringReplace(str, (chr(226) + chr(128) + chr(178)), '''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(179)), '''''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(180)), '''''''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(181)), '''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(182)), '''''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(183)), '''''''');
  str := StringReplace(str, (chr(226) + chr(128) + chr(184)), '^');
  str := StringReplace(str, (chr(226) + chr(128) + chr(185)), '‹');
  str := StringReplace(str, (chr(226) + chr(128) + chr(186)), '›');
  str := StringReplace(str, (chr(226) + chr(128) + chr(187)), 'x');
  str := StringReplace(str, (chr(226) + chr(128) + chr(188)), '!!');
  str := StringReplace(str, (chr(226) + chr(128) + chr(189)), '!?');
  str := StringReplace(str, (chr(226) + chr(189)), 'fgfgfg');
  str := StringReplace(str, (chr(226) + chr(128) + chr(190)), '-');
  result := SharedUnknownToCP1252Decode(str);     
end;


//------------------------------------------------------------------------------
// process batch mode                        da sergiobonelli.it
//------------------------------------------------------------------------------
procedure ComicsboxBatch;
var
   Address, album, albumtest, genre, num_albo, old_num: String;

begin
   file_name:= getField(fieldMediaType);
   num_albo := getfield(fieldMedia);
   old_num := num_albo;
   film_o_seriename := getfield(fieldMediaType);
   if length(old_num) = 1
      then old_num := '0' +old_num;
   if length(old_num) = 2
      then old_num := '0' + old_num;
   film_o_seriename := film_o_seriename + '_' + old_num;
   if num_albo <> old_num
      then setfield(fieldmedia, old_num);

   low_serie := getField(fieldOriginalTitle);
   low_serie := AnsiLowerCase(low_serie);
   if low_serie = ''
      then
        begin
        low_serie := getfield(fieldMediatype);
        ricrea_titolo_otiginale;
        end
   Address := 'https://www.comicsbox.it/' + 'albo/' + film_o_serieName;
   if Address <> '' then
      AnalyzePageAlbo(Address)
   else
      ShowMessage('fumetto non esistente - serie e numero');
   Address := UrlEncode(Address);
   Page := GetPage(Address);
//   Save_address := Address;
   SetField(fieldURL, Address);
   if debug_search then
      DumpPage(folder+'4 Original_Page.text', Page);                // debug
   HTMLdecode(Page);
   if debug_search then
      DumpPage(folder+'5 Translated_Page.text', Page);                // debug

end;

procedure ricrea_titolo_otiginale;
begin
   low_serie := AnsiLowerCase(low_serie);
   if low_serie = 'storwestce'
      then setfield(fieldoriginaltitle, 'Storia del West');
   if low_serie = 'texwiller'
      then setfield(fieldoriginaltitle, 'Tex Willer (le origini)');
   if low_serie = 'orfani6_b'
      then setfield(fieldoriginaltitle, 'Orfani - Sam');
   if low_serie = 'colrodeo'
      then setfield(fieldoriginaltitle, 'Collana Rodeo');          //MAXIMARMY
   if low_serie = 'maximarmy'
      then setfield(fieldoriginaltitle, 'Martin Mystére Maxi');          //MAXIMARMY
end;

//------------------------------------------------------------------------------
// process normal mode                          da sergiobonelli.it
//------------------------------------------------------------------------------
procedure ComicsboxNorm;
begin
   file_name:= getField(fieldMediaType);
   film_o_seriename := getfield(fieldMediaType) + '_' + getfield(fieldMedia);
   repeat GetList;
      until film_o_serieok;

end;
//------------------------------------------------------------------------------

// ***** Beginning of the script *****
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;
      ComicsboxBatch;
end.
Enjoy! ;)
Post Reply