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

If you need help on how to use the program
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

Grazie ma continua a non crearmi il file :(
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

otreux wrote: 2018-04-27 11:10:25 Grazie ma continua a non crearmi il file :(
Riprovo e propongo nuovamente lo script (ex-novo), dopo averlo verificato direttamente! Da me funziona, occhio al nome del file .bat, da adattare alle tue esigenze.
Se non funziona, a questo punto ..... :shaking: :shocked: :wow:

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.1
Requires=4.2
Comments=this Script will Rename your movies' file names with informations contained in field File Path (substituting file Name contained in translated title). Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1

[Options]

[Parameters]

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

program RenameFilm;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  ResultPath, titlenew: string;
  New_filename, old_filename: string;
  Giri, giri_fatti, lgth_path: integer;

procedure Elaborazione;
begin
	new_filename := getField(fieldFilePath);
	old_filename := getField(fieldTranslatedTitle);
  Titlenew := 'ren "' + old_filename + '"     ' + new_filename + '"';
  DupList.Add(Titlenew);        //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 MovList = nil then
       MovList := TStringList.Create;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Titlenew := 'pause';
       DupList.Add(Titlenew);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

una buona notizia, il file bat viene creato :)
L'ho provato solo su un archivio ridotto per prova ma tutti i film che scanna mi da questo errore:

F:\prova>ren "L'altro lato del letto" H:\- DONNE\Vega Paz\2002 - L'altro lato del letto.avi"
Sintassi del comando errata.

Il file, in questo caso, si chiama:

[0277] L'altro lato del letto [El otro lado de la cama] 2002


good news, the bat file is created :)
I tried it only on an archive reduced for proof but all the films that scanna gives me this error:

F:\prova>ren "L'altro lato del letto" H:\- DONNE\Vega Paz\2002 - L'altro lato del letto.avi"
Syntax of the wrong command.

The file, in this case, is called:

[0277] The other side of the bed [El otro lado de la cama] 2002
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

