fix tag function logging; don't try to tag with None

This commit is contained in:
Tomáš Mládek 2019-05-02 19:29:58 +02:00
parent e5c66265f3
commit 3368f27588

View file

@ -134,8 +134,12 @@ class DelojzaBot:
artist = artist.strip() if artist else None artist = artist.strip() if artist else None
title = title.strip() if title else None title = title.strip() if title else None
if title is None and artist is None:
message.reply_text("Tried tagging, found nothing :(")
return
message.reply_text("Tagging as \"{}\" by \"{}\"\nvia {}".format(title, artist, source)) message.reply_text("Tagging as \"{}\" by \"{}\"\nvia {}".format(title, artist, source))
self.logger.info("Tagging %s w/ $s - $s [%s]...".format(filepath, title, artist, source)) self.logger.info("Tagging {} w/ {} - {} [{}]...".format(filepath, title, artist, source))
try: try:
id3 = mutagen.id3.ID3(filepath) id3 = mutagen.id3.ID3(filepath)
except mutagen.id3.ID3NoHeaderError: except mutagen.id3.ID3NoHeaderError: