mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 05:47: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
|
||||
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...]
|
||||
@itemx --quote [PONY...]
|
||||
@cindex @command{-q}
|
||||
|
@ -485,6 +488,14 @@ Python version 3 is the primary language of the program
|
|||
@cindex linux vt
|
||||
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}.
|
||||
|
||||
@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
|
||||
|
||||
|
||||
|
@ -1265,7 +1276,7 @@ Patchers and other contributors of ponysay:
|
|||
@itemize @bullet
|
||||
@item Duane ``Marneus68'' Bekaert
|
||||
@item Kyah ``L-four'' Rindlisbacher
|
||||
@item James `rossy2401'' Ross-Gowan
|
||||
@item James ``rossy2401'' Ross-Gowan
|
||||
@item Louis ``kragniz'' Taylor
|
||||
@item Jannis ``sycoso''
|
||||
@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
|
||||
'''
|
||||
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):
|
||||
ponies = {}
|
||||
|
@ -130,7 +130,7 @@ class ponysay():
|
|||
if not names == None:
|
||||
for name in names:
|
||||
if os.path.isfile(name):
|
||||
return name
|
||||
ponies[name] = name
|
||||
|
||||
for ponydir in ponydirs:
|
||||
for ponyfile in os.listdir(ponydir):
|
||||
|
@ -342,7 +342,7 @@ class ponysay():
|
|||
Returns (the cowsay command, whether it is a custom program)
|
||||
'''
|
||||
def __getcowsay(self):
|
||||
isthink = 'think.py' in __file__
|
||||
isthink = (len(__file__) >= 8) and (__file__[-8:] == 'think.py')
|
||||
|
||||
if isthink:
|
||||
cowthink = os.environ['PONYSAY_COWTHINK'] if 'PONYSAY_COWTHINK' in os.environ else None
|
||||
|
@ -361,9 +361,17 @@ class ponysay():
|
|||
else:
|
||||
msg = args.message
|
||||
|
||||
|
||||
pony = self.__getponypath(args.pony)
|
||||
(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)]
|
||||
if args.wrap is not None:
|
||||
cmd += ['-W', args.wrap]
|
||||
|
|
Loading…
Reference in a new issue