<commit_before>
from kivy.clock import Clock

import audio as a_m
from defines import *

class GuiPlayer(object):
    def __init__(self, player, widget):
        self.player = player
        self.widget = widget
        total_time = player.get_total_time()
        self.total_time = total_time
        self.audio_remaining_time = total_time
        self.video_remaining_time = total_time
        self.audio_queued_tick = None

    def prompt_for_move(self):
        # Start visual and audio timers
        if self.audio_queued_tick == None:
            self.tick_audio(0)
            self.tick_video(0)

    def make_move(self):
        # Stop both timers
        if self.audio_queued_tick:
            # TODO: subtract fraction of a second already spent
            self.audio_queued_tick.cancel()
            self.video_queued_tick.cancel()

        self.audio_queued_tick = None

    def tick_audio(self, dt):
        a_m.instance.tick()
        self.audio_remaining_time -= dt

        tt = self.total_time
        rem = self.audio_remaining_time

        if rem > 0:
            interval = (.5 * (1 + (rem / tt))) ** 2
            self.audio_queued_tick = Clock.schedule_once(self.tick_audio, interval)

    def tick_video(self, dt):
        self.video_remaining_time -= 1

        rem = self.video_remaining_time

        self.widget.text = "%s:%s" % (rem/60, rem%60)

        if rem > 0:
            self.video_queued_tick = Clock.schedule_once(self.tick_video, 1)

<commit_msg>Time format string<commit_after>
from kivy.clock import Clock

import audio as a_m
from defines import *

class GuiPlayer(object):
    def __init__(self, player, widget):
        self.player = player
        self.widget = widget
        total_time = player.get_total_time()
        self.total_time = total_time
        self.audio_remaining_time = total_time
        self.video_remaining_time = total_time
        self.audio_queued_tick = None

    def prompt_for_move(self):
        # Start visual and audio timers
        if self.audio_queued_tick == None:
            self.tick_audio(0)
            self.tick_video(0)

    def make_move(self):
        # Stop both timers
        if self.audio_queued_tick:
            # TODO: subtract fraction of a second already spent
            self.audio_queued_tick.cancel()
            self.video_queued_tick.cancel()

        self.audio_queued_tick = None

    def tick_audio(self, dt):
        a_m.instance.tick()
        self.audio_remaining_time -= dt

        tt = self.total_time
        rem = self.audio_remaining_time

        if rem > 0:
            interval = (.5 * (1 + (rem / tt))) ** 2
            self.audio_queued_tick = Clock.schedule_once(self.tick_audio, interval)

    def tick_video(self, dt):
        self.video_remaining_time -= 1

        rem = self.video_remaining_time

        self.widget.text = "%s:%02d" % (rem/60, rem%60)

        if rem > 0:
            self.video_queued_tick = Clock.schedule_once(self.tick_video, 1)


{'fraction_non_alphanumeric': 0.08733624454148471, 'fraction_numerical': 0.009405441719852201, 'mean_word_length': 2.1918542336548765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7168453', 'n_tokens_mistral': 963, 'n_tokens_neox': 916, 'n_words': 206}