After importing informations from movies contained in a folder and after importing informations about movies from internet......
this Script will Rename your movies' file names (contained in file Path Field) following these optional criterias:
- Translated Title or original Title or Formatted Title
- Director (Between Brackets)
- Year
- Languages
i.e. from "Y:\Film\Film da catalogare\The Machinist (2004) 1080p.mkv"
you can obtain ""L'uomo Senza Sonno (The Machinist) (Brad Anderson) 2004 ENG, ITA, ENG.mkv"
Using it, you will obtain a file named c:\rename.bat.txt that you can open with block notes, control it, rename in c:\rename.bat and then execute it.
Obviousely...... be careful!!!
Yes I'll include it.
But I just wonder why you posted it as an "ITA" script, as it is rather language-neutral.
Also, explanation on how to use it could be put in the comments of the script, so they would be visible when it is selected
Well, I got your suggestions (and i found a mistake too). Only a little problem. I would like to add a 'pause' (dos command) as my script's last line (so, after using .bat file produced, one can see if there were messages about execution's errors).
How can I do?
Would you like to modify my script this way?
You forgot to change the input box title "Find Duplicates"
After using the .bat script, the file names stored in the catalog won't match the actual names. So I wonder if there is so much use of such script in the end?
I remember having previously posted on the forum a script doing the change itself, so updating the catalog at the same time to keep the right paths stored.
I think there is a way to know when you reach the end of the movie list (it would also allow to save only once, at the end), but that's part of the functions added in versions 4.x by soulsnake - these should be in the help file
antp wrote:... I think there is a way to know when you reach the end of the movie list (it would also allow to save only once, at the end), but that's part of the functions added in versions 4.x by soulsnake - these should be in the help file
if GetIteration = 0 then
begin
// begin of the list (first movie)
end
else if GetIteration = GetIterationCount-1 then
begin
// end of the list (last movie)
end
else
begin
// other movies
end;
antp wrote:But then what's the purpose of making a batch file rather than renaming files directly via the script?
Bah... I prefer to see the old/new file name before making changes.
Anyway, I don't find your script. What is its name? or is it only in a post in the forum???
Maybe I could like it more than mine....
Well, I took a look to the topic (thanks) but i'm sorry to say that my script (even not perfect) looks to be a little more complete.
Any suggestion is well accepted.
(***************************************************
Ant Movie Catalog importation script
www.antp.be/software/moviecatalog/
[Infos]
Authors=Fulvio53s03
Title=rename films
Description=rename films
Site=
Language=?
Version=1.2
Requires=4.1
Comments=After importing informations from movies contained in a folder and after importing informations about movies from internet...... this Script will Rename your movies' file names (contained in field File Path) using these optional criterias: 1) Translated Title or original Title or Formatted Title 2) Director (Between Brackets) 3) Year 4) Languages i.e. from "Y:\Film\Film da catalogare\The Machinist (2004) 1080p.mkv" you can obtain ""L'uomo Senza Sonno (The Machinist) (Brad Anderson) 2004 ENG, ITA, ENG.mkv". Using it, you will obtain a file named c:\rename.bat.txt (or any other name you choose) that you can open with notepad, control it, rename in c:\rename.bat and then execute it. The script can updates field File Path in Catalog or leave it unchanged (default), Obviousely...... be careful!!!
License=GPL
GetInfo=0
RequiresMovies=1
[Options]
Title=1|1|0=Formatted Title|1=Translated Title|2=Original Title
Director=1|1|1=Yes|0=No
Year=1|1|1=Yes|0=No
Languages=1|1|1=Yes|0=No
Update_path=0|0|1=Yes|0=No
[Parameters]
***************************************************)
program RenameFilm;
uses
StringUtils1;
var
MovList: TStringList;
DupList: TStringList;
NewName: string;
ResultPath: string;
Titlenew, Linguaggi, CampoAnno, OldPath, NewPath: string;
Titolo, Regista, Anno, Lingue, PosBar, Aggiorna_path: integer;
Giri, giri_fatti, lgth_path: integer;
Procedure ChangeLanguages;
begin
Linguaggi := AnsiUpperCase(Linguaggi);
Linguaggi := StringReplace(Linguaggi, 'ENGLISH', 'ENG');
Linguaggi := StringReplace(Linguaggi, 'SPANISH', 'ESP');
Linguaggi := StringReplace(Linguaggi, 'FRENCH', 'FRA');
Linguaggi := StringReplace(Linguaggi, 'ITALIAN', 'ITA');
Linguaggi := StringReplace(Linguaggi, ', ', '_');
Linguaggi := fulltrim(Linguaggi);
end;
procedure Elaborazione;
begin
NewName := '"';
if Titolo = 1
then NewName := Newname + Getfield(fieldTranslatedTitle);
if Titolo = 2
then NewName := Newname + Getfield(fieldOriginalTitle);
if Titolo = 0
then NewName := Newname + Getfield(fieldFormattedTitle);
if regista = 1
then NewName := NewName + ' (' + Getfield(fieldDirector) + ')';
CampoAnno := Getfield(FieldYear);
if Anno = 1
then NewName := NewName + ' ' + CampoAnno;
Linguaggi := Fulltrim(Getfield(FieldLanguages));
ChangeLanguages;
if length(Linguaggi) > 0
then Linguaggi := ' ' + Linguaggi;
if Lingue = 1
then NewName := NewName + Linguaggi;
OldPath := getField(FieldFilePath);
lgth_path := length(Oldpath);
PosBar := AnsiLastPosEx('.', OldPath, true, true);
delete(OldPath, (1), (PosBar-1)); //cut old filename
NewName := Newname + Oldpath;
OldPath := getField(FieldFilePath);
lgth_path := length(Oldpath);
If Aggiorna_path = 0
then lgth_path := 0;
If lgth_path > 0 then
begin
PosBar := AnsiLastPosEx('\', OldPath, true, true);
if PosBar > 0 then
begin
delete(OldPath, (posbar + 1), (lgth_path - PosBar)); //cut old filename
Newpath := Oldpath + stringReplace(NewName, '"', '');
SetField(FieldFilePath, Newpath);
end
end
if length(getField(FieldFilePath)) > 0 then
begin
Titlenew := 'ren "' + OldPath + '" ' + NewName + '"';
DupList.Add(Titlenew); //scrivi riga
end
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 := 'c:\rename.bat.txt';
Input('Update/Aggiorna Films', 'Store results to: / Salva Risultati in: ', ResultPath);
Titolo := GetOption('Title');
Regista := GetOption('Director');
Anno := GetOption('Year');
Lingue := GetOption('languages');
Aggiorna_path := GetOption('Update_path');
if Aggiorna_path = 1 then
begin
ShowMessage('Attenzione! State per modificare il campo "file path" dei film nel Catalogo! Advertence! You are going tu update field "file path" in Catalog!');
end
if Aggiorna_path = 0 then
begin
ShowMessage('Attenzione! Il campo "file path" dei film nel Catalogo non verrà aggiornato! Advertence! Field "file path" in Catalog will not be updated!');
end
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.
antp wrote: 2014-03-19 10:15:30
You forgot to change the input box title "Find Duplicates"
After using the .bat script, the file names stored in the catalog won't match the actual names. So I wonder if there is so much use of such script in the end?
I remember having previously posted on the forum a script doing the change itself, so updating the catalog at the same time to keep the right paths stored.
I think there is a way to know when you reach the end of the movie list (it would also allow to save only once, at the end), but that's part of the functions added in versions 4.x by soulsnake - these should be in the help file
Can you tell me which is the function to rename files directly? I tried RenameFiles, but it doesn´t exist. Also you commet you posted another script to rename file, can you tell me the name? I´m not able to find it. Thank you.
al0203 wrote: 2020-05-27 12:04:30
Can you tell me which is the function to rename files directly? I tried RenameFiles, but it doesn´t exist. Also you commet you posted another script to rename file, can you tell me the name? I´m not able to find it. Thank you.
The correct script name is "rinomina films" but maybe my script was never inserted as an "official" script.
If you want to use it, maybe necessary to take it from this thread, few posts over this, or write me in m.p. and I'll send it to you.