ocarina/trunk/src/songInfo.py

50 lines
890 B
Python

class SongInfo:
def __init__(self):
self.id = 0
self.filename = ""
self.tnum = ""
self.count = 0
# Length is a string, duration is an int
self.length = ""
self.duration = 0
self.title = ""
self.titlel = ""
self.album = ""
self.albuml = ""
self.artist = ""
self.artistl = ""
self.single = dict()
self.double = dict()
def setTime(self,time):
self.duration = time
self.length = self.fixTime(time)
def fixTime(self,time):
#time = self.duration
# Find hour
length = ""
if time >= 3600:
hour = time/3600
time = time - (self.hour * 3600)
if hour > 0:
length=str(hour)+":"
# Find minute
if time >= 60:
min = time/60
time = time - (min * 60)
if min < 10:
length+="0"
length+=str(min)+":"
else:
length+="00:"
# Remainder is seconds
sec = time
if sec < 10:
length+="0"
length+=str(sec)
return length