CC-3013: Media Monitor throws exception when trying to convert String to Int.

-fixed
-also specified base 10 radix
This commit is contained in:
Martin Konecny 2011-11-02 10:36:00 -04:00
parent b14f2e894d
commit 5d0f36f130
1 changed files with 3 additions and 3 deletions

View File

@ -197,9 +197,9 @@ class AirtimeMetadata:
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
if match.group(0) is not u'':
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0])
else:
try:
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0], 10)
except Exception, e:
del md['MDATA_KEY_TRACKNUMBER']
#make sure bpm is valid, need to check more types of formats for this tag to assure correct parsing.