Update ASCII plugin
This commit is contained in:
parent
23af1cca99
commit
655dbf7e58
|
@ -1,6 +1,9 @@
|
||||||
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T8E56M6SP9JH2)
|
[](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>
|
<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.
|
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 --fg <0-99> <url> (set a foreground color)
|
||||||
img --fast <url> (use Euclidean color difference.)
|
img --fast <url> (use Euclidean color difference.)
|
||||||
img --slow <url> (use cie2000 color difference. best quality, default)
|
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:
|
Here are some images using 99 color default output:
|
||||||
<br>
|
<br>
|
||||||
^ output of img https://i.imgur.com/aF9wihd.jpg (image command with default settings)
|
^ output of img https://i.imgur.com/aF9wihd.jpg (image command with default settings)
|
||||||
<br>
|
<br>
|
||||||
^ output of img --block https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
|
^ output of img --block https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
|
||||||
<br>
|
<br>
|
||||||
^ output of img --ascii https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
|
^ output of img --ascii https://i.imgur.com/aF9wihd.jpg (image command with colored space blocks)
|
||||||
```
|
```
|
||||||
***************+*++++++++++++++++++++++++++++++++++++++=++=++========================---------------
|
***************+*++++++++++++++++++++++++++++++++++++++=++=++========================---------------
|
||||||
|
|
|
@ -1,43 +1,44 @@
|
||||||
###
|
###
|
||||||
# Copyright (c) 2019 oddluck
|
# Copyright (c) 2019 oddluck
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ASCII: Uses API to retrieve information
|
ASCII: Uses API to retrieve information
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import supybot
|
import supybot
|
||||||
import supybot.world as world
|
import supybot.world as world
|
||||||
|
|
||||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
# 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.
|
# in here if you're keeping the plugin in CVS or some similar system.
|
||||||
__version__ = ""
|
__version__ = ""
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||||
__author__ = supybot.authors.unknown
|
__author__ = supybot.Author('oddluck', 'oddluck',
|
||||||
|
'oddluck@riseup.net')
|
||||||
# This is a dictionary mapping supybot.Author instances to lists of
|
|
||||||
# contributions.
|
# This is a dictionary mapping supybot.Author instances to lists of
|
||||||
__contributors__ = {}
|
# contributions.
|
||||||
|
__contributors__ = {}
|
||||||
# This is a url where the most recent plugin package can be downloaded.
|
|
||||||
__url__ = ''
|
# 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 . import config
|
||||||
from imp import reload
|
from . import plugin
|
||||||
# In case we're being reloaded.
|
from imp import reload
|
||||||
reload(config)
|
# In case we're being reloaded.
|
||||||
reload(plugin)
|
reload(config)
|
||||||
# Add more reloads here if you add third-party modules and want them to be
|
reload(plugin)
|
||||||
# reloaded when this plugin is reloaded. Don't forget to import them as well!
|
# 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
|
if world.testing:
|
||||||
|
from . import test
|
||||||
Class = plugin.Class
|
|
||||||
configure = config.configure
|
Class = plugin.Class
|
||||||
|
configure = config.configure
|
||||||
|
|
||||||
|
|
123
ASCII/config.py
123
ASCII/config.py
|
@ -1,57 +1,66 @@
|
||||||
###
|
###
|
||||||
# Copyright (c) 2019, oddluck
|
# Copyright (c) 2019, oddluck
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
try:
|
try:
|
||||||
from supybot.i18n import PluginInternationalization
|
from supybot.i18n import PluginInternationalization
|
||||||
_ = PluginInternationalization('ASCII')
|
_ = PluginInternationalization('ASCII')
|
||||||
except:
|
except:
|
||||||
# Placeholder that allows to run the plugin on a bot
|
# Placeholder that allows to run the plugin on a bot
|
||||||
# without the i18n module
|
# without the i18n module
|
||||||
_ = lambda x: x
|
_ = lambda x: x
|
||||||
|
|
||||||
|
|
||||||
def configure(advanced):
|
def configure(advanced):
|
||||||
# This will be called by supybot to configure this module. advanced is
|
# This will be called by supybot to configure this module. advanced is
|
||||||
# a bool that specifies whether the user identified themself as an advanced
|
# a bool that specifies whether the user identified themself as an advanced
|
||||||
# user or not. You should effect your configuration by manipulating the
|
# user or not. You should effect your configuration by manipulating the
|
||||||
# registry as appropriate.
|
# registry as appropriate.
|
||||||
from supybot.questions import expect, anything, something, yn
|
from supybot.questions import expect, anything, something, yn
|
||||||
conf.registerPlugin('ASCII', True)
|
conf.registerPlugin('ASCII', True)
|
||||||
|
|
||||||
ASCII = conf.registerPlugin('ASCII')
|
ASCII = conf.registerPlugin('ASCII')
|
||||||
|
|
||||||
conf.registerGlobalValue(ASCII, 'pasteAPI',
|
conf.registerGlobalValue(ASCII, 'pasteAPI',
|
||||||
registry.String('', _("""Paste.ee API Key""")))
|
registry.String('', _("""Paste.ee API Key""")))
|
||||||
|
|
||||||
conf.registerGlobalValue(ASCII, 'imgurAPI',
|
conf.registerGlobalValue(ASCII, 'imgurAPI',
|
||||||
registry.String('', _("""Imgur Client ID""")))
|
registry.String('', _("""Imgur Client ID""")))
|
||||||
|
|
||||||
conf.registerChannelValue(ASCII, 'pasteEnable',
|
conf.registerChannelValue(ASCII, 'pasteEnable',
|
||||||
registry.Boolean(False, _("""Turns on and off paste.ee support""")))
|
registry.Boolean(False, _("""Turns on and off paste.ee support""")))
|
||||||
|
|
||||||
conf.registerChannelValue(ASCII, 'delay',
|
conf.registerChannelValue(ASCII, 'delay',
|
||||||
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented.""")))
|
registry.Float(1.0, _("""Set the time delay betwen lines. Not currently implemented.""")))
|
||||||
|
|
||||||
conf.registerChannelValue(ASCII, 'dither',
|
conf.registerChannelValue(ASCII, 'quantize',
|
||||||
registry.Boolean(True, _("""Enable dithering. Results in much faster rendering at a slight decrease in quality. Default: True""")))
|
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, 'speed',
|
conf.registerChannelValue(ASCII, 'resize',
|
||||||
registry.String('Slow', _("""Set the speed of the color rendering. 'Slow' (default) to use CIEDE2000 color difference. 'Fast' to use Euclidean color difference.""")))
|
registry.Integer(3, _("""Set the resize algorithm. 0 = nearest, 1 = lanczos, 2 = bilinear, 3 = bicubic, 4 = box, 5 = hamming""")))
|
||||||
|
|
||||||
conf.registerChannelValue(ASCII, 'imgDefault',
|
conf.registerChannelValue(ASCII, 'speed',
|
||||||
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'""")))
|
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, 'asciiWidth',
|
conf.registerChannelValue(ASCII, 'imgDefault',
|
||||||
registry.Integer(100, _("""Set the default column width for ascii art images""")))
|
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, 'blockWidth',
|
conf.registerChannelValue(ASCII, 'asciiWidth',
|
||||||
registry.Integer(70, _("""Set the default column width for 1/2 and 1/4 block art images""")))
|
registry.Integer(100, _("""Set the default column width for ascii art images""")))
|
||||||
|
|
||||||
conf.registerChannelValue(ASCII, 'colors',
|
conf.registerChannelValue(ASCII, 'blockWidth',
|
||||||
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""")))
|
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)""")))
|
||||||
|
|
3377
ASCII/plugin.py
3377
ASCII/plugin.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue