mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-28 23:17:59 +01:00
.png files in -f if util-say is installed
This commit is contained in:
parent
afcc9dc829
commit
eac35c124a
3 changed files with 24 additions and 5 deletions
|
@ -139,6 +139,9 @@ a relative path and does not include a `@code{/}', it must begin with
|
||||||
multiple times to specify a set of ponies from which one will be selected
|
multiple times to specify a set of ponies from which one will be selected
|
||||||
randomly. If no pony is specified one will be selected randomly.
|
randomly. If no pony is specified one will be selected randomly.
|
||||||
|
|
||||||
|
If you have @command{util-say} installed, you can use .png-files as the
|
||||||
|
arguments for this options.
|
||||||
|
|
||||||
@item -q [PONY...]
|
@item -q [PONY...]
|
||||||
@itemx --quote [PONY...]
|
@itemx --quote [PONY...]
|
||||||
@cindex @command{-q}
|
@cindex @command{-q}
|
||||||
|
@ -485,6 +488,14 @@ Python version 3 is the primary language of the program
|
||||||
@cindex linux vt
|
@cindex linux vt
|
||||||
For improved TTY support for user with custom colour palette and KMS support.
|
For improved TTY support for user with custom colour palette and KMS support.
|
||||||
It can be downloaded at @url{https://github.com/maandree/util-say}.
|
It can be downloaded at @url{https://github.com/maandree/util-say}.
|
||||||
|
|
||||||
|
@cindex png images
|
||||||
|
@cindex images, png
|
||||||
|
@cindex portable network graphics
|
||||||
|
For ther purpose of simplying for pony contributors, @command{ponysay}
|
||||||
|
supports using .png-images (note that the file must not miss the
|
||||||
|
@code{.png} in the file) in addition of .pony-files or pony names.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
@ -1265,7 +1276,7 @@ Patchers and other contributors of ponysay:
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item Duane ``Marneus68'' Bekaert
|
@item Duane ``Marneus68'' Bekaert
|
||||||
@item Kyah ``L-four'' Rindlisbacher
|
@item Kyah ``L-four'' Rindlisbacher
|
||||||
@item James `rossy2401'' Ross-Gowan
|
@item James ``rossy2401'' Ross-Gowan
|
||||||
@item Louis ``kragniz'' Taylor
|
@item Louis ``kragniz'' Taylor
|
||||||
@item Jannis ``sycoso''
|
@item Jannis ``sycoso''
|
||||||
@item ``spider-mario''
|
@item ``spider-mario''
|
||||||
|
|
BIN
ponysay.pdf
BIN
ponysay.pdf
Binary file not shown.
16
ponysay.py
16
ponysay.py
|
@ -25,7 +25,7 @@ from subprocess import Popen, PIPE
|
||||||
'''
|
'''
|
||||||
The version of ponysay
|
The version of ponysay
|
||||||
'''
|
'''
|
||||||
VERSION = '2.0-rc1'
|
VERSION = '2.0-rc2'
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -122,7 +122,7 @@ class ponysay():
|
||||||
##
|
##
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Returns one .pony-file with full path, names is filter for names, also accepts filepaths
|
Returns one file with full path, names is filter for names, also accepts filepaths.
|
||||||
'''
|
'''
|
||||||
def __getponypath(self, names = None):
|
def __getponypath(self, names = None):
|
||||||
ponies = {}
|
ponies = {}
|
||||||
|
@ -130,7 +130,7 @@ class ponysay():
|
||||||
if not names == None:
|
if not names == None:
|
||||||
for name in names:
|
for name in names:
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
return name
|
ponies[name] = name
|
||||||
|
|
||||||
for ponydir in ponydirs:
|
for ponydir in ponydirs:
|
||||||
for ponyfile in os.listdir(ponydir):
|
for ponyfile in os.listdir(ponydir):
|
||||||
|
@ -342,7 +342,7 @@ class ponysay():
|
||||||
Returns (the cowsay command, whether it is a custom program)
|
Returns (the cowsay command, whether it is a custom program)
|
||||||
'''
|
'''
|
||||||
def __getcowsay(self):
|
def __getcowsay(self):
|
||||||
isthink = 'think.py' in __file__
|
isthink = (len(__file__) >= 8) and (__file__[-8:] == 'think.py')
|
||||||
|
|
||||||
if isthink:
|
if isthink:
|
||||||
cowthink = os.environ['PONYSAY_COWTHINK'] if 'PONYSAY_COWTHINK' in os.environ else None
|
cowthink = os.environ['PONYSAY_COWTHINK'] if 'PONYSAY_COWTHINK' in os.environ else None
|
||||||
|
@ -361,9 +361,17 @@ class ponysay():
|
||||||
else:
|
else:
|
||||||
msg = args.message
|
msg = args.message
|
||||||
|
|
||||||
|
|
||||||
pony = self.__getponypath(args.pony)
|
pony = self.__getponypath(args.pony)
|
||||||
(cowsay, customcowsay) = self.__getcowsay()
|
(cowsay, customcowsay) = self.__getcowsay()
|
||||||
|
|
||||||
|
if (len(pony) > 4) and (pony[-4:].lower() == '.png'):
|
||||||
|
pony = '\'' + pony.replace('\'', '\'\\\'\'') + '\''
|
||||||
|
pngcmd = ('img2ponysay -p -- ' if linuxvt else 'img2ponysay -- ') + pony
|
||||||
|
pngpipe = os.pipe()
|
||||||
|
Popen(pngcmd, stdout=os.fdopen(pngpipe[1], 'w'), shell=True).wait()
|
||||||
|
pony = '/proc/' + str(os.getpid()) + '/fd/' + str(pngpipe[0])
|
||||||
|
|
||||||
cmd = [cowsay, '-f', self.__kms(pony)]
|
cmd = [cowsay, '-f', self.__kms(pony)]
|
||||||
if args.wrap is not None:
|
if args.wrap is not None:
|
||||||
cmd += ['-W', args.wrap]
|
cmd += ['-W', args.wrap]
|
||||||
|
|
Loading…
Reference in a new issue