Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert audio length to an int

  • Loading branch information...
commit 20a217112beb33874d7204103fa63fb5643ce66f 1 parent 1cdc6a1
@dbrgn authored
Showing with 2 additions and 1 deletion.
  1. +1 −0  shiva/models.py
  2. +1 −1  shiva/utils.py
View
1  shiva/models.py
@@ -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
2  shiva/utils.py
@@ -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):
Please sign in to comment.
Something went wrong with that request. Please try again.