It writes the results in c:\duplicates.txt along with the numbers of each occurence of the duplicate title.
To change the file, simply change the value at the end of the code (line 98).
Code: Select all
//SCRIPTING
//Find duplicates in a list
(***************************************************
* Script to find duplicates in the list of *
* selected movies. *
* It doesn't see empty fields. *
* *
* (c) 2003 Louis Francisco ork@everydayangels.net *
* *
* For use with Ant Movie Catalog 3.4.1 *
* www.ant.be.tf/moviecatalog ··· www.buypin.com *
* *
* The source code of the script can be used in *
* another program only if full credits to *
* script author and a link to Ant Movie Catalog *
* website are given in the About box or in *
* the documentation of the program *
***************************************************)
program FindDuplicates;
const
NMAX=260; //Set to the last number in the list
var
Titles:TStringList;
Numbers:TStringList;
Duplicates:TStringList;
CurrentTitle:string;
CurrentNumber:string;
function FindTitle(title:string;list:TStringList):integer;
var
i:integer;
begin
result:=-1;
for i:=0 to list.Count-1 do
begin
if list.GetString(i)=title then
begin
result:=i;
break;
end;
end;
end;
procedure FindDuplicates();
var
numTitle,numDup:integer;
begin
numTitle:=FindTitle(CurrentTitle,Titles);
if numTitle<>-1 then
begin
numDup:=FindTitle(CurrentTitle,Duplicates);
if numDup=-1 then
begin
Duplicates.Text:=Duplicates.Text+
CurrentTitle+' ('+Numbers.GetString(numTitle)
+', '+CurrentNumber;
end
else
begin
Duplicates.SetString(numDup,
Duplicates.GetString(numDup)+', '+CurrentNumber);
end;
end;
Titles.Text:=Titles.Text+CurrentTitle;
Numbers.Text:=Numbers.Text+CurrentNumber;
end;
procedure SaveToFile(fileName:string);
var
i:integer;
begin
for i:=0 to Duplicates.Count-1 do
begin
Duplicates.SetString(i,Duplicates.GetString(i)+')');
end;
Duplicates.SaveToFile(fileName);
end;
begin
if CheckVersion(3,4,1) then
begin
if Titles=nil then
begin
Titles:=TStringList.Create;
Numbers:=TStringList.Create;
Duplicates:=TStringList.Create;
end;
CurrentTitle:=GetField(fieldOriginalTitle);
CurrentNumber:=GetField(fieldNumber);
// If title is empty, it generates bugs while looking to the
// number of a duplicate movie.
if CurrentTitle<>'' then FindDuplicates;
if StrToInt(CurrentNumber,0)=NMAX then
begin
SaveToFile('c:\duplicates.txt');
Titles.Free;
Numbers.Free;
Duplicates.Free;
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.1)');
end.