Пример #1
0
def play_sound(resource_name):
    """Play the audio resource.

    Arguments:
        resource_name {string} -- name of the wav file resource
    """
    logging.info('Playing audible alert %s', resource_name)
    try:
        # Open the sound file
        path = Utility.get_resource_path(resource_name)
        if path is None:
            return
        Utility.execute_command('aplay', ['-q', path])

    except BaseException:
        logging.error('Failed to play audible alert %s', resource_name)
Пример #2
0
def on_stop_break():
    """
    After the break, play the alert sound
    """
    # Do not play if the break is skipped or postponed
    if context['skipped'] or context['postponed']:
        return

    logging.info('Playing audible alert')
    try:
        # Open the sound file
        path = Utility.get_resource_path('alert.wav')
        if path is None:
            return
        Utility.execute_command('aplay', ['-q', path])

    except BaseException:
        logging.error('Failed to play audible alert')
Пример #3
0
def on_stop_break():
    """
    Lock the screen after a long break if the user has not skipped within min_seconds.
    """
    if lock_screen and seconds_passed >= min_seconds:
        Utility.execute_command(lock_screen_command)