Permalink
Browse files

Convert audio length to an int

  • Loading branch information...
dbrgn committed Mar 31, 2013
1 parent 1cdc6a1 commit 20a217112beb33874d7204103fa63fb5643ce66f
Showing with 2 additions and 1 deletion.
  1. +1 −0 shiva/models.py
  2. +1 −1 shiva/utils.py
View
@@ -108,6 +108,7 @@ class Track(db.Model):
slug = db.Column(db.String(128), unique=True)
bitrate = db.Column(db.Integer)
file_size = db.Column(db.Integer)
+ # TODO could be float if number weren't converted to an int in metadata manager
length = db.Column(db.Integer)
# TODO number should probably be renamed to track or track_number
number = db.Column(db.Integer)
View
@@ -114,7 +114,7 @@ def genre(self, value):
@property
def length(self):
"""The length of the song in seconds."""
- return self.reader.info.length
+ return int(round(self.reader.info.length))
@property
def bitrate(self):

0 comments on commit 20a2171

Please sign in to comment.