Ejemplo n.º 1
0
 def race_updated(self, race: Race, entrant_name: str):
     # so the sound doesn't play when the user starts obs next time
     if self.last_session_race == race.name:
         return
     self.started_at = race.started_at
     for trigger in self.triggers:
         self.logger.debug(trigger)
         if trigger.check_trigger(race,
                                  race.get_entrant_by_name(entrant_name)):
             self.play_media_callback(trigger.media_file_path,
                                      self.monitoring_type)
             self.logger.debug("trigger fired")
Ejemplo n.º 2
0
    def update_qualifier_text(self, race: Race, full_name: str):
        if not self.is_enabled():
            return
        entrant = race.get_entrant_by_name(full_name)
        self.logger.debug(entrant)

        self.par_text = " "
        self.entrant_score = " "
        if race.entrants_count_finished >= self.qualifier_cutoff:
            par_time = self.calculate_par_time(race)
            self.logger.debug(par_time)
            self.par_text = timer_to_str(par_time, self.decimals)

            if entrant and entrant.finish_time is not None:
                entrant_score = min(2 - (entrant.finish_time / par_time), 1.05)
                self.entrant_score = "{:04.2f}".format(entrant_score)
            self.logger.debug(self.entrant_score)