Hi, I tried with following code. But unfortunatelly the added datas is not stored.
Where did I somewhat wrong?
int main(int argc, char* argv[])
{ if(argc != 2) { cout << "Invalid numbers of arguments!" << endl; cout << "Usage: " << argv[0] << " [FILENAME]" << endl; } // initialize XMP Toolkit if(!SXMPMeta::Initialize() || !SXMPFiles::Initialize()) { cout << "Failed to initialise XMP Toolkit!" << endl; return 1; } XMP_OptionBits opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUseSmartHandler; SXMPFiles file; string fileName = argv[1]; string transcriptionFileName = fileName.substr(0, fileName.find_last_of('.')) + ".txt"; string transcription; cout << "Opening files " << fileName << " and " << transcriptionFileName << endl; // first check if files exist if(!fileExists(fileName.c_str())) return 1; transcription = readStringFromFile(transcriptionFileName); bool ok = file.OpenFile(fileName, detectFiletype(fileName), opts); if(!ok) { cout << "No smart handler available for " << fileName << endl; cout << "Trying packet scanning..." << endl; // Now try using packet scanning opts = kXMPFiles_OpenForUpdate | kXMPFiles_OpenUsePacketScanning; ok = file.OpenFile(fileName, detectFiletype(fileName), opts); } if(ok) { // preparing variables SXMPMeta meta; char buffer[255]; cout << "Retrieving metadatas..." << endl; file.GetXMP(&meta); meta.AppendArrayItem(kXMP_NS_Script, "dialogSequence", kXMP_PropValueIsArray, NULL, kXMP_PropValueIsStruct); meta.SetProperty(kXMP_NS_Script, "dialogSequence[1]/xmpScript:character", "SPRECHER", NULL); meta.SetProperty(kXMP_NS_Script, "dialogSequence[1]/xmpScript:dialog", transcription, NULL); string schemaNS, propPath, propVal; SXMPIterator iter(meta); while(iter.Next(&schemaNS, &propPath, &propVal)) cout << schemaNS << " " << propPath << " = " << propVal << endl; } else cout << "Failed retrieving metadatas!" << endl; cout << "Closing file..." << endl; file.CloseFile(); cout << "\n=== Finished ===" << endl; return 0;
}
Could someone of you please tell me why the file is not updated. Maybe I did wrong with "meta.SetProperty"?
cu Floh