diff options
Diffstat (limited to 'clSong.py')
-rw-r--r-- | clSong.py | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -6,6 +6,17 @@ class Song: self._data=data if 'id' in self._data: self._data['id']=int(self._data['id']) + if 'track' in self._data: + # make sure the track is a valid number! + t=self._data['track'] + for i in xrange(len(t)): + if ord(t[i])<ord('0') or ord(t[i])>ord('9'): + try: + self._data['track']=int(t[0:i]) + except: + self._data['track']=-1 + break + self._data['track']=int(self._data['track']) def getID(self): """Get the ID.""" |