Commit 53440493 authored by Marinus Schraal's avatar Marinus Schraal

player: Use utils.second_to_string

Also change hh:mm to mm:ss in seconds_to_string docstring.
parent 2de53f3d
......@@ -590,7 +590,8 @@ class Player(GObject.GObject):
def load(self, media):
self.progressScale.set_value(0)
self._set_duration(media.get_duration())
self.songTotalTimeLabel.set_label(self.seconds_to_string(media.get_duration()))
self.songTotalTimeLabel.set_label(
utils.seconds_to_string(media.get_duration()))
self.progressScale.set_sensitive(True)
self.playBtn.set_sensitive(True)
......@@ -832,7 +833,7 @@ class Player(GObject.GObject):
def _on_progress_value_changed(self, widget):
seconds = int(self.progressScale.get_value() / 60)
self.songPlaybackTimeLabel.set_label(self.seconds_to_string(seconds))
self.songPlaybackTimeLabel.set_label(utils.seconds_to_string(seconds))
return False
@log
......@@ -844,13 +845,6 @@ class Player(GObject.GObject):
self.timeout = None
return False
def seconds_to_string(self, duration):
seconds = duration
minutes = seconds // 60
seconds %= 60
return '%i:%02i' % (minutes, seconds)
@log
def _on_play_btn_clicked(self, btn):
if self._get_playing():
......
......@@ -76,10 +76,10 @@ def get_media_title(item):
def seconds_to_string(duration):
"""Convert a time in seconds to a hh:mm string
"""Convert a time in seconds to a mm:ss string
:param int duration: Time in seconds
:return: Time in hh:mm format
:return: Time in mm:ss format
:rtype: string
"""
seconds = duration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment