metadata_editor_info("Reading data from ID3v1 tag");
- //check isNull(). toCString() returns "", when String is NULL.
+ //check isEmpty(). toCString() returns "", when String is NULL.
//for "genre", taglib returns "", if genre is out or range.
- if (!strcmp(frameID, "TPE1") && !(tag1->artist().isNull())) /* artist */
+ if (!strcmp(frameID, "TPE1") && !(tag1->artist().isEmpty())) /* artist */
*value = g_strdup(tag1->artist().toCString(true));
- else if (!strcmp(frameID, "TALB") && !(tag1->album().isNull())) /* album */
+ else if (!strcmp(frameID, "TALB") && !(tag1->album().isEmpty())) /* album */
*value = g_strdup(tag1->album().toCString(true));
- else if (!strcmp(frameID, "COMM") && !(tag1->comment().isNull())) /* comment */
+ else if (!strcmp(frameID, "COMM") && !(tag1->comment().isEmpty())) /* comment */
*value = g_strdup(tag1->comment().toCString(true));
- else if (!strcmp(frameID, "TCON") && !(tag1->genre().isNull()) && !(tag1->genre().isEmpty())) /* genre */
+ else if (!strcmp(frameID, "TCON") && !(tag1->genre().isEmpty()) && !(tag1->genre().isEmpty())) /* genre */
*value = g_strdup(tag1->genre().toCString(true));
- else if (!strcmp(frameID, "TIT2") && !(tag1->title().isNull())) /* title */
+ else if (!strcmp(frameID, "TIT2") && !(tag1->title().isEmpty())) /* title */
*value = g_strdup(tag1->title().toCString(true));
else if (!strcmp(frameID, "TRCK")) /* track */
*value = g_strdup_printf("%u", tag1->track());
auto it = lst.begin();
auto frame = static_cast<ID3v2::UnsynchronizedLyricsFrame*>(*it);
- if (!(frame->text().isNull()))
+ if (!(frame->text().isEmpty()))
*value = g_strdup(frame->text().toCString(true));
return METADATA_EDITOR_ERROR_NONE;
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_NONE, "[No-Error] No tag");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
- auto &itemMap = tag->itemListMap();
- auto it = itemMap.find(itemname);
+ auto item = tag->item(itemname);
- if (it != itemMap.end())
- *value = g_strdup(it->second.toStringList()[0].toCString(true));
+ if (item.isValid())
+ *value = g_strdup(item.toStringList().toString().toCString(false));
else
metadata_editor_info("No item <%s> in file", itemname);
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_NONE, "[No-Error] No tag");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
- auto &itemMap = tag->itemListMap();
- auto it = itemMap.find(itemname);
- if (it != itemMap.end())
- *value = g_strdup_printf("%u", it->second.toInt());
+ auto item = tag->item(itemname);
+
+ if (item.isValid())
+ *value = g_strdup_printf("%u", item.toInt());
else
metadata_editor_info("No item <%s> in file", itemname);
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
- // Get map of items directly from tag and launch a search of specific item
- auto &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>", itemname);
- auto it = itemMap.find(itemname);
- if (it != itemMap.end())
- itemMap.erase(it);
+ tag->removeItem(itemname);
+
return METADATA_EDITOR_ERROR_NONE;
}
metadata_editor_info("The item <%s> will be added", itemname);
- itemMap[itemname] = MP4::Item(String(value, String::UTF8));
+ tag->setItem(itemname, MP4::Item(String(value, String::UTF8)));
return METADATA_EDITOR_ERROR_NONE;
}
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_METADATA_UPDATE_NOT_POSSIBLE, "Tag does not exist");
metadata_editor_retvm_if(!itemname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid itemname");
- // Get map of items directly from tag and launch a search of specific item
- auto &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>", itemname);
- MP4::ItemListMap::Iterator it = itemMap.find(itemname);
- if (it != itemMap.end())
- itemMap.erase(it);
+ tag->removeItem(itemname);
+
return METADATA_EDITOR_ERROR_NONE;
}
// 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", itemname);
int number = atoi(value);
- itemMap[itemname] = MP4::Item(number);
+ tag->setItem(itemname, 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");
// Check if it is a request for deletion
if ((value == NULL) || value[0] == '\0') {
metadata_editor_info("Request for deleting of field %s", fieldname);
- xtag->removeField(fieldname);
+ xtag->removeFields(fieldname);
return METADATA_EDITOR_ERROR_NONE;
}
metadata_editor_info("The field %s will be added", fieldname);