libsaria: Find string representing song pos based on prcnt
I can pass a percentage to get_time_at() and it will return a string representing the time at that spot in the audio stream.
This commit is contained in:
parent
3cb39f3fcd
commit
90901846e4
|
@ -82,8 +82,8 @@ def duration():
|
|||
unlock_audio()
|
||||
return dur
|
||||
|
||||
def get_progstr():
|
||||
sec = position() / 1000000000
|
||||
def make_progstr(spot):
|
||||
sec = spot / 1000000000
|
||||
lenstr = "%s" % timedelta(seconds=sec)
|
||||
if lenstr[0] == "0" and lenstr[1] == ":":
|
||||
lenstr = lenstr[2:]
|
||||
|
@ -91,6 +91,12 @@ def get_progstr():
|
|||
lenstr = lenstr
|
||||
return lenstr.split(".")[0]
|
||||
|
||||
def get_progstr():
|
||||
return make_progstr(position())
|
||||
|
||||
def get_time_at(prcnt):
|
||||
return make_progstr(duration() * prcnt)
|
||||
|
||||
def get_progress():
|
||||
dur = duration()
|
||||
if dur > 0.0:
|
||||
|
|
Loading…
Reference in New Issue