Aloha!
Torben hatte mal ein Skript veröffentlicht, mit dem sich nachträglich die mit MediaMonkey o.ä. Programmen ermittelten Werte in die Datenbank einlesen lassen:
var
stmt: IZPreparedStatement;
rs: IZResultSet;
ts: TStringList;
i: integer;
pi1, pi2: IFilePlaylistItem;
begin
ts := TStringList.Create;
try
// Fetch all File item IDs - we need to lock the database in order to
// protect the connection
Database(0).BeginRead;
try
stmt := ImAirListDB(Database(0)).GetConnection.PrepareStatement(
'SELECT idx FROM items WHERE xmltype=''File'''
);
rs := stmt.ExecuteQueryPrepared;
while rs.Next do
ts.Add(rs.GetString(1));
finally
Database(0).EndRead;
end;
SystemLog('Found ' + IntToStr(ts.Count) + ' files.');
for i := 0 to ts.Count - 1 do begin
// load first item from database
pi1 := IFilePlaylistItem(Database(0).CreatePlaylistItem(ts));
SystemLog(pi1.GetFilename);
try
// create second item directly from the file, read tags
//pi2 := IFilePlaylistItem(Factory.CreatePlaylistItemFromFile(pi1.GetFilename, [fitTags]));
pi2 := IFilePlaylistItem(Factory.CreatePlaylistItemFromFile(pi1.GetFilename, [fitNativeTags]));
// Is the amplification different from the one stored in the database?
if IAmplifyable(pi1).GetAmplification <> IAmplifyable(pi2).GetAmplification then begin
SystemLog('Amplification has changed');
// Copy amplification over to the database item
IAmplifyable(pi1).SetAmplification(IAmplifyable(pi2).GetAmplification);
// write changes back to the database
Database(0).SavePlaylistItem(pi1);
end;
except
SystemLog('Error');
end;
end;
finally
ts.Free;
end;
end.
Führe ich das jetzt aus, bekomme ich folgende Fehlermeldung: " Error running skript [Error] (16:15): Unknown Identifier ‘ImAirListDB’ ".
Was muss ich tun?