From a656c977f20b3691fff629a7750196020f9c21f1 Mon Sep 17 00:00:00 2001 From: codezjx Date: Thu, 13 Jul 2017 00:49:23 +0800 Subject: [PATCH] Remove old 'APIC' frame, because two 'APIC' may exist together with the different description. --- ncm/file_util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ncm/file_util.py b/ncm/file_util.py index b2303ba..544bb0a 100644 --- a/ncm/file_util.py +++ b/ncm/file_util.py @@ -18,6 +18,11 @@ def add_metadata_to_song(file_path, cover_path, song): # Modify ID3 tags id3 = ID3(file_path) + # Remove old 'APIC' frame + # Because two 'APIC' may exist together with the different description + # For more information visit: http://mutagen.readthedocs.io/en/latest/user/id3.html + if id3.getall('APIC'): + id3.delall('APIC') # add album cover id3.add( APIC(