fix no id3 tag error
This commit is contained in:
parent
78f681791f
commit
f93bc1a0eb
1 changed files with 7 additions and 1 deletions
|
@ -121,7 +121,13 @@ class DelojzaBot:
|
|||
artist, title = self.extract_tags(info)
|
||||
message.reply_text("Tagging as \"{}\" by \"{}\"".format(title, artist))
|
||||
self.logger.info("Tagging %s w/ $s - $s...".format(globbed, title, artist))
|
||||
id3 = mutagen.id3.ID3(globbed)
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(globbed)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
mutafile = mutagen.File(globbed)
|
||||
mutafile.add_tags()
|
||||
mutafile.save()
|
||||
id3 = mutagen.id3.ID3(globbed)
|
||||
id3.add(mutagen.id3.TIT2(encoding=3, text=title))
|
||||
if artist:
|
||||
id3.add(mutagen.id3.TOPE(encoding=3, text=artist))
|
||||
|
|
Loading…
Reference in a new issue