// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
// Check if the frame is empty (nothing to read) or ID3v2 tag does not exist
if (!tag2 || tag2->frameListMap()[frameID].isEmpty()) {
- metadata_editor_info("The frame %s in ID3v2 tag is empty\n", frameID);
+ metadata_editor_info("The frame %s in ID3v2 tag is empty", frameID);
// Check if the tag ID3v1 is also empty or does not exist
if (!tag1 || tag1->isEmpty()) {
- metadata_editor_info("The frame %s in ID3v1 tag is empty as well\n", frameID);
+ metadata_editor_info("The frame %s in ID3v1 tag is empty as well", frameID);
return METADATA_EDITOR_ERROR_NONE;
} else { // if not - read the frame you need there
- metadata_editor_info("Reading data from ID3v1 tag\n");
+ metadata_editor_info("Reading data from ID3v1 tag");
TagLib::String str;
uint length;
if (found) {
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
return METADATA_EDITOR_ERROR_NONE;
}
if (found) {
length = strlen(buf);
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(buf, length);
return METADATA_EDITOR_ERROR_NONE;
}
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
} else { // or frame has data to read
- metadata_editor_info("The frame %s exists in ID3v2 tag\n", frameID);
+ metadata_editor_info("The frame %s exists in ID3v2 tag", frameID);
// This string is used to copy the value in the frame
TagLib::String str = tag2->frameListMap()[frameID][0]->toString();
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
uint length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
metadata_editor_retvm_if(frameID == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
// Check if the valid tag pointer exists
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
// If the pointer is NULL or c-string is empty - handle as request for deletion
if (!value || (*value == '\0')) {
- metadata_editor_info("Request for frame %s deletion\n", frameID);
+ metadata_editor_info("Request for frame %s deletion", frameID);
tag2->removeFrames(frameID);
if (tag1 && !tag1->isEmpty()) {
if (!strcmp(frameID, "TPE1"))
// Check if the frame is empty (must create the frame before writing the data)
if (tag2->frameListMap()[frameID].isEmpty()) {
- metadata_editor_info("The frame %s does not exist. Creating.\n", frameID);
+ metadata_editor_info("The frame %s does not exist. Creating", frameID);
// This is a common frame type for textural frames except comment frame
TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
fr->setText(TagLib::String(value, TagLib::String::UTF8));
tag2->addFrame(fr);
} else { // if not - just modify the data in the existing frame
- metadata_editor_info("The frame %s exists. Changing.\n", frameID);
+ metadata_editor_info("The frame %s exists. Changing", frameID);
tag2->frameListMap()[frameID][0]->setText(TagLib::String(value, TagLib::String::UTF8));
}
if (tag1 && !tag1->isEmpty()) { // Check if ID3v1 tag exists. Must copy data if yes.
- metadata_editor_info("ID3v1 tag also exists. Copying frame\n");
+ metadata_editor_info("ID3v1 tag also exists. Copying frame");
if (!strcmp(frameID, "TPE1"))
tag1->setArtist(value);
else if (!strcmp(frameID, "TALB"))
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
// Check if the frame is empty (nothing to read) or ID3v2 tag does not exist
- metadata_editor_retvm_if(!tag2 || tag2->frameListMap()[frameID].isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame %s does not exist\n", frameID);
+ metadata_editor_retvm_if(!tag2 || tag2->frameListMap()[frameID].isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame %s does not exist", frameID);
- metadata_editor_info("The frame %s exists\n", frameID);
+ metadata_editor_info("The frame %s exists", frameID);
// This string is used to copy the value in the frame
TagLib::String str = tag2->frameListMap()[frameID][0]->toString();
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
uint length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
metadata_editor_retvm_if(frameID == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
// Check if the valid tag pointer exist
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
// If the pointer is NULL or c-string is empty - handle as request for deletion
if (!value || (*value == '\0')) {
- metadata_editor_info("Request for frame %s deletion\n", frameID);
+ metadata_editor_info("Request for frame %s deletion", frameID);
tag2->removeFrames(frameID);
return METADATA_EDITOR_ERROR_NONE;
}
// Check if the ID3v2 tag exists
if (tag2->frameListMap()[frameID].isEmpty()) {
- metadata_editor_info("The frame %s does not exist. Creating.\n", frameID);
+ metadata_editor_info("The frame %s does not exist. Creating", frameID);
// This is a common frame type for textural frames except comment frame
TagLib::ID3v2::TextIdentificationFrame* fr = new TagLib::ID3v2::TextIdentificationFrame(frameID);
metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
fr->setText(TagLib::String(value, TagLib::String::UTF8));
tag2->addFrame(fr);
} else { // if not - just modify the data in the existing frame
- metadata_editor_info("The frame %s exists. Changing.\n", frameID);
+ metadata_editor_info("The frame %s exists. Changing", frameID);
tag2->frameListMap()[frameID][0]->setText(TagLib::String(value, TagLib::String::UTF8));
}
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
// Check if the valid tag pointer exist
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further");
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"]; // link to picture frames in tag
// Check if the frames exist
- metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "No pictures in file\n");
+ metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "No pictures in file");
- metadata_editor_info("APIC frames exist in file\n");
+ metadata_editor_info("APIC frames exist in file");
char buf[META_MAX_BUF_LEN] = {0, };
// Convert the number of frames (lst.size()) to c-string
snprintf(buf, META_MAX_BUF_LEN, "%u", lst.size());
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
// Check if the valid tag pointer exist
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further");
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag
// Check if frames exist in file
- metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame USLT does not exist\n");
+ metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame USLT does not exist");
- metadata_editor_info("The frame USLT exists\n");
+ metadata_editor_info("The frame USLT exists");
TagLib::ID3v2::FrameList::Iterator it = lst.begin();
TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
TagLib::String str = frame->text();
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
uint length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
return METADATA_EDITOR_ERROR_NONE;
}
metadata_editor_retvm_if(_metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
// Check if the valid tag pointer exist
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
// If the pointer is NULL or c-string is empty - handle as request for deletion
if (!value || (*value == '\0')) {
- metadata_editor_info("Request for frame COMM deletion\n");
+ metadata_editor_info("Request for frame COMM deletion");
tag2->removeFrames("COMM");
if (tag1 && !tag1->isEmpty())
tag1->setComment("");
}
// If the comment frame is empty - create the frame and add it to the list
if (tag2->frameListMap()["COMM"].isEmpty()) {
- metadata_editor_info("The frame COMM does not exist. Creating.\n");
+ metadata_editor_info("The frame COMM does not exist. Creating");
TagLib::ID3v2::CommentsFrame* fr = new TagLib::ID3v2::CommentsFrame;
- metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY\n");
+ metadata_editor_retvm_if(fr == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
fr->setText(TagLib::String(value, TagLib::String::UTF8));
fr->setTextEncoding(TagLib::String::UTF8);
tag2->addFrame(fr);
} else { // If the frame already exists - just modify its value
- metadata_editor_info("The frame COMM exists. Changing.\n");
+ metadata_editor_info("The frame COMM exists. Changing");
tag2->frameListMap()["COMM"][0]->setText(TagLib::String(value, TagLib::String::UTF8));
}
if (tag1 && !tag1->isEmpty()) { // Copy the value to ID3v1 tag comment
- metadata_editor_info("ID3v1 tag also exists. Copying frame\n");
+ metadata_editor_info("ID3v1 tag also exists. Copying frame");
tag1->setComment(value);
}
metadata_editor_retvm_if(_metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
// Check if the valid tag pointer exist
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag
// If the pointer is NULL or c-string is empty - handle as request for deletion
if (!value || (*value == '\0')) {
- metadata_editor_info("Request for frame USLT deletion\n");
+ metadata_editor_info("Request for frame USLT deletion");
tag2->removeFrames("USLT");
return METADATA_EDITOR_ERROR_NONE;
}
// Check if lyrics frames exist
if (lst.isEmpty()) {
// No lyrics - create the frame and add it to the ID3v2 tag
- metadata_editor_info("The frame USLT does not exist. Creating.\n");
+ metadata_editor_info("The frame USLT does not exist. Creating");
TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame;
metadata_editor_retvm_if(frame == NULL, METADATA_EDITOR_ERROR_OUT_OF_MEMORY, "OUT_OF_MEMORY");
frame->setText(TagLib::String(value, TagLib::String::UTF8));
tag2->addFrame(frame);
} else { // the lyrics frames exist - change the existing one
- metadata_editor_info("USLT frames exist in file. Changing.\n");
+ metadata_editor_info("USLT frames exist in file. Changing");
TagLib::ID3v2::FrameList::Iterator it = lst.begin();
TagLib::ID3v2::UnsynchronizedLyricsFrame* frame = static_cast<TagLib::ID3v2::UnsynchronizedLyricsFrame*>(*it);
frame->setTextEncoding(TagLib::String::UTF8);
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
// Check the encoding of the string (1252 or not)
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
// Get the length of the string and check if it is empty or not
uint length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
return METADATA_EDITOR_ERROR_NONE;
} else { // Item was not found
- metadata_editor_info("No item <%s> in file\n", itemname);
+ metadata_editor_info("No item <%s> in file", itemname);
return METADATA_EDITOR_ERROR_NONE;
}
}
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
snprintf(buf, META_MAX_BUF_LEN, "%u", num); // Convert int into char[]
// Determine the length of created c-string and copy it into the output variable
int length = strlen(buf);
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(buf, length);
return METADATA_EDITOR_ERROR_NONE;
} else { // Item was not found
- metadata_editor_info("No item <%s> in file\n", itemname);
+ metadata_editor_info("No item <%s> in file", itemname);
return METADATA_EDITOR_ERROR_NONE;
}
}
metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
TagLib::MP4::ItemListMap& itemMap = tag->itemListMap();
// Check if it is a request for deletion
if ((value == NULL) || value[0] == '\0') {
- metadata_editor_info("Request for deleting of item <%s>\n", itemname);
+ metadata_editor_info("Request for deleting of item <%s>", itemname);
TagLib::MP4::ItemListMap::Iterator it = itemMap.find(itemname);
if (it != itemMap.end())
itemMap.erase(it);
return METADATA_EDITOR_ERROR_NONE;
}
- metadata_editor_info("The item <%s> will be added\n", itemname);
+ metadata_editor_info("The item <%s> will be added", itemname);
itemMap[itemname] = TagLib::MP4::Item(TagLib::String(value, TagLib::String::UTF8));
return METADATA_EDITOR_ERROR_NONE;
metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
TagLib::MP4::ItemListMap& itemMap = tag->itemListMap();
// Check if it is a request for deletion
if ((value == NULL) || value[0] == '\0') {
- metadata_editor_info("Request for deleting of item <%s>\n", itemname);
+ metadata_editor_info("Request for deleting of item <%s>", itemname);
TagLib::MP4::ItemListMap::Iterator it = itemMap.find(itemname);
if (it != itemMap.end())
itemMap.erase(it);
}
// Check if the value is integer string then it can be successfully converted into integer
if (isdigit(value[0])) {
- metadata_editor_info("The item <%s> will be added\n", itemname);
+ metadata_editor_info("The item <%s> will be added", itemname);
int number = atoi(value);
itemMap[itemname] = TagLib::MP4::Item(number);
return METADATA_EDITOR_ERROR_NONE;
} else { // Notify that string is not a number to process
- metadata_editor_error("Error. String does not contain a number\n");
+ metadata_editor_error("Error. String does not contain a number");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
- metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n");
+ metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
// Get map of items directly from tag and launch a search of specific item
TagLib::MP4::ItemListMap& itemMap = tag->itemListMap();
TagLib::MP4::ItemListMap::ConstIterator it = itemMap.find("covr");
if (it != itemMap.end()) { // Item was found
uint number = it->second.toCoverArtList().size(); // Get the size of CoverList (i.e. number of pictures in file)
- metadata_editor_info("There are %u picture(s) in file\n", number);
+ metadata_editor_info("There are %u picture(s) in file", number);
char buf[META_MAX_BUF_LEN] = {0, };
snprintf(buf, META_MAX_BUF_LEN, "%u", number); // Convert integer value of size to its c-string representation
int length = strlen(buf);
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(buf, length);
return METADATA_EDITOR_ERROR_NONE;
} else { // Item was not found
- metadata_editor_info("No item <covr> in file\n");
+ metadata_editor_info("No item <covr> in file");
return METADATA_EDITOR_ERROR_NONE;
}
}
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
const TagLib::Ogg::FieldListMap& fieldMap = xtag->fieldListMap();
TagLib::Ogg::FieldListMap::ConstIterator it = fieldMap.find(fieldname);
if ((xtag->contains(fieldname)) && (it != fieldMap.end())) { // Field was found
- metadata_editor_info("Field %s was found. Extracting\n", fieldname);
+ metadata_editor_info("Field %s was found. Extracting", fieldname);
TagLib::String str = it->second[0]; // Get the first string in xiph field
// Check the encoding of the string (1252 or not)
bool isUTF = false;
if (!str.isLatin1()) isUTF = true;
- metadata_editor_info("String is %sUTF\n", (isUTF ? "" : "not "));
+ metadata_editor_info("String is %sUTF", (isUTF ? "" : "not "));
// Get the length of the string and check if it is empty or not
uint length = strlen(str.toCString(isUTF));
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(str.toCString(isUTF), length);
return METADATA_EDITOR_ERROR_NONE;
} else { // Field was not found
- metadata_editor_info("No field %s in Xiph Comment\n", fieldname);
+ metadata_editor_info("No field %s in Xiph Comment", fieldname);
return METADATA_EDITOR_ERROR_NONE;
}
}
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
- metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
+ metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
// Check if it is a request for deletion
if ((value == NULL) || value[0] == '\0') {
- metadata_editor_info("Request for deleting of field %s\n", fieldname);
+ metadata_editor_info("Request for deleting of field %s", fieldname);
xtag->removeField(fieldname);
return METADATA_EDITOR_ERROR_NONE;
}
- metadata_editor_info("The field %s will be added\n", fieldname);
+ metadata_editor_info("The field %s will be added", fieldname);
// "true" is used to remove other strings of the same "fieldname" first
xtag->addField(fieldname, TagLib::String(value, TagLib::String::UTF8), true);
return METADATA_EDITOR_ERROR_NONE;
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file;
if (_file->pictureList().isEmpty()) {
- metadata_editor_info("No pictures in FLAC file\n");
+ metadata_editor_info("No pictures in FLAC file");
return METADATA_EDITOR_ERROR_NONE;
}
uint number = _file->pictureList().size();
- metadata_editor_info("There are %u picture(s) in file\n", number);
+ metadata_editor_info("There are %u picture(s) in file", number);
char buf[META_MAX_BUF_LEN] = {0, };
snprintf(buf, META_MAX_BUF_LEN, "%u", number); // Convert integer value of size to its c-string representation
uint length = strlen(buf);
- metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string...\n");
+ metadata_editor_retvm_if(length == 0, METADATA_EDITOR_ERROR_NONE, "Empty string");
*value = strndup(buf, length);
return METADATA_EDITOR_ERROR_NONE;
}
/* check the file exits actually */
exist = open(path, O_RDONLY);
if(exist < 0) {
- metadata_editor_error("Not exist file\n");
+ metadata_editor_error("Not exist file");
if (errno == EACCES || errno == EPERM) {
return METADATA_EDITOR_ERROR_PERMISSION_DENIED;
} else {
_metadata->filetype = METADATA_EDITOR_FORMAT_MP3;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_PERMISSION_DENIED;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
_metadata->filetype = METADATA_EDITOR_FORMAT_MP4;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_FILE_EXISTS;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
return METADATA_EDITOR_ERROR_NONE;
_metadata->filetype = METADATA_EDITOR_FORMAT_FLAC;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_FILE_EXISTS;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
return METADATA_EDITOR_ERROR_NONE;
_metadata->filetype = METADATA_EDITOR_FORMAT_OGG_VORBIS;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_FILE_EXISTS;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
return METADATA_EDITOR_ERROR_NONE;
_metadata->filetype = METADATA_EDITOR_FORMAT_OGG_FLAC;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_FILE_EXISTS;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
return METADATA_EDITOR_ERROR_NONE;
_metadata->filetype = METADATA_EDITOR_FORMAT_WAV;
if (_file->isOpen()) { // Check if the file was opened successfully
- metadata_editor_info("The file is successfully opened. Address is %p\n", _metadata->file);
+ metadata_editor_info("The file is successfully opened. Address is %p", _metadata->file);
_metadata->isOpen = true;
} else { // The file does not exist or you have no permission to process it
- metadata_editor_error("The file was not found. Pointer address is %p\n", _metadata->file);
+ metadata_editor_error("The file was not found. Pointer address is %p", _metadata->file);
_metadata->isOpen = false;
return METADATA_EDITOR_ERROR_FILE_EXISTS;
}
if (_file->readOnly()) { // Check if the file is readonly
- metadata_editor_info("File is readonly\n");
+ metadata_editor_info("File is readonly");
_metadata->isReadOnly = true;
} else { // or not
- metadata_editor_info("The file is writable\n");
+ metadata_editor_info("The file is writable");
_metadata->isReadOnly = false;
}
return METADATA_EDITOR_ERROR_NONE;
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_NOT_SUPPORTED;
}
}
metadata_editor_retvm_if(value == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Value Pointer");
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
*value = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
TagLib::FLAC::File* _file = (TagLib::FLAC::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->xiphComment(false);
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Tag does not exist\n");
+ metadata_editor_error("Tag does not exist");
*value = NULL;
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Tag does not exist\n");
+ metadata_editor_error("Tag does not exist");
*value = NULL;
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Tag does not exist\n");
+ metadata_editor_error("Tag does not exist");
*value = NULL;
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
TagLib::ID3v2::Tag* tag2 = _file->tag();
if (tag2 == NULL) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. ID3v2 tag does not exist. Can not proceed metadata extraction\n");
+ metadata_editor_error("Error. ID3v2 tag does not exist. Can not proceed metadata extraction");
*value = NULL;
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
metadata_editor_s* _metadata = (metadata_editor_s*) metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
TagLib::FLAC::File* _file = (TagLib::FLAC::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->xiphComment(true);
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
switch (attribute) { // Check which one of frame type was given for processing
TagLib::Ogg::Vorbis::File* _file = (TagLib::Ogg::Vorbis::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
switch (attribute) { // Check which one of frame type was given for processing
TagLib::Ogg::FLAC::File* _file = (TagLib::Ogg::FLAC::File*)_metadata->file;
TagLib::Ogg::XiphComment* xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
- metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. Xiph Comment was not created. Can not proceed metadata updating");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
switch (attribute) { // Check which one of frame type was given for processing
TagLib::ID3v2::Tag* tag2 = _file->tag();
// Check if the valid tag pointer exist
if (tag2 == NULL) {
- metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
// *** This function apply all changes done in the tag(s) and update them to file *** //
extern "C" int metadata_editor_update_metadata(metadata_editor_h metadata) {
// Check if we have a valid argument to work with
- metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle\n");
+ metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle");
metadata_editor_s *_metadata = (metadata_editor_s*)metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
const char *TYPE_JPEG = "image/jpeg";
const char *TYPE_PNG = "image/png";
// Check if we have valid arguments to work with
- metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle\n");
+ metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID Handle");
metadata_editor_retvm_if(picture == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
metadata_editor_retvm_if(size == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
metadata_editor_s* _metadata = (metadata_editor_s*) metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
*picture = NULL;
*size = 0;
*mime_type = NULL;
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"];
// Check if there are pictures in the tag
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in file\n");
+ metadata_editor_error("No pictures in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
} else { // pictures exist in file
// Check if index is correct or not
if ((index < 0) || (lst.size() <= (uint)index)) {
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // everything is correct - begin extraction
metadata_editor_info("There are %u pictures in file. Start of picture number %d extraction", lst.size(), index);
case METADATA_EDITOR_FORMAT_MP4: {
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
- metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist\n");
+ metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
// Get map of items directly from tag and launch a search of specific item
TagLib::MP4::ItemListMap& itemMap = tag->itemListMap();
TagLib::MP4::CoverArtList lst = it->second.toCoverArtList();
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) { // it is not
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // index is in range
int i = 0;
return METADATA_EDITOR_ERROR_NONE;
}
} else { // Item was not found - no pictures in file
- metadata_editor_error("No item <covr> in file. No pictures in file\n");
+ metadata_editor_error("No item <covr> in file. No pictures in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
}
TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file;
TagLib::List<TagLib::FLAC::Picture*> lst = _file->pictureList();
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in FLAC file\n");
+ metadata_editor_error("No pictures in FLAC file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
} else {
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) { // it is not
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // index is in range
// Consecutive check of all pictures until the desired one is found
TagLib::RIFF::WAV::File* _file = (TagLib::RIFF::WAV::File*)_metadata->file; // Bring the pointer to actual file type
TagLib::ID3v2::Tag* tag2 = _file->tag();
if (!tag2) {
- metadata_editor_error("No ID3v2 tag in file\n");
+ metadata_editor_error("No ID3v2 tag in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"];
// Check if there are pictures in the tag
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in file\n");
+ metadata_editor_error("No pictures in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
} else { // pictures exist in file
// Check if index is correct or not
if ((index < 0) || (lst.size() <= (uint)index)) {
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // everything is correct - begin extraction
metadata_editor_info("There are %u pictures in file. Start of picture number %d extraction", lst.size(), index);
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
metadata_editor_retvm_if(path == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID PARAMETER");
metadata_editor_s* _metadata = (metadata_editor_s*) metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
ret = __metadata_editor_get_picture_info(path, &picture, &size, &type);
- metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
+ metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
TagLib::ID3v2::Tag* tag2 = _file->ID3v2Tag(true);
// Check if the valid tag pointer exists
if (tag2 == NULL) {
- metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating");
ret = METADATA_EDITOR_ERROR_OPERATION_FAILED;
break;
}
TagLib::ID3v2::AttachedPictureFrame* pictureFrame = new TagLib::ID3v2::AttachedPictureFrame();
if (pictureFrame == NULL) {
- metadata_editor_error("OUT_OF_MEMORY\n");
+ metadata_editor_error("OUT_OF_MEMORY");
ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY;
break;
}
- metadata_editor_info("New APIC frame will be added to the ID3v2 tag\n");
+ metadata_editor_info("New APIC frame will be added to the ID3v2 tag");
pictureFrame->setPicture(TagLib::ByteVector((char*)picture, size));
pictureFrame->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
pictureFrame->setMimeType(type);
TagLib::MP4::File* _file = (TagLib::MP4::File*) _metadata->file;
TagLib::MP4::Tag* tag = _file->tag();
if (!tag) {
- metadata_editor_error("Tag was not created\n");
+ metadata_editor_error("Tag was not created");
ret = METADATA_EDITOR_ERROR_OPERATION_FAILED;
break;
}
TagLib::MP4::ItemListMap& itemMap = tag->itemListMap();
TagLib::MP4::ItemListMap::ConstIterator it = itemMap.find("covr");
if (it != itemMap.end()) { // Item was found
- metadata_editor_info("The item <covr> exists. Adding picture\n");
+ metadata_editor_info("The item <covr> exists. Adding picture");
TagLib::MP4::CoverArtList lst = it->second.toCoverArtList();
TagLib::MP4::CoverArt::Format format;
if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
ret = METADATA_EDITOR_ERROR_NONE;
break;
} else { // Item was not found
- metadata_editor_info("The item <covr> does not exist. Adding picture\n");
+ metadata_editor_info("The item <covr> does not exist. Adding picture");
TagLib::MP4::CoverArt::Format format;
if (strncmp(type, "image/jpeg", strlen("image/jpeg")) == 0)
format = TagLib::MP4::CoverArt::JPEG;
TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file;
TagLib::FLAC::Picture* frontCover = new TagLib::FLAC::Picture;
if (frontCover == NULL) {
- metadata_editor_error("OUT_OF_MEMORY\n");
+ metadata_editor_error("OUT_OF_MEMORY");
ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY;
break;
}
frontCover->setType(TagLib::FLAC::Picture::FrontCover);
frontCover->setMimeType(type);
- metadata_editor_info("Picture will be added to FLAC file\n");
+ metadata_editor_info("Picture will be added to FLAC file");
_file->addPicture(frontCover);
ret = METADATA_EDITOR_ERROR_NONE;
break;
TagLib::ID3v2::Tag* tag2 = _file->tag();
// Check if the valid tag pointer exists
if (tag2 == NULL) {
- metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating\n");
+ metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating");
ret = METADATA_EDITOR_ERROR_OPERATION_FAILED;
break;
}
TagLib::ID3v2::AttachedPictureFrame* pictureFrame = new TagLib::ID3v2::AttachedPictureFrame();
if (pictureFrame == NULL) {
- metadata_editor_error("OUT_OF_MEMORY\n");
+ metadata_editor_error("OUT_OF_MEMORY");
ret = METADATA_EDITOR_ERROR_OUT_OF_MEMORY;
break;
}
- metadata_editor_info("New APIC frame will be added to the ID3v2 tag\n");
+ metadata_editor_info("New APIC frame will be added to the ID3v2 tag");
pictureFrame->setPicture(TagLib::ByteVector((char*)picture, size));
pictureFrame->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
pictureFrame->setMimeType(type);
}
#endif
default: {
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
ret = METADATA_EDITOR_ERROR_NOT_SUPPORTED;
break;
}
metadata_editor_retvm_if(metadata == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "INVALID handler.");
metadata_editor_s* _metadata = (metadata_editor_s*) metadata;
- metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail.\n");
+ metadata_editor_retvm_if(_metadata->file == NULL, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "File loading fail");
// Check if the file, given through metadata, exists and is opened correctly
- metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it\n");
- metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify\n");
+ metadata_editor_retvm_if(_metadata->file && _metadata->isOpen == false, METADATA_EDITOR_ERROR_PERMISSION_DENIED, "File does not exist or you have no rights to open it");
+ metadata_editor_retvm_if(_metadata->isReadOnly, METADATA_EDITOR_ERROR_OPERATION_FAILED, "File is readonly. Unable to modify");
switch (_metadata->filetype) { // Process the file according to the specified file type
case METADATA_EDITOR_FORMAT_MP3: {
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"];
// Check if there are pictures in the tag
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in file\n");
+ metadata_editor_error("No pictures in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
} else { // pictures exist in file
// Check if index is correct or not
if ((index < 0) || (lst.size() <= (uint)index)) {
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // everything is correct - begin extraction
- metadata_editor_info("Removing of picture number %d\n", index);
+ metadata_editor_info("Removing of picture number %d", index);
int i = 0;
// Among all frames we must choose that one with specified index. "i" will be counter
for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) {
TagLib::MP4::CoverArtList lst = it->second.toCoverArtList();
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) { // it is not
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // index is in range
- metadata_editor_info("The picture number %d will be deleted\n", index);
+ metadata_editor_info("The picture number %d will be deleted", index);
int i = 0;
for (TagLib::MP4::CoverArtList::Iterator picIt = lst.begin(); picIt != lst.end(); ++picIt, ++i) {
if (i != index) continue;
return METADATA_EDITOR_ERROR_NONE;
}
} else { // Item was not found
- metadata_editor_error("The item <covr> does not exist. Nothing to delete\n");
+ metadata_editor_error("The item <covr> does not exist. Nothing to delete");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
}
TagLib::FLAC::File* _file = (TagLib::FLAC::File*) _metadata->file;
TagLib::List<TagLib::FLAC::Picture*> lst = _file->pictureList();
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in file. Nothing to delete\n");
+ metadata_editor_error("No pictures in file. Nothing to delete");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) { // it is not
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // index is in range
- metadata_editor_info("The picture number %d will be deleted\n", index);
+ metadata_editor_info("The picture number %d will be deleted", index);
int i = 0;
for (TagLib::List<TagLib::FLAC::Picture*>::Iterator picIt = lst.begin(); picIt != lst.end(); ++picIt, ++i) {
if (i != index) continue;
TagLib::ID3v2::Tag* tag2 = _file->tag();
// Check if the valid tag pointer exists
if (tag2 == NULL) {
- metadata_editor_error("Error. ID3v2 tag does not exist. Can not remove picture\n");
+ metadata_editor_error("Error. ID3v2 tag does not exist. Can not remove picture");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
TagLib::ID3v2::FrameList lst = tag2->frameListMap()["APIC"];
// Check if there are pictures in the tag
if (lst.isEmpty()) {
- metadata_editor_error("No pictures in file\n");
+ metadata_editor_error("No pictures in file");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
} else { // pictures exist in file
// Check if index is correct or not
if ((index < 0) || (lst.size() <= (uint)index)) {
- metadata_editor_error("Index of picture is out of range\n");
+ metadata_editor_error("Index of picture is out of range");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
} else { // everything is correct - begin extraction
- metadata_editor_info("Removing of picture number %d\n", index);
+ metadata_editor_info("Removing of picture number %d", index);
int i = 0;
// Among all frames we must choose that one with specified index. "i" will be counter
for (TagLib::ID3v2::FrameList::Iterator it = lst.begin(); it != lst.end(); ++it, ++i) {
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
}
}
#endif
default:
- metadata_editor_error("Wrong file type\n");
+ metadata_editor_error("Wrong file type");
return METADATA_EDITOR_ERROR_INVALID_PARAMETER;
}
- metadata_editor_info("<metadata_editor_s> with address %p will be freed\n", metadata);
+ metadata_editor_info("<metadata_editor_s> with address %p will be freed", metadata);
delete _metadata;
return METADATA_EDITOR_ERROR_NONE;