nitram509 / ascii-telnet-server

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)
BSD 2-Clause "Simplified" License
273 stars 72 forks source link

Not able to run custom movie #12

Open lisbonjoker opened 3 years ago

lisbonjoker commented 3 years ago

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.
nitram509 commented 3 years ago

Hi,

thanks for reporting this issue. May I ask, if there's a chance to upload the sample movie? From the error I guess, there's an issue with the file.

Regards Martin

lisbonjoker commented 3 years ago

This is the code https://paste.fiery.me/?0f3b73a0fa94b11f#6PijaM5xThnBtbddqtoc6jknEN1hDtJmadZW84KeMvUf computer.txt

nitram509 commented 3 years ago

Unfortunately, I can't get the file you've linked.

This is what I see, when I click the link. What I'm doing wrong?

Screenshot 2021-04-06 at 11 05 48
lisbonjoker commented 3 years ago

Odd, I'll try send it here: computer.txt

lisbonjoker commented 3 years ago

Do you know what could be?

nitram509 commented 3 years ago

Hi,

the original specification limits the number of characters per line and the number of lines to 67x14 characters. The player is somewhat restricted to that magic numbers. After looking at your provided files, it seems to not match this restrictions.

You may can shrink your movie file, no? Alternatively, feel free to provide a PR to make the player configurable for other movie source sizes ;) (currently I can't work on that.)

From ascii_movie.py

    def load(self, filepath):
        """
        Loads the ASCII movie from given text file.
        Using an encoded format, described on
        http://www.asciimation.co.nz/asciimation/ascii_faq.html
        In short:
            67x14 chars
            lines separated with \n
            first line is a number telling delay in number of frames
            13 lines effective frame size
            15 frames per second

        Args:
            filepath (str): Path to Ascii Movie Data
        """

Original spec ... http://www.asciimation.co.nz/asciimation/ascii_faq.html

ZenithalHourlyRate commented 3 years ago

Alternatively, feel free to provide a PR to make the player configurable for other movie source sizes ;)

There used to be a commit https://github.com/nitram509/ascii-telnet-server/commit/e3753e13a8db86f3aa2cb50546626b92913a3663 that implemented this function. But it was reverted by https://github.com/nitram509/ascii-telnet-server/commit/930aa00d8a32a24f31397df8a9455a8173658d1c. Shrug.

I would like to suggest nitram509 reverting this revert or cherry-pick some of my commits. For lisbonjoker, you may try my fork in https://github.com/ZenithalHourlyRate/ascii-telnet-server

nitram509 commented 3 years ago

Oh, you're right. And I apologize for not remembering ... this was once in but AFAIK did not work as expected, hence reverted and moved into a separate branch https://github.com/nitram509/ascii-telnet-server/tree/refactoring-auto-detection-frame-size. Also, I thought it would be smarter to auto-detect the frame size, as I guess, that would be easier for everyone to use then.

I'm sorry for not mentioning this earlier and I will have a look at your fork.

Thank you, for pointing this out.

ZenithalHourlyRate commented 3 years ago

AFAIK did not work as expected,

I wonder if you are referring to #10. I think that was caused by this single commit 81606544edbcf327e7a23238b3c31194d69a6c06. As I indicated in my comment, the state in commit 5b69116 works as expected.

hence reverted

I suggested reverting that single commit in that comment, but I'm afarid that you have reverted too many.

Also, I thought it would be smarter to auto-detect the frame size, as I guess, that would be easier for everyone to use then.

Detecting is hard, as we need to place some metadata in the movie file, thus designing the file format, or having some assumption about the movie file content. I suggest giving these parameters manually as a middle step.

I will have a look at your fork.

That fork remains what it was when I was sending PR to you, so no need to look at that again. Just review the earlier commits in this repo.

ZenithalHourlyRate commented 3 years ago

Odd, I'll try send it here: computer.txt

I have looked into your movie. You meant to use 110x24 as your frame size, but your first six frames did not follow this convention. Here is a fixed version of your movie. computer.txt

With this version, you may play it using the earlier version (or my fork) by the following command

python3 ascii_telnet_server.py -f /path/to/your/computer.txt --stdout -S 110x24 -s 110x25 -r 5