il problema credo sia più complicato perché il file .bat tenta di rinominare un file che crede che si chiami "L'altro lato del letto". In realtà il file si chiama "[0277] L'altro lato del letto [El otro lado de la cama] 2002". Quindi non trova il file :(

I think the problem is more complicated because the .bat file tries to rename a file that thinks it's called "L'altro lato del letto". Actually the file is called "[0277] The other side of the bed [El otro lado de la cama] 2002". So it does not find the file :(
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

otreux wrote: 2018-04-27 17:04:06 il problema credo sia più complicato perché il file .bat tenta di rinominare un file che crede che si chiami "L'altro lato del letto". In realtà il file si chiama "[0277] L'altro lato del letto [El otro lado de la cama] 2002". Quindi non trova il file :(
new_filename := getField(fieldFilePath);
old_filename := getField(fieldTranslatedTitle);

Il comando è sintatticamente errato poichè manca un " all'inizio del nuovo file-name (ma questo è facilmente correggibile nello script).
lo script prende come nome attuale del file il contenuto del campo "titolo tradotto" e cerca di rinominarlo con quel che trova nel "campo ubicazione" (questo è quanto ho capito di dover fare secondo la tua descrizione).
quel "[0277] L'altro lato del letto [El otro lado de la cama] 2002" è contenuto in qualche campo del D.B.? Se non c'è in nessun campo o combinazione di campo..... siamo in braghe di tela!
per favore, pubblica uno screenshot del d.b. contenente quel film altrimenti non riesco a cercare una soluzione.
:(
Last edited by fulvio53s03 on 2018-04-27 20:15:48, edited 1 time in total.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

Ti posto lo screenshot

https://postimg.cc/image/7s69q45jr/

il mio archivio AMC non è stato cambiato dalla script. Lo script ha solo preso delle info presenti in alcuni campi e le ha immesse nel nome del file rinominandolo.

my AMC archive has not been changed by the script. The script only took the info in some fields and entered them in the file name renaming it.


La vedo dura :ha:
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

prova con questo:

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.2
Requires=4.2
Comments=this Script will Rename your movies' file names with informations contained in field File Path (substituting file Name contained in translated title). Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1

[Options]

[Parameters]

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

program RenameFilm;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  ResultPath, Titlenew, titolo_originale: string;
  New_filename, old_filename, numero_rec, anno_film: string;
  Giri, giri_fatti, lgth_path: integer;

procedure Elaborazione;
begin
	new_filename := getField(fieldFilePath);
	old_filename := 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;
  Titlenew := 'ren "[' + numero_rec + '] ' + old_filename + ' [' + titolo_originale + '] ' + anno_film + '"';
  Titlenew := titlenew +  '     "' + new_filename + '"';
  DupList.Add(Titlenew);        //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 MovList = nil then
       MovList := TStringList.Create;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Titlenew := 'pause';
       DupList.Add(Titlenew);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

F:\prova>ren "[0277] L'altro lato del letto [El otro lado de la cama] 2002" "H:\- DONNE\Vega Paz\2002 - L'altro lato del letto.avi"
Impossibile trovare il file specificato.

ma la cosa positiva è che adesso rileva il nome giusto. :D

but the positive thing is that it now finds the right name. :D

puo essere un problema che nel primo campo non c'è l'estensione e nel secondo si?
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

dai che ci siamo!
ATTENZIONE!
NON DEVI ASSOLUTAMENTE RINUMERARE IL D.B. ALTRIMENTI IL NUMERO D'ORDINE DEI VARI FILM PUO' CAMBIARE (E QUEL [0277] NON ESSERE PIU' CORRETTO)!

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.3
Requires=4.2
Comments=this Script will Rename your movies' file names with informations contained in field File Path (substituting file Name contained in translated title). Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1

[Options]

[Parameters]

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

program RenameFilm;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  ResultPath, ext_file, Titlenew, titolo_originale: string;
  New_filename, old_filename, numero_rec, anno_film: string;
  Giri, giri_fatti, lgth_path: integer;

procedure Elaborazione;
begin
	new_filename := getField(fieldFilePath);
	lgth_path := length(new_filename);
	ext_file  := copy(new_filename, (lgth_path - 3), 4);
	old_filename := 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;
  Titlenew := 'ren "[' + numero_rec + '] ' + old_filename + ' [' + titolo_originale + '] ' + anno_film + ext_file + '"';
  Titlenew := titlenew +  '     "' + new_filename + '"';
  DupList.Add(Titlenew);        //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 MovList = nil then
       MovList := TStringList.Create;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Titlenew := 'pause';
       DupList.Add(Titlenew);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

Non capisco perché ma mi dice ancora "Impossibile trovare il file specificato" :shaking:
Eppure i nomi sembrano giusti, tranne nel caso in cui il nome originale sia uguale a quello tradotto, in quel caso il vecchio script aveva rinominato lasciando solo uno dei due, ad esempio, il film che prima si chiamava "2004 - Dimmi di si.avi", il vecchio script lo ha rinominato in "[0276] Dimmi di si 2004.avi"

I do not understand why but it still tells me "Can not find the specified file": shaking:
Yet the names seem fair, except in the case where the original name is the same as the translated one, in which case the old script had renamed leaving only one of the two, for example, the film that was previously called "2004 - Tell me yes. avi ", the old script renamed it to" [0276] Tell me yes 2004.avi "
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

otreux wrote: 2018-04-28 09:21:34 Non capisco perché ma mi dice ancora "Impossibile trovare il file specificato" :shaking:
Il file .bat è nella stessa cartella del file da rinominare?
mentre il nuovo nome è completo di tutto il path (cartelle), quello vecchio non ce l'ha, per cui il file .bat deve stare nella stessa cartella.
:)
antp
Site Admin
Posts: 9714
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

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

Post by antp »

Indeed, but also, I'm not 100% sure that the "ren" commands accepts a full path: maybe the new name should only contain the file name (to be tested)
Otherwise if you may use "move" instead of "ren", as it can be used to "move a file to a new name", even if it stays in the same folder.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

Non va, ho messo il file bat sia in H:\ che in H:\- DONNE\Vega Paz
Oltretutto non potrei usare un file bat che deve essere nella stessa cartella dei file perché dovrei creare tantissimi file bat, uno per ogni cartella che contiene i film

No, I put the bat file in both H: \ and H: \ - DONNE \ Vega Paz but not luck
Besides, I could not use a bat file that must be in the same folder as the files because I would have to create a lot of bat files, one for each folder that contains the movies

:shocked:
antp
Site Admin
Posts: 9714
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

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

Post by antp »

Then the path of each file (already set for target file name) should also be added in front of the source file name.
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

Appena possibile aggiungerò il full path. :innocent:
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

I have a hundred folders named by director or main actor. I can't create a bat for each folder

Grazie ragazzi!

Thanks boys!
fulvio53s03
Posts: 777
Joined: 2007-04-28 05:46:43
Location: Italy

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

Post by fulvio53s03 »

Come dice Antp, l'istruzione "ren" non accetta il percorso completo e si deve usare l'istruzione "move".
Il file prodotto può essere eseguito in qualsiasi locazione (sempre con prudenza eh?).

As Antp says, the instruction "ren" does not accept the full path and we must use the statement "move" .
The product file can be executed in any location (always prudently!).

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.3
Requires=4.2
Comments=this Script will Rename your movies' file names with informations contained in field File Path (substituting file Name contained in translated title). Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1

[Options]

[Parameters]

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

program RenameFilm;
uses
  StringUtils1;
var
  MovList: TStringList;
  DupList: TStringList;
  Indirizzo_cartelle, ResultPath, ext_file, Titlenew, titolo_originale: string;
  New_filename, old_filename, numero_rec, anno_film: string;
  Giri, giri_fatti, lgth_path, Posbar: integer;

procedure Elaborazione;
begin
	new_filename := getField(fieldFilePath);
	indirizzo_cartelle := new_filename;
	lgth_path := length(new_filename);
	ext_file  := copy(new_filename, (lgth_path - 3), 4);
	old_filename := 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('\', new_filename, true, true);
	if  posbar > 0 then
      indirizzo_cartelle := copy(indirizzo_cartelle, 1, posbar);
  Titlenew := 'move "' + indirizzo_cartelle;
  Titlenew := Titlenew + '[' + numero_rec + '] ';
  Titlenew := Titlenew + old_filename + ' [' + titolo_originale + '] ' + anno_film + ext_file + '"';
  Titlenew := titlenew +  '     "' + new_filename + '"';
  DupList.Add(Titlenew);        //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 MovList = nil then
       MovList := TStringList.Create;
    if DupList = nil then
       begin
       DupList := TStringList.Create;
       end
    end;
    Elaborazione;

  giri_fatti := GetIteration;
  if giri_fatti = Giri-1 then            //fine elaborazione
       begin
       Titlenew := 'pause';
       DupList.Add(Titlenew);            //scrivi riga
       DupList.SaveToFile(ResultPath);   //chiudi file
       end
end.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

Strano. Mi ha rinominato due file su quattro.


F:\>move "H:\- DONNE\Vega Paz\[0275] 10 cose di noi [10 items or less] 2006.avi" "H:\- DONNE\Vega Paz\2006 - 10 cose di noi.avi"
1 file spostato/i.

F:\>move "H:\- DONNE\Vega Paz\[0276] Dimmi di si [Dimmi di si] 2004.avi" "H:\- DONNE\Vega Paz\2004 - Dimmi di si.avi"
Impossibile trovare il file specificato.

F:\>move "H:\- DONNE\Vega Paz\[0277] L'altro lato del letto [El otro lado de la cama] 2002.avi" "H:\- DONNE\Vega Paz\2002 - L'altro lato del letto.avi"
1 file spostato/i.

F:\>move "H:\- DONNE\Vega Paz\[0278] LucÝa y el sexo [L¨cia e il sesso] 2001.avi" "H:\- DONNE\Vega Paz\2001 - Lucia e il sesso.avi"
Impossibile trovare il file specificato.

F:\>pause
Premere un tasto per continuare . . .
antp
Site Admin
Posts: 9714
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

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

Post by antp »

When it says that it does not find the file, what would be the correct name/folder?
Comparing the value generated and the value expected may help.
otreux
Posts: 199
Joined: 2008-10-22 16:55:46

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

Post by otreux »

the names of the files in the folder are:

[0276] Dimmi di si 2004.avi
[0278] Lucía y el sexo [Lùcia e il sesso] 2001
Post Reply