From 9471aad4baa503c0dfd4f40d9ef7d7bc9f7ceeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Fri, 3 May 2019 11:45:46 +0200 Subject: [PATCH] don't try to tag unnecessarily --- delojza.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/delojza.py b/delojza.py index 1789482..1be6575 100755 --- a/delojza.py +++ b/delojza.py @@ -208,7 +208,13 @@ class DelojzaBot: filenames.append(final_filename) if audio and is_mp3: - self.tag_file(final_filename, message) + try: + id3 = mutagen.id3.ID3(final_filename) + untagged = 'TIT2' not in id3 + except mutagen.id3.ID3NoHeaderError: + untagged = True + if untagged: + self.tag_file(final_filename, message) return filenames