示例#1
0
    def msg_progress(self, args):
        """Display message with position in current file"""

        # Wait for media file to be properly loaded
        self._player.wait_for_property('time-pos')

        time_pos = fmtseconds(self._player.time_pos)
        perc_pos = round(self._player.percent_pos)

        msg_time_pos = 'progress: {} ({}%)'.format(time_pos, perc_pos)
        msg(self._nvim, msg_time_pos)
示例#2
0
    def get_timepos(self, args):
        """Get formatted time position in current file

        Arguments:
        format -- format string with {H}, {M}, {S}
        """

        # Wait for media file to be properly loaded
        self._player.wait_for_property('time-pos')

        fmt = args[0] if len(args) == 1 else '[{H}:{M}:{S}] '
        return fmtseconds(self._player.time_pos, fmt)
示例#3
0
        def echo_seek(event):
            seek = self._last_seek
            time_pos = fmtseconds(self._player.time_pos)

            if seek == 0:
                seek_msg = 'jump to {}'.format(time_pos)
            else:
                direction = 'forward' if seek > 0 else 'backward'
                seek_msg = 'seek {} ({:+d}s): {}'.format(direction,
                                                         seek, time_pos)

            msg(self._nvim, seek_msg)
            self._last_seek = 0