changeset 1190:ce5a5c9cd9d8

Tweaks to MP3 comp tool
author Brian Neal <bgneal@gmail.com>
date Sun, 13 Mar 2022 13:09:37 -0500
parents 83dd2db291f7
children cc4683870919
files tools/sg101mp3comptool.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/sg101mp3comptool.py	Mon Dec 27 19:35:53 2021 -0600
+++ b/tools/sg101mp3comptool.py	Sun Mar 13 13:09:37 2022 -0500
@@ -15,6 +15,7 @@
 
 def process_mp3(mp3, args):
     title = mp3['fields']['title']
+    print(f'Processing {title}...')
     m = TITLE_RE.match(title)
     track_num = int(m[1])
     artist = m[2].strip()
@@ -23,6 +24,8 @@
     filepath = os.path.join(args.mp3_dir, filename)
 
     mp3file = eyed3.load(filepath)
+    if mp3file.tag is None:
+        mp3file.tag = eyed3.id3.tag.Tag()
     mp3file.tag.clear()
     mp3file.tag.title = title
     mp3file.tag.artist = artist