-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ascii movies ;-) #5
Comments
hey, looks like that should more or less already work in theory. from the options listed for that ascii movie project in the README:
slacknimate is already designed to take input from STDIN, so you can just pipe it like:
depending on what the text output looks like, you might want to pipe it through another script in the middle to "clean" it before posting to slack (e.g. possibly wrapping it in the ` backticks so Slack renders it as monospaced font, etc). |
Glad to see that you notice the importance of this killer-feature :-D |
I'll try my luck, maybe learn golang today ^^ I had a look to the code. Should be doable by introducing a new scanner, right? The only problem is the delay but maybe I can set it to 0 and delay within the scanner |
Yeah, it would be done via a different scanner.
I would actually encourage you to try writing a simple conversion script
that can sit between the two programs though, since a) that better fits the
unix philosophy of composition, and it will probably be more useful in a
general purpose way, b) I would like to keep slacknimate as simple as
possible and it introduce a bunch of niche formats, especially since it's
primary usage is devops. (I'd be happy to link to the program in the
readme though!) c) then you can use whatever language you like most!
Basically you would probably want to convert each "frame" into a single
line by escaping the line breaks in whatever format slack wants (I suspect
\n, but I'm on my phone in an airport at the moment and can't look it up),
and output the next frame after an appropriate delay.
Slacknimate can also be set to a very short (or nonexistent) minimum delay,
but beware potential slack API rate limits in that case (would be curious
to see what you find! Please be conservative though, I would hate for the
Slack team to make API limits more aggressive to ban the behavior and make
this program obsoleted. In this past I've found one frame per second to
already be aggressive enough that it starts annoying coworkers)
…On Fri, Apr 28, 2017 at 2:42 PM micw ***@***.***> wrote:
I'll try my luck, maybe learn golang today ^^ I had a look to the code.
Should be doable by introducing a new scanner, right? The only problem is
the delay but maybe I can set it to 0 and delay within the scanner
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACeyuLcaiZ8iOT3EvU65g9pFxdXiTroks5r0jMggaJpZM4NLd2a>
.
|
Hm, read this too late. Meanwhile I got a brief impression of golang and wrote an initial release (see my fork at https://github.com/micw/slacknimate. A converting program might work but it can only have either loop or correct delays, not both... Edit: Example: curl -s https://raw.githubusercontent.com/nitram509/ascii-telnet-server/master/sample_movies/short_intro.txt | bin/slacknimate --api-token xoxp-... --channel ... --movie |
Fun! Since you mentioned you were just learning Go now -- Even though I suspect we'll end up with the separate program piping solution, let me know if you want me to code review this commit for idiomatic Go and offer some pointers in case you're curious to learn more about the language (I'm certainly no expert, and it's not exactly my favorite language, but I can probably point out some things.)
That's correct. You'll see in main.go that
Actually you should technically still be able to do this -- have your program handle the looping vs not looping and post stuff to STDOUT with the timing you want (and probably disable buffering if you are using a language that automatically buffers stdout), and run slacknimate in normal mode so it posts input whenever it receives it. When your program exits, it will automatically EOF the stdout, which will cause slacknimate to detect this and stop posting gracefully and exit itself. |
Hey, great stuff, I really like it.
If you integrate it with https://github.com/nitram509/ascii-telnet-server we cold use slack as movie player ^^
The text was updated successfully, but these errors were encountered: