slack_color_theme_generator's People
Forkers
gabrielletslack_color_theme_generator's Issues
Start Me Up - when i fall over
With the current deployment strategy (ssh onto the box, run mix run --no-halt
in a shell) when an error happens (which seems to be related to unprocessable images or something), let's at least try to fire up the app again
Add a simple web server that shows generated themes
Add a webserver that has a page that has a list of cataloged themes. see #5
Add logging
I'd love it if we can run this thing (like a proper server) and have a log file that we could check to see if things are working.
Currently, I login to my host machine and run
mix run --no-halt &
in a screen and then i record the PID and that's it.
i'd much rather something like
service c5_picturemethis start
then be able to go to the machine and check the logs when shits broke.
maybe we need distillery
?
Allow CLI to run without starting the slack bot
I want to be able to run
./slack_color_theme_generator filename.gif
on the commandline and have it print out the theme.
right now, it seems to be trying to start up the slackbot.
Gracefully handle and report when histogram computation fails
When the histogram generation fails (imagemagick falls over), log this somewhere
Stash a list of generated themes in ETS
every time a theme is generated,
could we store the theme in the app in ETS or something?
Add a `status` slack endpoint
When i direct message the bot with something like
@picturemethis what's up?
@picturemethis status?
@picturemethis are you tired?
@picturemethis are you there?
Report something if the bot is up.
like
"Yeah, i'm here but so tired"
"Nobody loves me. Everybody hates me. I guess I'll go eat worms"
Running cli locally results in Mogrify IO error?
I've been trying to get this running locally on my machine for a bit without much success. After uncommenting the escript
function in mix.exs
and commenting out the application
function, I was able to get it to run, but I promptly ran into this Erlang error that seems to be related to file IO. This is the stack trace I get.
Gabrielles-MacBook-Air:slack_color_theme_generator Gabrielle$ mix escript.build
Compiling 1 file (.ex)
warning: defp inspector/2 is private, @doc attribute is always discarded for private functions/macros/types
lib/slack_color_theme_generator.ex:6
Generated escript slack_color_theme_generator with MIX_ENV=dev
Gabrielles-MacBook-Air:slack_color_theme_generator Gabrielle$ ./slack_color_theme_generator ./clouds.jpg
13:13:27.034 [info] Generating for ./clouds.jpg
13:13:27.035 [info] Computing histogram from ./clouds.jpg
** (ErlangError) Erlang error: :enoent
(elixir) lib/system.ex:622: System.cmd("convert", ["-background", "white", "-alpha", "remove", "-colors", "8", "+dither", "-format", "%c", "/Users/Gabrielle/workspace/slack_color_theme_generator/clouds.jpg", "histogram:info:-"], [stderr_to_stdout: false])
(mogrify) lib/mogrify.ex:68: Mogrify.histogram/1
(slack_color_theme_generator) lib/slack_color_theme_generator.ex:125: SlackColorThemeGenerator.histogram/1
(slack_color_theme_generator) lib/slack_color_theme_generator.ex:31: SlackColorThemeGenerator.generate/2
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
(slack_color_theme_generator) lib/slack_color_theme_generator/cli.ex:4: SlackColorThemeGenerator.CLI.main/1
(elixir) lib/kernel/cli.ex:105: anonymous fn/3 in Kernel.CLI.exec_fun/2
Gabrielles-MacBook-Air:slack_color_theme_generator Gabrielle$
I also tried some debugging by adding this to the histogram function:
image = Mogrify.open(file)
Logger.info( fn -> "Image is #{Mogrify.verbose(image)}" end)
which resulted in a similar stack trace.
Gabrielles-MacBook-Air:slack_color_theme_generator Gabrielle$ ./slack_color_theme_generator ./clouds.jpg
13:15:34.197 [info] Generating for ./clouds.jpg
13:15:34.199 [info] Computing histogram from ./clouds.jpg
** (ErlangError) Erlang error: :enoent
(elixir) lib/system.ex:622: System.cmd("mogrify", ["-verbose", "-write", "/dev/null", "/Users/Gabrielle/workspace/slack_color_theme_generator/clouds.jpg"], [stderr_to_stdout: true])
(mogrify) lib/mogrify.ex:165: Mogrify.verbose/1
(slack_color_theme_generator) lib/slack_color_theme_generator.ex:119: anonymous fn/1 in SlackColorThemeGenerator.histogram/1
(logger) lib/logger.ex:758: Logger.normalize_message/2
(logger) lib/logger.ex:618: Logger.bare_log/3
(slack_color_theme_generator) lib/slack_color_theme_generator.ex:119: SlackColorThemeGenerator.histogram/1
(slack_color_theme_generator) lib/slack_color_theme_generator.ex:31: SlackColorThemeGenerator.generate/2
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
Gabrielles-MacBook-Air:slack_color_theme_generator Gabrielle$
Any thoughts?
Support transparency
This image when run through Mr Themer generates a theme like:
#081F2DFF,#557492FF,#3A4E5BFF,#063155FF,#BCB6B5FF,#7D8D9CFF,#8F6E55FF,#136099FF
Notice all the colors are RGBA. We should probably truncate them all to RGB. Not sure what made it trigger this. You can see that the transparency is set 255 (FF) for all colors so it seems kind of dumb. But doesn't seem like it'd be big deal to just through out the alpha channel before sending the theme back.
Report to slack when the input image is not colorful enough
When the histogram generation fails because the image doesn't have enough colors (imagemagick doesn't blow up but it finds < 8 colors in the image), send a message to slack that says something snarky like "That image does not have enough delight for me to give you a theme. Try something more colorful"
Color ordering
Currently, colors are sorted in order of apparent lightness.
This works pretty well for slack, but can break down on reverse type highlighting, etc.
It'd be nice if color ordering could be consistently good for slack.
Handle gifs
I have a feeling that animated gifs (maybe all gifs) are not being properly handled.
Investigate and if they are not working, fix it.
This could be about the imagemagick
install on the slackbot machine. or... it might be that the histogram thing needs to do some preprocessing of gifs before it can get a histogram.
delete themes when images that generated them are deleted
when an image is posted by user A
a theme is generated.
when that post is removed
the associated theme post should also be removed.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.