Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-2468

Unexpected behavior of MP3 comment tags when language isn't set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.12
    • 2.7.3
    • Tags & Metadata
    • None
    • OSX 12.3.1

      Context: The default behavior by the mutagen library if no language is set when adding a comment tag to an MP3 file is to set the language to XXX:

      >>> file.tags
      {'TIT2': TIT2(encoding=<Encoding.UTF16: 1>, text=['Test Title']), 'TPE1': TPE1(encoding=<Encoding.UTF16: 1>, text=['Matthew Laney'])}
      >>> file.tags.add(COMM(text=['test comment']))
      >>> file.tags
      {'TIT2': TIT2(encoding=<Encoding.UTF16: 1>, text=['Test Title']), 'TPE1': TPE1(encoding=<Encoding.UTF16: 1>, text=['Matthew Laney']), 'COMM::XXX': COMM(encoding=<Encoding.UTF16: 1>, lang='XXX', desc='', text=['test comment'])} 

      I'm not sure if failing to explicitly specify a language when setting the comment tag is a failure to adhere to the specification. However, given the fact that mutagen allows this to happen without raising an exception, it is to be expected that it will not be uncommon to find this format present in a number of MP3 files in the wild.

      However, Picard handles this poorly. There are at least two problematic, repeatable issues:

      First, deleting the tag doesn't work. Steps to reproduce:

      1. Open an MP3 file in Picard that has a COMM tag with lang set to XXX
      2. Right-click the tag and choose Remove (The tag properly shows red strikeout.)
      3. Click save (The file timestamp does properly show in the OS that it's been modified.)
      4. Remove the file from the Picard window
      5. Reopen the file in Picard
      6. Observe that the comment tag still exists

      Second, modifying the tag produces unexpected results. Steps to reproduce:

      1. Open an MP3 file in Picard that has a COMM tag with lang set to XXX
      2. Right-click the tag and choose Edit
      3. In the Edit Tag window, leave the tag key as: comment:XXX
      4. Double click to edit the tag value and click save in the Edit Tag window
      5. Click save in the main window to save the file
      6. Remove the file from the Picard window
      7. Reopen the file in Picard
      8. Observe that the comment tag key still shows "Comment [XXX]" but the comment tag value now shows "original comment/edited comment"

      For further clarification of the second issue, this is what the edited file shows when inspected with mutagen after attempting to modify the comment tag value in Picard:

      {'TIT2': TIT2(encoding=<Encoding.UTF16: 1>, text=['Test Title']), 'TPE1': TPE1(encoding=<Encoding.UTF16: 1>, text=['Matthew Laney']), 'COMM::XXX': COMM(encoding=<Encoding.UTF16: 1>, lang='XXX', desc='', text=['test comment']), 'COMM:XXX:eng': COMM(encoding=<Encoding.UTF16: 1>, lang='eng', desc='XXX', text=['test comment 2'])} 

            Serial-ATA Serial-ATA
            matthewslaney Matthew Laney
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Version Package
                2.12