tuffy / python-audio-tools

A collection of audio handling programs which work from the command line.
http://audiotools.sourceforge.net
GNU General Public License v2.0
249 stars 58 forks source link

Do not explicitly add Part-of-compilation tag to M4A files #53

Open moubctez opened 8 years ago

moubctez commented 8 years ago

I noticed that M4A files always have Part-of-compilation ('cpil') tag added and set to 'yes'. In my opition, this is wrong. I am attaching a patch to remove this behaviour. To fix the issue correctly, audio-tools should handle "compilation" metadata for supported audio formats (I think FLAC uses COMPILATION=1). Please, fix. :)

--- audiotools/m4a_atoms.py.orig    2015-09-29 16:42:11.000000000 +0000
+++ audiotools/m4a_atoms.py
@@ -1422,11 +1422,6 @@ class M4A_META_Atom(MetaData, M4A_Tree_A
                     [M4A_ILST_COVR_Data_Atom.converted(
                         metadata.front_covers()[0])]))

-        ilst_atoms.append(
-            M4A_ILST_Leaf_Atom(
-                b'cpil',
-                [M4A_Leaf_Atom(b'data',
-                               b'\x00\x00\x00\x15\x00\x00\x00\x00\x01')]))

         return cls(0, 0, [M4A_HDLR_Atom(0, 0, b'\x00\x00\x00\x00',
                                         b'mdir', b'appl', 0, 0, b'', 0),
tuffy commented 8 years ago

Since the part-of-compilation flag is available in Vorbis comments, ID3v2.2/3/4 and probably APEv2, it may be better to add it as a field in the MetaData class. That'll mean the "cpil" atom gets added only if set in the source metadata instead of (wrongly) all the time like it is now.