From e1c8981fefde1bd1439f3ebdaad930ce450e9273 Mon Sep 17 00:00:00 2001 From: Michael Wiencek Date: Fri, 17 Jun 2011 01:17:27 -0500 Subject: [PATCH] Fix error when POPM frame has no count attribute. --- picard/formats/id3.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/picard/formats/id3.py b/picard/formats/id3.py index c2dbe59b2..ad95f0f24 100644 --- a/picard/formats/id3.py +++ b/picard/formats/id3.py @@ -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))