Exemplo n.º 1
0
    def _play(self):
        """
        Run the storyboard
        """
        logger.debug(f'play')
        if not self.alt:
            play_sound(self.hal, fs_names.SND_SELECT_LANG)
            wait_for_input(self.hal, self._lang_de, self._lang_en)

            sleep(0.5)
        else:
            self.story = sb_de_alt.STORYBOARD

        try:
            if self.story is None:
                self.story = sb_dummy.STORYBOARD
        except AttributeError:
            pass
        finally:
            if self.test:
                self.story = sb_dummy.STORYBOARD

        for chapter in iter(self.story):
            logger.debug(f'playing chapter {chapter}')
            while chapter.hasnext():
                act = next(chapter)
                logger.debug(f'next activity {act.activity}')
                if act.activity is Activity.WAIT_FOR_INPUT:
                    wait_for_input(hal=self.hal,
                                   go_callback=chapter.mobilize,
                                   back_callback=chapter.rewind)
                elif act.activity is Activity.ADVANCE_UP:
                    if chapter.move and self.move:
                        logger.debug(f'advance{advance}({self.hal.motor_ud}, '
                                     f'{self.hal.ud_sensor})')
                        advance(motor=self.hal.motor_ud,
                                sensor=self.hal.ud_sensor)
                    elif not self.move:
                        play_sound(self.hal, fs_names.StoryFile('stop'))
                else:
                    try:
                        {
                            Activity.PLAY_SOUND: play_sound,
                            Activity.RECORD_SOUND: record_sound,
                            Activity.RECORD_VIDEO: record_video,
                            Activity.TAKE_PHOTO: take_photo,
                            Activity.LIGHT_LAYER: light_layer,
                            Activity.LIGHT_BACK: backlight,
                            # Activity.ADVANCE_UP: noop
                        }[act.activity](self.hal, **act.values)
                    except KeyError:
                        logger.exception('Caught KeyError, ignoring...')
                        pass

        self.state = State.IDLE_END
Exemplo n.º 2
0
from pizzactrl import storyboard, fs_names

STORYBOARD = [
    storyboard.Chapter(
        # storyboard.Do(storyboard.Activity.ADVANCE_UP),
        storyboard.Do(storyboard.Activity.LIGHT_BACK,   # Bild 1
                      intensity=1.0, fade=1.0)
    ),
    storyboard.Chapter(
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
        storyboard.Do(storyboard.Activity.ADVANCE_UP)   # Bild 2
    ),
    storyboard.Chapter(
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 3
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 4
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('01dummy')),
        storyboard.Do(storyboard.Activity.LIGHT_BACK,
                      intensity=0.0),
Exemplo n.º 3
0
from pizzactrl import storyboard, fs_names

STORYBOARD = [
    storyboard.Chapter(  # X1
        # storyboard.Do(storyboard.Activity.ADVANCE_UP),
        storyboard.Do(
            storyboard.Activity.LIGHT_BACK,  # Bild 1
            intensity=1.0,
            fade=1.0)),
    storyboard.Chapter(  # X2
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('03de')),
        storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
        storyboard.Do(storyboard.Activity.ADVANCE_UP)  # Bild 2
    ),
    storyboard.Chapter(  # X3
        storyboard.Do(
            storyboard.Activity.LIGHT_BACK,  # Bild 1
            intensity=1.0,
            fade=1.0),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('04de')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 3
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('05de')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('06de')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('07de')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 4
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
Exemplo n.º 4
0
 ),
 storyboard.Chapter(  # X6
     storyboard.Do(storyboard.Activity.ADVANCE_UP),
     storyboard.Do(storyboard.Activity.ADVANCE_UP)  # Bild 9
 ),
 storyboard.Chapter(  # X9
     storyboard.Do(storyboard.Activity.ADVANCE_UP)  # Bild 10
 ),
 storyboard.Chapter(  # X10
     storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 11
     storyboard.Do(storyboard.Activity.ADVANCE_UP)  # Bild 12
 ),
 storyboard.Chapter(  # X12
     storyboard.Do(storyboard.Activity.LIGHT_BACK, intensity=1., fade=.5),
     storyboard.Do(storyboard.Activity.PLAY_SOUND,
                   sound=fs_names.StoryFile('33de')),
     storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
     storyboard.Do(storyboard.Activity.ADVANCE_UP)  # Bild 13
 ),
 storyboard.Chapter(  # X13
     storyboard.Do(storyboard.Activity.PLAY_SOUND,
                   sound=fs_names.StoryFile('34de')),
     storyboard.Do(storyboard.Activity.LIGHT_BACK, intensity=0., fade=1.),
     storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
     storyboard.Do(storyboard.Activity.PLAY_SOUND,
                   sound=fs_names.SFX_REC_AUDIO),
     storyboard.Do(storyboard.Activity.RECORD_SOUND,
                   filename=fs_names.REC_CITY_NAME,
                   duration=7.0),
     storyboard.Do(storyboard.Activity.PLAY_SOUND,
                   sound=fs_names.SFX_STOP_REC),
Exemplo n.º 5
0
from pizzactrl import storyboard, fs_names

STORYBOARD = [
    storyboard.Chapter(
        # storyboard.Do(storyboard.Activity.ADVANCE_UP),
        storyboard.Do(storyboard.Activity.LIGHT_BACK,   # Bild 1
                      intensity=1.0, fade=1.0)
    ),
    storyboard.Chapter(
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('03en')),
        storyboard.Do(storyboard.Activity.WAIT_FOR_INPUT),
        storyboard.Do(storyboard.Activity.ADVANCE_UP)   # Bild 2
    ),
    storyboard.Chapter(
        storyboard.Do(storyboard.Activity.LIGHT_BACK,   # Bild 1
                      intensity=1.0, fade=1.0),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('04en')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 3
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('05en')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('06en')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('07en')),
        storyboard.Do(storyboard.Activity.ADVANCE_UP),  # Bild 4
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('08en')),
        storyboard.Do(storyboard.Activity.PLAY_SOUND,
                      sound=fs_names.StoryFile('09en')),