Git Product home page Git Product logo

nitram509 / ascii-telnet-server Goto Github PK

View Code? Open in Web Editor NEW
265.0 16.0 74.0 1.43 MB

Can stream an ~20 minutes ASCII movie via Telnet emulation as stand alone server or via xinetd daemon. Using famous ASCII art animation from www.asciimation.co.nz (Star ASCIIMATION Wars)

License: BSD 2-Clause "Simplified" License

Python 99.21% Dockerfile 0.79%
python xinetd nerd nerd-tool ascii-art ascii-graphics ascii asciinema

ascii-telnet-server's Introduction

ASCII art movie Telnet player

Can stream an ~20 minutes ASCII movie via Telnet emulation as stand alone server or via xinetd daemon.

Screenshot:

Wanna see it in action? Just watch http://asciinema.org/a/3132

Tested with Python 2.6+, Python 3.5+

Original art work : Simon Jansen http://www.asciimation.co.nz/
Telnetification & Player coding : Martin W. Kirst
Python3 Update: Ryan Jarvis Dockerfile contributed by: Manuel Eusebio de Paz Carmona

Build Status Build Status

Command line parameters

See program output:

$ python ascii_telnet_server.py --help
Usage: ascii_telnet_server.py [options]
Options:
  -h, --help            show this help message and exit
  --standalone          Run as stand alone multi threaded TCP server (default)
  --stdout              Run with STDIN and STDOUT, for example in XINETD
                        instead of stand alone TCP server. Use with python
                        option '-u' for unbuffered STDIN STDOUT communication
  -f FILE, --file=FILE  Text file containing the ASCII movie
  -i INTERFACE, --interface=INTERFACE
                        Bind to this interface (default '0.0.0.0', all
                        interfaces)
  -p PORT, --port=PORT  Bind to this port (default 23, Telnet)
  -v, --verbose         Verbose (default for TCP server)
  -q, --quiet           Quiet! (default for STDIN STDOUT server)

Run as stand alone server

Simple call this Python script by using the sample movie file:

$> python ascii_telnet_server.py --standalone -f ../sample_movies/sw1.txt
Running TCP server on 0.0.0.0:23
Playing movie sw1.txt

Run as docker container

Simply build & run the container and use the movie file as environment parameter the sample movie file:

# Build image:
$> docker build -t ascii-art-movie-telnet-player .

# MODE STDOUT: Run as local player

# with the default movie
$> docker run -it --rm -e mode=stdout ascii-art-movie-telnet-player

# with a custom movie file.txt (absolute path to file it's required):
$> docker run -it --rm -v $(pwd)/your_movie.txt:/app/input_file.txt -e input_file=input_file.txt ascii-art-movie-telnet-player

# MODE STANDALONE: Run as local telnet server
# To test, open a telnet client in other terminal/session i.e. $> telnet localhost 23

# with the default movie
$> docker run -it --rm -p 23:23 -e mode=standalone ascii-art-movie-telnet-player

# Run with custon input_file.txt movie
$> docker run -it --rm -v $(pwd)/your_movie.txt:/app/input_file.txt -p 23:23 -e mode=standalone -e input_file=input_file.txt ascii-art-movie-telnet-player

Run as xinetd program

place this configuration into /etc/xinetd.d/telnet:

# default: on
# description: An telnet service playing an ASCII movie, Star Wars Episode 4 
service telnet
{
        disable         = no
        socket_type     = stream
        protocol        = tcp
        port            = 23
        user            = root
        wait            = no
        instances       = 10

        log_type        = FILE /var/log/asciiplayer
        log_on_success  += PID HOST DURATION
        log_on_failure  = HOST
        server          = /usr/bin/python
        server_args     = -u -OO /opt/asciiplayer/ascii_telnet_server.py -f /opt/asciiplayer/sw1.txt --stdout
}

Stargazers over time

Stargazers over time

ascii-telnet-server's People

Contributors

bitdeli-chef avatar cabalist avatar nitram509 avatar pelirrojo avatar rezzonico avatar zenithalhourlyrate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ascii-telnet-server's Issues

Can't run: 'Movie' object has no attribute 'load'

Tried for a quick test run the movie, however, script has an error and not working:

~/_git_repos/ascii-telnet-server $ python3.6 ascii_telnet_server.py -f ./movies/badapple.txt --stdout -S 80x24 -s 80x25 -r 60
Traceback (most recent call last):
  File "ascii_telnet_server.py", line 199, in <module>
    run_std_out(options.filename, framerate, screen_width, screen_height, frame_width, frame_height)
  File "ascii_telnet_server.py", line 110, in run_std_out
    movie.load(filepath)
AttributeError: 'Movie' object has no attribute 'load'

Not able to run custom movie

I did a text movie according to the examples but I always get this

Playing movie sample_movies/computer.txt
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52912)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 599, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 655, in __init__
    self.handle()
  File "/home/lain/Programs/ascii-telnet-server/ascii_telnet/ascii_server.py", line 57, in handle
    movie.load(TelnetRequestHandler.filename)
  File "/home/lain/Programs/ascii-telnet-server/ascii_telnet/ascii_movie.py", line 170, in load
    time_metadata = int(line.strip())
ValueError: invalid literal for int() with base 10: '@@@@  O  @@@@@@ |||| @@@@@@  O  @@@@@@ |||| @@@@@@  O  @@@@@@ |||| @@@@@@  O  @@@@@@ |||| @@@@@@  O  @@@@@@ ||'
----------------------------------------
^CAscii Player Quit.

Package for PyPI

This would be a fun thing to have in PyPI. Any interest in a patch to get it setup there?

How many issues and commits and what was my time it?

It doesn't make sense until your're sleep deprived enough. I have never been so carefeul on variable names on a script in my life. My deployment was focused on one thing, and you all have some issues you arent dealing with. You are not ready for my commit.

Python3 support

Hey there! This project seems pretty inactive but it is cool. I submitted a Pull request with Python3 support, bug fixes, more modular code, updated README, and some small tests.

How to play in server Client environment

Hi,
thanks for the code. I am looking to host the movie on a server and let other machine telnet to it and play the ascii movie. Can you please advice if that is possible with the code.

Thanks,
Amit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.