Update ASCII plugin

This commit is contained in:
Pedro de Oliveira 2019-12-05 21:40:08 +00:00
parent 23af1cca99
commit 655dbf7e58
4 changed files with 1782 additions and 1817 deletions

View File

@ -1,6 +1,9 @@
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T8E56M6SP9JH2)
Try the plugin out in #ircart on EFnet. irc://irc.efnet.org/#ircart
<b>ASCII Art Plugin</b><br>
Convert text to ASCII art or image URLs to ASCII/ANSI art. Covert ASCII art to PNG. Get ASCII weather, moon phase, and cryptocurrecy rates.
@ -103,14 +106,15 @@ img --bg <0-99> <url> (set a background color)
img --fg <0-99> <url> (set a foreground color)
img --fast <url> (use Euclidean color difference.)
img --slow <url> (use cie2000 color difference. best quality, default)
img --dither <url> (dither source image to 256 colors. trades off quality for speed)
img --quantize <url> (quantize source image to 256 colors. trades off quality for speed)
img --no-quantize <url> (don't quantize source to 256 colors)
```
Here are some images using 99 color default output:
![Image of Img Command Output](https://i.imgur.com/33tCGXC.png)<br>
![Image of Img Command Output](https://i.imgur.com/NrMaQdg.png)<br>
^ output of img https://i.imgur.com/aF9wihd.jpg (image command with default settings)
![Image of Img Command Output](https://i.imgur.com/2BSUjnw.png)<br>
![Image of Img Command Output](https://i.imgur.com/ydNaDKc.png)<br>
^ output of img --block https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
![Image of Img Command Output](https://i.imgur.com/eOQAzTo.png)<br>
![Image of Img Command Output](https://i.imgur.com/Q2lsg3H.png)<br>
^ output of img --ascii https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
```
***************+*++++++++++++++++++++++++++++++++++++++=++=++========================---------------

View File

@ -1,43 +1,44 @@
###
# Copyright (c) 2019 oddluck
# All rights reserved.
#
#
###
"""
ASCII: Uses API to retrieve information
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = ""
# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.authors.unknown
# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = ''
from . import config
from . import plugin
from imp import reload
# In case we're being reloaded.
reload(config)
reload(plugin)
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
from . import test
Class = plugin.Class
configure = config.configure
###
# Copyright (c) 2019 oddluck
# All rights reserved.
#
#
###
"""
ASCII: Uses API to retrieve information
"""
import supybot
import supybot.world as world
# Use this for the version of this plugin. You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = ""
# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.Author('oddluck', 'oddluck',
'oddluck@riseup.net')
# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}
# This is a url where the most recent plugin package can be downloaded.
__url__ = 'https://github.com/oddluck/limnoria-plugins/'
from . import config
from . import plugin
from imp import reload
# In case we're being reloaded.
reload(config)
reload(plugin)
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded. Don't forget to import them as well!
if world.testing:
from . import test
Class = plugin.Class
configure = config.configure

View File

@ -1,57 +1,66 @@
###
# Copyright (c) 2019, oddluck
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('ASCII')
except:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x: x
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
# a bool that specifies whether the user identified themself as an advanced
# user or not. You should effect your configuration by manipulating the
# registry as appropriate.
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('ASCII', True)
ASCII = conf.registerPlugin('ASCII')
conf.registerGlobalValue(ASCII, 'pasteAPI',
registry.String('', _("""Paste.ee API Key""")))
conf.registerGlobalValue(ASCII, 'imgurAPI',
registry.String('', _("""Imgur Client ID""")))
conf.registerChannelValue(ASCII, 'pasteEnable',
registry.Boolean(False, _("""Turns on and off paste.ee support""")))
conf.registerChannelValue(ASCII, 'delay',
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented.""")))
conf.registerChannelValue(ASCII, 'dither',
registry.Boolean(True, _("""Enable dithering. Results in much faster rendering at a slight decrease in quality. Default: True""")))
conf.registerChannelValue(ASCII, 'speed',
registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference.""")))
conf.registerChannelValue(ASCII, 'imgDefault',
registry.String('1/2', _("""Set the default art type for the img command. Options are 'ascii', '1/2' (default), '1/4', 'block', and 'no-color'""")))
conf.registerChannelValue(ASCII, 'asciiWidth',
registry.Integer(100, _("""Set the default column width for ascii art images""")))
conf.registerChannelValue(ASCII, 'blockWidth',
registry.Integer(70, _("""Set the default column width for 1/2 and 1/4 block art images""")))
conf.registerChannelValue(ASCII, 'colors',
registry.Integer(99, _("""Set the default number of colors to use. Options are 16 for colors 0-15 only, 83 for colors 16-98 only, and 99 (default) to use all available colors""")))
###
# Copyright (c) 2019, oddluck
# All rights reserved.
#
#
###
import supybot.conf as conf
import supybot.registry as registry
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('ASCII')
except:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x: x
def configure(advanced):
# This will be called by supybot to configure this module. advanced is
# a bool that specifies whether the user identified themself as an advanced
# user or not. You should effect your configuration by manipulating the
# registry as appropriate.
from supybot.questions import expect, anything, something, yn
conf.registerPlugin('ASCII', True)
ASCII = conf.registerPlugin('ASCII')
conf.registerGlobalValue(ASCII, 'pasteAPI',
registry.String('', _("""Paste.ee API Key""")))
conf.registerGlobalValue(ASCII, 'imgurAPI',
registry.String('', _("""Imgur Client ID""")))
conf.registerChannelValue(ASCII, 'pasteEnable',
registry.Boolean(False, _("""Turns on and off paste.ee support""")))
conf.registerChannelValue(ASCII, 'delay',
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented.""")))
conf.registerChannelValue(ASCII, 'quantize',
registry.Boolean(False, _("""Enable quantizing to 256 colors before rendering. Results in much faster rendering at a slight decrease in quality. Default: False""")))
conf.registerChannelValue(ASCII, 'resize',
registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming""")))
conf.registerChannelValue(ASCII, 'speed',
registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference.""")))
conf.registerChannelValue(ASCII, 'imgDefault',
registry.String('1/2', _("""Set the default art type for the img command. Options are 'ascii', '1/2' (default), '1/4', 'block', and 'no-color'""")))
conf.registerChannelValue(ASCII, 'asciiWidth',
registry.Integer(100, _("""Set the default column width for ascii art images""")))
conf.registerChannelValue(ASCII, 'blockWidth',
registry.Integer(80, _("""Set the default column width for 1/2 and 1/4 block art images""")))
conf.registerChannelValue(ASCII, 'colors',
registry.Integer(99, _("""Set the default number of colors to use. Options are 16 for colors 0-15 only, 83 for colors 16-98 only, and 99 (default) to use all available colors""")))
conf.registerChannelValue(ASCII, 'fg',
registry.Integer(99, _("""Set the default foreground color for ascii art images. 0-98. 99 is disabled (default)""")))
conf.registerChannelValue(ASCII, 'bg',
registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)""")))

File diff suppressed because it is too large Load Diff