Fix error when POPM frame has no count attribute.

This commit is contained in:
Michael Wiencek
2011-06-17 01:17:27 -05:00
parent 830e445bfe
commit e1c8981fef

View File

@@ -268,11 +268,12 @@ class ID3File(File):
# Search for an existing POPM frame to get the current playcount
for frame in tags.values():
if frame.FrameID == 'POPM' and frame.email == settings['rating_user_email']:
count = frame.count
try: count = frame.count
except AttributeError: count = 0
break
else:
count = 0
# Convert rating to range between 0 and 255
rating = int(values[0]) * 255 / (settings['rating_steps'] - 1)
tags.add(id3.POPM(email=settings['rating_user_email'], rating=rating, count=count))