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