summaryrefslogtreecommitdiff
path: root/clSong.py
diff options
context:
space:
mode:
Diffstat (limited to 'clSong.py')
-rw-r--r--clSong.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/clSong.py b/clSong.py
index d2111d7..971245a 100644
--- a/clSong.py
+++ b/clSong.py
@@ -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."""