Page 3 of 3

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 05:18:29
by fulvio53s03
Posta anche le videate dei due film che non sono stati rinominati.
:)

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 05:50:31
by otreux

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 07:28:28
by antp
For the accents problem, this line should be added at the beginning of the batch:

Code: Select all

chcp 1252
this will tell it to use the Windows European character set instead of the legacy DOS European character set.

The other one causing problem is when both titles are identical, no alternative title should be put in [ ], that should be easy to test.

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 09:47:09
by fulvio53s03
Riprenderò questa sera.
I"ll take s look this evening.

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 16:53:03
by fulvio53s03
fulvio53s03 wrote: 2018-04-29 09:47:09 Riprenderò questa sera.
I"ll take s look this evening.
Seguendo i suggerimenti sono giunto a queste modifiche:
Se trovi ancora errori, ricordati di pubblicare gli screenshot ed i percorsi completi dei file.

Following suggestions I got this code:
if you find new errors, please post screenshots and full path of files.

Code: Select all

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

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

[Infos]
Authors=Fulvio53s03
Title=rename file from catalog
Description=rename File
Site=
Language=IT
Version=1.4
Requires=4.2
Comments=Questo script rinome i file name nelle cartelle usando alcuni campi del d.b.. Ovviamente.... state attenti ed esaminate prima il file .bat prodotto.
License=GPL
GetInfo=0
RequiresMovies=1

[Options]

[Parameters]

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

program RenameFilm;
uses
  StringUtils1;
var
  DupList: TStringList;
  Indirizzo_cartelle, ResultPath, ext_file, Comando_rinomina, titolo_originale: string;
  percorso_file, titolo_tradotto, numero_rec, anno_film: string;
  Giri, giri_fatti, rec_variati, lgth_path, Posbar: integer;

procedure Elaborazione;
begin
	percorso_file := getField(fieldFilePath);
	indirizzo_cartelle := percorso_file;
	lgth_path := length(percorso_file);
	ext_file  := copy(percorso_file, (lgth_path - 3), 4);
	titolo_tradotto := getField(fieldTranslatedTitle);
	titolo_originale := getField(fieldOriginalTitle);
	numero_rec := getfield(fieldNumber);
	anno_film  := getfield(fieldyear);
	if length(numero_rec) = 1  then numero_rec := '000' + numero_rec;
	if length(numero_rec) = 2  then numero_rec := '00' + numero_rec;
	if length(numero_rec) = 3  then numero_rec := '0' + numero_rec;
	Posbar := AnsiLastPosEx('\', percorso_file, true, true);
	if  posbar > 0 then
      indirizzo_cartelle := copy(indirizzo_cartelle, 1, posbar);
  Comando_rinomina := 'move "' + indirizzo_cartelle;
  Comando_rinomina := Comando_rinomina + '[' + numero_rec + '] ';
  if   (titolo_originale = titolo_tradotto) or (titolo_originale = '') then
       titolo_originale := ' '
  else
       titolo_originale := ' [' + titolo_originale + '] ';
  Comando_rinomina := Comando_rinomina + titolo_tradotto + titolo_originale + anno_film + ext_file + '"';
  Comando_rinomina := Comando_rinomina +  '     "' + percorso_file + '"';
  if rec_variati = 0 then
     DupList.Add('chcp 1252');
  rec_variati := Rec_variati + 1;
  DupList.Add(Comando_rinomina);        //scrivi riga
end;
//
//MAIN PROGRAM
//
begin
  if StringUtils1_Version < 3 then
  begin
    ShowMessage('File "stringutils1.pas" is too old, please download a new version of it');
    Error;
  end;
  if ResultPath = '' then
    begin
    ResultPath := 'f:\prova\rename.bat.txt';
    Input('Update/Aggiorna Films', 'Store results to: / Salva Risultati in: ', ResultPath);
    giri := GetiterationCount;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       rec_variati := 0;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Comando_rinomina := 'pause';
       DupList.Add(Comando_rinomina);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.

Re: Terrible! a script has renamed all my movies files ! :(

Posted: 2018-04-29 21:44:10
by otreux
FANTASTICO, lo script funziona perfettamente. Con un po' di paura l'ho usato su tutto il drive e ha rinominato tutto perfettamente. Grazie infinite Fulvio (e antp) per l'aiuto che mi avete dato :clapping: :clapping: :clapping:

FANTASTIC, the script works perfectly. With a little fear I used it all over the drive and renamed everything perfectly. Many thanks to Fulvio (and antp) for the help you gave me :clapping: :clapping: :clapping: