metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag does not exist. Can not process further");
- ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag
+ auto lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag
metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_NONE, "The frame USLT does not exist");
metadata_editor_info("The frame USLT exists");
- ID3v2::FrameList::Iterator it = lst.begin();
+ auto it = lst.begin();
auto frame = static_cast<ID3v2::UnsynchronizedLyricsFrame*>(*it);
*value = g_strdup(frame->text().toCString(true));
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
metadata_editor_retvm_if(!tag2, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
- ID3v2::FrameList lst = tag2->frameListMap()["USLT"]; // link to unsynchronized lyric frames in tag
+ auto 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");
tag2->addFrame(frame);
} else { // the lyrics frames exist - change the existing one
metadata_editor_info("USLT frames exist in file. Changing");
- ID3v2::FrameList::Iterator it = lst.begin();
+ auto it = lst.begin();
auto frame = static_cast<ID3v2::UnsynchronizedLyricsFrame*>(*it);
frame->setTextEncoding(String::UTF8);
frame->setText(String(value, String::UTF8));
auto tag = dynamic_cast<MP4::Tag*>(_metadata->file->tag());
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
- MP4::ItemListMap& itemMap = tag->itemListMap();
- MP4::ItemListMap::ConstIterator it = itemMap.find(itemname);
+ auto itemMap = tag->itemListMap();
+ auto it = itemMap.find(itemname);
if (it != itemMap.end())
*value = g_strdup(it->second.toStringList()[0].toCString(true));
auto tag = dynamic_cast<MP4::Tag*>(_metadata->file->tag());
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
- MP4::ItemListMap& itemMap = tag->itemListMap();
- MP4::ItemListMap::ConstIterator it = itemMap.find(itemname);
+ auto itemMap = tag->itemListMap();
+ auto it = itemMap.find(itemname);
if (it != itemMap.end())
*value = g_strdup_printf("%u", it->second.toInt());
else
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
// Get map of items directly from tag and launch a search of specific item
- MP4::ItemListMap& itemMap = tag->itemListMap();
+ 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);
+ auto it = itemMap.find(itemname);
if (it != itemMap.end())
itemMap.erase(it);
return METADATA_EDITOR_ERROR_NONE;
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
// Get map of items directly from tag and launch a search of specific item
- MP4::ItemListMap& itemMap = tag->itemListMap();
+ 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);
metadata_editor_retvm_if(!fieldname, METADATA_EDITOR_ERROR_INVALID_PARAMETER, "Invalid fieldname");
metadata_editor_retvm_if(!xtag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
- const Ogg::FieldListMap& fieldMap = xtag->fieldListMap();
- Ogg::FieldListMap::ConstIterator it = fieldMap.find(fieldname);
+ auto fieldMap = xtag->fieldListMap();
+ auto it = fieldMap.find(fieldname);
if ((xtag->contains(fieldname)) && (it != fieldMap.end()))
*value = g_strdup(it->second[0].toCString(true));
ret = __check_metadata_get_parameter(_metadata, value);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
- FLAC::File *_file = dynamic_cast<FLAC::File*> _metadata->file;
+ auto _file = dynamic_cast<FLAC::File*>(_metadata->file);
*value = g_strdup_printf("%u", _file->pictureList().size());
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tag pointers
- MPEG::File *_file = dynamic_cast<MPEG::File*>(metadata->file);
- ID3v1::Tag *tag1 = _file->ID3v1Tag();
- ID3v2::Tag *tag2 = _file->ID3v2Tag();
+ auto _file = dynamic_cast<MPEG::File*>(metadata->file);
+ auto tag1 = _file->ID3v1Tag();
+ auto tag2 = _file->ID3v2Tag();
switch (attribute) { // Check which one of frame types was given to the function for processing
case METADATA_EDITOR_ATTR_ARTIST: return __ID3_getTwixFrameByName(metadata, tag1, tag2, "TPE1", value);
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- FLAC::File *_file = (FLAC::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->xiphComment(false);
+ auto _file = (FLAC::File*)metadata->file;
+ auto xtag = _file->xiphComment(false);
if (!xtag) { // Check if we have a valid tag for processing
metadata_editor_error("Tag does not exist");
*value = NULL;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- Ogg::Vorbis::File *_file = (Ogg::Vorbis::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->tag();
+ auto _file = (Ogg::Vorbis::File*)metadata->file;
+ auto xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
metadata_editor_error("Tag does not exist");
*value = NULL;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- Ogg::FLAC::File *_file = (Ogg::FLAC::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->tag();
+ auto _file = (Ogg::FLAC::File*)metadata->file;
+ auto xtag = _file->tag();
if (!xtag) { // Check if we have a valid tag for processing
metadata_editor_error("Tag does not exist");
*value = NULL;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_get_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tag pointers
- RIFF::WAV::File *_file = (RIFF::WAV::File*)metadata->file;
- ID3v2::Tag *tag2 = _file->tag();
+ auto _file = (RIFF::WAV::File*)metadata->file;
+ auto 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");
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- MPEG::File *_file = (MPEG::File*)metadata->file;
- ID3v1::Tag *tag1 = _file->ID3v1Tag();
- ID3v2::Tag *tag2 = _file->ID3v2Tag(true);
+ auto _file = (MPEG::File*)metadata->file;
+ auto tag1 = _file->ID3v1Tag();
+ auto tag2 = _file->ID3v2Tag(true);
metadata_editor_retvm_if(tag2 == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- FLAC::File *_file = (FLAC::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->xiphComment(true);
+ auto _file = (FLAC::File*)metadata->file;
+ auto 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");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- Ogg::Vorbis::File *_file = (Ogg::Vorbis::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->tag();
+ auto _file = (Ogg::Vorbis::File*)metadata->file;
+ auto 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");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- Ogg::FLAC::File *_file = (Ogg::FLAC::File*)metadata->file;
- Ogg::XiphComment *xtag = _file->tag();
+ auto _file = (Ogg::FLAC::File*)metadata->file;
+ auto 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");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
metadata_editor_retvm_if(ret != METADATA_EDITOR_ERROR_NONE, ret, "fail to __check_metadata_set_parameter() [%d]", ret);
// Bring the pointer to actual file type and make tags pointers
- RIFF::WAV::File *_file = (RIFF::WAV::File*)metadata->file;
- ID3v2::Tag *tag2 = _file->tag();
+ auto _file = (RIFF::WAV::File*)metadata->file;
+ auto tag2 = _file->tag();
// Check if the valid tag pointer exist
- if (tag2 == NULL) {
+ if (!tag2) {
metadata_editor_error("Error. ID3v2 tag was not created. Can not proceed metadata updating");
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
switch (_metadata->filetype) {
case METADATA_EDITOR_FORMAT_MP3: {
- MPEG::File *_file = (MPEG::File*)_metadata->file;
- ID3v1::Tag *tag1 = _file->ID3v1Tag();
+ auto _file = (MPEG::File*)_metadata->file;
+ auto tag1 = _file->ID3v1Tag();
if (!tag1 || tag1->isEmpty()) { // If no ID3v1 tag - prevent its creation
if (_file->save(MPEG::File::ID3v2 | MPEG::File::APE))
{
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. No ID3v2 tag in file.");
- ID3v2::FrameList lst = tag->frameListMap()["APIC"];
+ auto lst = tag->frameListMap()["APIC"];
// Check if there are pictures in the tag
if (lst.isEmpty()) {
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
- MP4::CoverArtList lst = tag->item("covr").toCoverArtList();
+ auto lst = tag->item("covr").toCoverArtList();
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) {
#if 0
static int __get_flac_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type)
{
- FLAC::File *_file = (FLAC::File*) metadata->file;
- List<FLAC::Picture*> lst = _file->pictureList();
+ auto _file = (FLAC::File*) metadata->file;
+ auto lst = _file->pictureList();
if (lst.isEmpty()) {
metadata_editor_error("No pictures in FLAC file");
static int __get_wav_picture(metadata_editor_s *metadata, int index, void **picture, int *size, char **mime_type)
{
- RIFF::WAV::File *_file = (RIFF::WAV::File*)metadata->file;
+ auto _file = (RIFF::WAV::File*)metadata->file;
return __get_APIC(_file->tag(), index, picture, size, mime_type);
}
metadata_editor_retvm_if(!tag, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Tag does not exist");
MP4::CoverArtList lst;
- MP4::CoverArt::Format format = MP4::CoverArt::Unknown;
+ auto format = MP4::CoverArt::Unknown;
if (strncmp(mime_type, MIME_TYPE_JPEG, strlen(MIME_TYPE_JPEG)) == 0)
format = MP4::CoverArt::JPEG;
else if (strncmp(mime_type, MIME_TYPE_PNG, strlen(MIME_TYPE_PNG)) == 0)
#if 0
static int __append_flac_picture(metadata_editor_s *metadata, const char *picture, size_t size, const char *mime_type)
{
- FLAC::File *_file = (FLAC::File*) metadata->file;
+ auto _file = (FLAC::File*) metadata->file;
auto frontCover = new FLAC::Picture;
metadata_editor_debug_fenter();
{
metadata_editor_retvm_if(tag == NULL, METADATA_EDITOR_ERROR_OPERATION_FAILED, "Error. ID3v2 tag was not created. Can not proceed metadata updating");
- ID3v2::FrameList lst = tag->frameListMap()["APIC"];
+ auto lst = tag->frameListMap()["APIC"];
metadata_editor_retvm_if(lst.isEmpty(), METADATA_EDITOR_ERROR_OPERATION_FAILED, "No pictures in file");
if ((index < 0) || ((uint)index >= lst.size())) {
return METADATA_EDITOR_ERROR_OPERATION_FAILED;
}
- MP4::CoverArtList lst = tag->item("covr").toCoverArtList();
+ auto lst = tag->item("covr").toCoverArtList();
// Check if the index is in range of CoverArtList Item
if ((index < 0) || ((uint)index >= lst.size())) {
#if 0
static int __remove_flac_picture(metadata_editor_s *metadata, int index)
{
- FLAC::File *_file = dynamic_cast<FLAC::File*> metadata->file;
- List<FLAC::Picture*> lst = _file->pictureList();
+ auto _file = dynamic_cast<FLAC::File*>(metadata->file);
+ auto lst = _file->pictureList();
if (lst.isEmpty()) {
metadata_editor_error("No pictures in file. Nothing to delete");