Skip to content

MP3 strip bug #913

Description

@whatdoineed2do

Update: Fix in pr #914

There is MP3 stripping bug if you have a file with both APE and ID3v1 tag.

If you try to strip using strip(TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::APE); or calling strip(TagLib::MPEG::File::ID3v1) before strip(TagLib::MPEG::File::APE) then saving the file results in the ID3v1 untouched.

However if your file does not have APE tag then this works as expected.

Here is the code to demonstrate:

#include <iostream>
#include <taglib/mpegfile.h>

int main(int argc, char *argv[])
{
    if (argc != 3) {
        return 1;
    }
    try
    {
        TagLib::MPEG::File  f(argv[2], false);

	switch (*argv[1])
	{
            case '0':
// this is the only item that works
	      f.strip(TagLib::MPEG::File::APE);
	      f.strip(TagLib::MPEG::File::ID3v1);
	      break;

// these leave the ID3v1 in the file when there is APE + ID31
// if there is ONLY id3v1 then this is removes the id3v1 tag
            case '1':
	      f.strip(TagLib::MPEG::File::ID3v1);
	      f.strip(TagLib::MPEG::File::APE);
	      break;

	    default:
	      f.strip(TagLib::MPEG::File::ID3v1 | TagLib::MPEG::File::APE);
	}

        f.save(TagLib::MPEG::File::ID3v2);
    }
    catch (const std::exception& ex)
    {
        std::cerr << ex.what() << std::endl;
    }
    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions