38 lines
708 B
Python
38 lines
708 B
Python
from duration import Duration
|
|
|
|
class SongInfo:
|
|
def __init__(self):
|
|
self.id = 0
|
|
self.filename = ""
|
|
self.count = 0
|
|
# Length is a string, duration is an int
|
|
self.length = ""
|
|
self.duration = 0
|
|
self.title = ""
|
|
self.album = ""
|
|
self.artist = ""
|
|
|
|
|
|
def fixTime(self):
|
|
time = self.duration
|
|
# Find hour
|
|
if time >= 3600:
|
|
hour = time/3600
|
|
time = time - (self.hour * 3600)
|
|
if hour > 0:
|
|
self.length=str(hour)+":"
|
|
# Find minute
|
|
if time >= 60:
|
|
min = time/60
|
|
time = time - (min * 60)
|
|
if min < 10:
|
|
self.length+="0"
|
|
self.length+=str(min)+":"
|
|
else:
|
|
self.length+="00:"
|
|
# Remainder is seconds
|
|
sec = time
|
|
if sec < 10:
|
|
self.length+="0"
|
|
self.length+=str(sec)
|