Hello,
Does anyone know of a way, or is there a way, to check if there is a duplicate file in a playlist?
Gr, Toon
Hello,
Does anyone know of a way, or is there a way, to check if there is a duplicate file in a playlist?
Gr, Toon
You could run a script which compares the filenames. What should be supposed to happen then?
If there is a dubble file in the playlist,
then delete 1 of the file.
You might try this one:
procedure OnLoad;
begin
EnableTimer(10000);
end;
procedure OnTimer;
var
i, k: integer;
FileName: string;
begin
CurrentPlaylist.BeginRead;
for i := 0 to CurrentPlaylist.GetCount - 1 do
begin
if CurrentPlaylist.GetItem(i).IsFile then
FileName := IFilePlaylistItem(CurrentPlaylist.GetItem(i)).GetFilename;
for k := i + 1 to CurrentPlaylist.GetCount - 1 do
if CurrentPlaylist.GetItem(k).IsFile then
if IFilePlaylistItem(CurrentPlaylist.GetItem(k)).GetFilename = FileName then
begin
CurrentPlaylist.BeginUpdate;
try
CurrentPlaylist.Delete(k);
finally
CurrentPlaylist.EndUpdate;
end;
end;
end;
CurrentPlaylist.EndRead;
end;
Every ten seconds the playlist is searched for items with duplicate path-/filenames. If found, the latter of the pair is skipped.
Thanks, this woks nice,