Esempio n. 1
0
    def handle(self):
        movie = Movie(TelnetRequestHandler.folder)
        movie.load()

        self.player = VT100Player(movie)
        self.player.draw_frame = self.draw_frame
        self.player.play()
    def handle(self):
        movie = Movie()
        movie.load(TelnetRequestHandler.filename)

        self.player = VT100Player(movie)
        self.player.draw_frame = self.draw_frame
        self.player.play()
Esempio n. 3
0
    def handle(self):
        movie = Movie(TelnetRequestHandler.sizew,
                      TelnetRequestHandler.sizeh,
                      TelnetRequestHandler.fsizew,
                      TelnetRequestHandler.fsizeh)
        movie.load(TelnetRequestHandler.filename)

        self.player = VT100Player(movie, TelnetRequestHandler.framerate)
        self.player.draw_frame = self.draw_frame
        self.player.play()
Esempio n. 4
0
def runStdOut(folder):
    """
    Stream the output of the Ascii Player to STDOUT
    Args:
        filepath (str): file path of the ASCII movie
    """
    def draw_frame_to_stdout(screen_buffer):
        sys.stdout.write(screen_buffer.read().decode('iso-8859-15'))

    movie = Movie(folder)
    movie.load()
    player = VT100Player(movie)
    player.draw_frame = draw_frame_to_stdout
    player.play()
def runStdOut(filepath):
    """
    Stream the output of the Ascii Player to STDOUT
    Args:
        filepath (str): file path of the ASCII movie
    """

    def draw_frame_to_stdout(screen_buffer):
        sys.stdout.write(screen_buffer.read().decode('iso-8859-15'))

    movie = Movie()
    movie.load(filepath)
    player = VT100Player(movie)
    player.draw_frame = draw_frame_to_stdout
    player.play()
Esempio n. 6
0
def runStdOut(filepath, framerate, sizew, sizeh, fsizew, fsizeh):
    """
    Stream the output of the Ascii Player to STDOUT
    Args:
        filepath (str): file path of the ASCII movie
        framerate (int): FPS of the movie
        sizew (int): Width of the screen
        sizeh (int): Height of the screen(Including timebar)
        fsizew (int): Width of the movie
        fsizeh (int): Height of the movie
    """
    def draw_frame_to_stdout(screen_buffer):
        sys.stdout.write(screen_buffer.read().decode('iso-8859-15'))

    movie = Movie(sizew, sizeh, fsizew, fsizeh)
    movie.load(filepath)
    player = VT100Player(movie, framerate)
    player.draw_frame = draw_frame_to_stdout
    player.play()
def make_movie(video_path: str,
               processed_movie_path: str,
               node_executable_path: str = None,
               subtitles_path: str = None,
               seconds_per_slide: int = 3):
    if not node_executable_path:
        node_executable_path = subprocess.run('which node',
                                              shell=True,
                                              capture_output=True,
                                              check=True)
    else:
        assert Path(node_executable_path).exists()
    if not _node_exists_with_right_version(node_executable_path):
        raise SystemError(
            f"You need node installed with at least version {REQUIRED_NODE_VERSION}"
        )

    if not _ascii_video_is_installed():
        raise SystemError(
            "npm install the package.json to ensure ascii-video is installed correctly."
        )

    video_hash = _hash_file(video_path)

    generated_yaml_file = _encode_video_to_ascii(video_path, video_hash,
                                                 node_executable_path)
    movie = Movie()
    print("Loading frames into a movie file...")
    movie.load(str(generated_yaml_file))

    if subtitles_path:
        print("Splicing in subtitles...")
        movie.splice_in_text(subtitles_path, seconds_per_slide)

    print("Pickling move...")
    pickle_path = movie.to_pickle(processed_movie_path)
    print("Pickling complete!")
    return pickle_path