Skip to content

Commit

Permalink
the attribute might not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
manolomartinez committed Jun 16, 2021
1 parent 2cda4ce commit e927e56
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions greg/aux_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,13 @@ def tag(placeholders):
if file_to_tag.tag == None:
file_to_tag.initTag()
for mytag in tagdict:
if isinstance(getattr(file_to_tag.tag, mytag), eyed3.id3.tag.DltAccessor):
getattr(file_to_tag.tag, mytag).set(tagdict[mytag])
else:
try:
attribute = getattr(file_to_tag.tag, mytag)
if isinstance(attribute, eyed3.id3.tag.DltAccessor):
attribute.set(tagdict[mytag])
else:
setattr(file_to_tag.tag, mytag, tagdict[mytag])
except AttributeError:
setattr(file_to_tag.tag, mytag, tagdict[mytag])
file_to_tag.tag.save()

Expand Down

0 comments on commit e927e56

Please sign in to comment.