Add Track class

This class will be used to store metadata about each song (year, length,
genre ...)
This commit is contained in:
Bryan Schumaker 2010-11-09 23:24:49 -05:00
parent 6ad263d712
commit 0e2898a0f6
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Bryan Schumaker (11/09/2010)
import datetime
timedelta = datetime.timedelta
class Track:
def __init__(self, tags, audio):
self.genre = tags.genre or u"Unknown Genre"
self.track = tags.track
self.year = tags.year
self.rate = audio.bitrate
self.channel = audio.channels
self.seconds = audio.length
self.sample = audio.sampleRate
lenstr = "%s" % timedelta(seconds=self.seconds)
if lenstr[0] == "0" and lenstr[1] == ":":
self.lenstr = lenstr[2:]
else:
self.lenstr = lenstr
#self.fs = None
#self.tags = None