diff --git a/Makefile b/Makefile index 69c10e8..0917cd0 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ all: genponies -genpngs: ponies/* +genpngs: mkdir genpngs unpixelterm -d genpngs ponies/*.pony -genponies: pngs/* - mkdir genponies - pixelterm -d genponies pngs/*.png +genponies: + mkdir ponysay/ponies + pixelterm -d ponysay/ponies pngs/*.png diff --git a/ponysay b/ponysay deleted file mode 100644 index 65a0339..0000000 --- a/ponysay +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, random -from os.path import dirname, realpath, exists -import ponysay -import argparse, textwrap - -if __name__ == '__main__': - termwidth = 80 - try: - termwidth = os.get_terminal_size()[0] - except: - pass - - parser = argparse.ArgumentParser(description='Cowsay with ponies') - parser.add_argument('-p', '--pony', type=str, default='random', help='The name of the pony to be used. Use "-p list" to list all ponies, "-p random" (default) to use a random pony.') - parser.add_argument('-q', '--quote', action='store_true', help='Use a random quote of the pony being displayed as text') - parser.add_argument('-c', '--center', action='store_true', help='Use a random quote of the pony being displayed as text') - parser.add_argument('-C', '--center-text', action='store_true', help='Center the text in the bubble') - parser.add_argument('-w', '--width', type=int, default=termwidth, help='Terminal width. Use 0 for unlimited width. Default: autodetect') - parser.add_argument('-b', '--balloon', type=str, default='cowsay', help='Balloon style to use. Use "-b list" to list available styles.') - parser.add_argument('text', type=str, nargs='*', help='The text to be placed in the speech bubble') - args = parser.parse_args() - - think = sys.argv[0].endswith('think') - if args.pony == "list": - print('\n'.join(sorted(ponysay.list_ponies() if not args.quote else ponysay.list_ponies_with_quotes()))) - sys.exit() - if args.balloon == 'list': - print('\n'.join([ s.replace('.think', '') for s in ponysay.balloonstyles.keys() if s.endswith('.think') == think ])) - sys.exit() - pony = args.pony - if pony == "random": - pony = random.choice(ponysay.list_ponies() if not args.quote else ponysay.list_ponies_with_quotes()) - text = ' '.join(args.text) or None - if text == '-': - text = '\n'.join(sys.stdin.readlines()) - if args.quote: - text = ponysay.random_quote(pony) - - balloonstyle = None - if think: - balloonstyle = ponysay.balloonstyles[args.balloon+'.think'] - else: - balloonstyle = ponysay.balloonstyles[args.balloon] - - print(ponysay.render_pony(pony, text, - balloonstyle=balloonstyle, - width=args.width or sys.maxint, - center=args.center, - centertext=args.center_text)) diff --git a/ponysay-qotd b/ponysay-qotd deleted file mode 100755 index 134a895..0000000 --- a/ponysay-qotd +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 -import random -from socketserver import ThreadingMixIn, TCPServer, BaseRequestHandler -import ponysay - -# Quote-Of-The-Day protocol implementation using ponysay backend -# See RFC865 ( https://tools.ietf.org/html/rfc865 ) for details. -# To prevent traffic amplification attacks we are only providing a TCP service. - -class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass - -ponylist = ponysay.list_ponies_with_quotes() - -class QOTDHandler(BaseRequestHandler): - def handle(self): - pony = random.choice(ponylist) - s = ponysay.render_pony(pony, ponysay.random_quote(pony), - balloonstyle=ponysay.balloonstyles['cowsay'], - center=True, - centertext=False, - width=120) - self.request.sendall(bytes(s, "UTF-8")) - -if __name__ == "__main__": - HOST, PORT = "", 8017 - server = ThreadingTCPServer((HOST, PORT), QOTDHandler) - server.serve_forever() diff --git a/ponysay.py b/ponysay.py deleted file mode 100644 index adb92c0..0000000 --- a/ponysay.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 - -import os, sys, random -from os.path import dirname, realpath, exists -from pkg_resources import resource_string, resource_listdir, resource_exists -import argparse, textwrap -try: - import re2 as re -except: - import re - -# (oneline, multiline, bottom, top, linkl, linkr) -# {one,multi}line := (left, right) -# {left,right} := (top, middle, bottom) -balloonstyles= {'cowsay': (((' ', '', '< '), (' ', '', '> ')), ((' /', '|', '\\ '), (' \\', '|', '/ ')), '-', '_', '\\', '/'), - 'cowsay.think': (((' ', '', '( '), (' ', '', ') ')), ((' (', '(', '( '), (' )', ')', ') ')), '-', '_', 'o', 'o'), - 'ascii': (((' /|', '', '\\ '), (' \\|', '', '/ ')), ((' /|', '|', '|\\'), (' \\|', '|', '|/')), '_', '_', '\\', '/'), - 'ascii.think': (((' ((', '', '( '), (' ))', '', ') ')), ((' ((', '(', '(('), (' ))', ')', '))')), '_', '_', 'o', 'o'), - 'unicode': ((('┌││', '', '│└ '), ('┐││', '', '│┘ ')), (('┌││', '│', '││└'), ('┐││', '│', '││┘')), '─', '─', '╲', '╱'), - 'round': ((('╭││', '', '│╰ '), ('╮││', '', '│╯ ')), (('╭││', '│', '││╰'), ('╮││', '│', '││╯')), '─', '─', '╲', '╱'), - 'linux-vt': ((('┌││', '', '│└ '), ('┐││', '', '│┘ ')), (('┌││', '│', '││└'), ('┐││', '│', '││┘')), '─', '─', '\\', '/')} - -def list_ponies(markQuotes=False): - quotes = lambda n: ' (quotes)' if markQuotes and exists(ponypath+'/'+n+'.quotes') else '' - return [ f[:-5]+quotes(f[:-5]) for f in resource_listdir(__name__, 'ponies') if not f.endswith('.quotes') ] - -def list_ponies_with_quotes(): - return [ f[:-7] for f in resource_listdir(__name__, 'ponies') if f.endswith('.quotes') ] - -def load_pony(name): - return str(resource_string(__name__, 'ponies/'+name+'.pony'), 'utf-8').split('\n') - -def random_quote(name): - quotepath='ponies/'+name+'.quotes' - if resource_exists(__name__, quotepath): - return random.choice(str(resource_string(__name__, quotepath), 'utf-8').split('\n\n')) - else: - return None - -def render_balloon(text, balloonstyle, minwidth=0, maxwidth=40, pad=str.center): - if text is None: - return [] - (oneline, multiline, bottom, top, linkl, linkr) = balloonstyle - lines = [ ' '+wrapline+' ' for textline in text.center(minwidth).split('\n') for wrapline in textwrap.wrap(textline, maxwidth) ] - width = max([ len(line) for line in lines ]+[minwidth]) - side = lambda top, middle, bottom: top + middle*(len(lines)-2) + bottom - leftside, rightside = oneline if len(lines) == 1 else multiline - topextra, bottomextra = len(leftside[0])-2, len(leftside[2])-2 - leftside, rightside = side(*leftside), side(*rightside) - lines = [top*width] + [' '*width]*topextra + [ pad(line, width) for line in lines ] + [' '*width]*bottomextra + [bottom*width] - return [ l+m+r for l,m,r in zip(leftside, lines, rightside) ] - -def render_pony(name, text, balloonstyle, width=80, center=False, centertext=False): - pony = load_pony(name) - balloon = link_l = link_r = '' - if text: - [link_l, link_r] = balloonstyle[-2:] - for i,line in enumerate(pony): - match = re.search('\$balloon([0-9]*)\$', line) - if match: - minwidth = int(match.group(1) or '0') - pony[i:i+1] = render_balloon(text, balloonstyle, minwidth=minwidth, maxwidth=int(width/2), pad=str.center if centertext else str.ljust) - break - try: - first = pony.index('$$$') - second = pony[first+1:].index('$$$') - pony[first:] = pony[first+1+second+1:] - except: - pass - pony = [ line.replace('$\\$', link_l).replace('$/$', link_r) for line in pony ] - indent = '' - if center: - ponywidth = max([ len(re.sub(r'\x1B\[[0-9;]+m|\$.*\$', '', line)) for line in pony ]) - indent = ' '*int((width-ponywidth)/2) - wre = re.compile('((\x1B\[[0-9;]+m)*.){0,%s}' % width) - reset = '\n' - return indent+(reset+indent).join([ wre.search(line).group() for line in pony ])+reset - diff --git a/quotes/applebloom.quotes b/ponysay/quotes/applebloom.quotes similarity index 100% rename from quotes/applebloom.quotes rename to ponysay/quotes/applebloom.quotes diff --git a/quotes/applebloomdance.quotes b/ponysay/quotes/applebloomdance.quotes similarity index 100% rename from quotes/applebloomdance.quotes rename to ponysay/quotes/applebloomdance.quotes diff --git a/quotes/applejack.quotes b/ponysay/quotes/applejack.quotes similarity index 100% rename from quotes/applejack.quotes rename to ponysay/quotes/applejack.quotes diff --git a/quotes/applejackscarecrow.quotes b/ponysay/quotes/applejackscarecrow.quotes similarity index 100% rename from quotes/applejackscarecrow.quotes rename to ponysay/quotes/applejackscarecrow.quotes diff --git a/quotes/bigmac.quotes b/ponysay/quotes/bigmac.quotes similarity index 100% rename from quotes/bigmac.quotes rename to ponysay/quotes/bigmac.quotes diff --git a/quotes/bigmacsleep.quotes b/ponysay/quotes/bigmacsleep.quotes similarity index 100% rename from quotes/bigmacsleep.quotes rename to ponysay/quotes/bigmacsleep.quotes diff --git a/quotes/bonbon.quotes b/ponysay/quotes/bonbon.quotes similarity index 100% rename from quotes/bonbon.quotes rename to ponysay/quotes/bonbon.quotes diff --git a/quotes/bonbonlyra.quotes b/ponysay/quotes/bonbonlyra.quotes similarity index 100% rename from quotes/bonbonlyra.quotes rename to ponysay/quotes/bonbonlyra.quotes diff --git a/quotes/bonbonstand.quotes b/ponysay/quotes/bonbonstand.quotes similarity index 100% rename from quotes/bonbonstand.quotes rename to ponysay/quotes/bonbonstand.quotes diff --git a/quotes/braeburn.quotes b/ponysay/quotes/braeburn.quotes similarity index 100% rename from quotes/braeburn.quotes rename to ponysay/quotes/braeburn.quotes diff --git a/quotes/carrot.quotes b/ponysay/quotes/carrot.quotes similarity index 100% rename from quotes/carrot.quotes rename to ponysay/quotes/carrot.quotes diff --git a/quotes/carrottop.quotes b/ponysay/quotes/carrottop.quotes similarity index 100% rename from quotes/carrottop.quotes rename to ponysay/quotes/carrottop.quotes diff --git a/quotes/celestia.quotes b/ponysay/quotes/celestia.quotes similarity index 100% rename from quotes/celestia.quotes rename to ponysay/quotes/celestia.quotes diff --git a/quotes/celestiasmall.quotes b/ponysay/quotes/celestiasmall.quotes similarity index 100% rename from quotes/celestiasmall.quotes rename to ponysay/quotes/celestiasmall.quotes diff --git a/quotes/changelingqueen.quotes b/ponysay/quotes/changelingqueen.quotes similarity index 100% rename from quotes/changelingqueen.quotes rename to ponysay/quotes/changelingqueen.quotes diff --git a/quotes/cheerilee.quotes b/ponysay/quotes/cheerilee.quotes similarity index 100% rename from quotes/cheerilee.quotes rename to ponysay/quotes/cheerilee.quotes diff --git a/quotes/cheerilee80.quotes b/ponysay/quotes/cheerilee80.quotes similarity index 100% rename from quotes/cheerilee80.quotes rename to ponysay/quotes/cheerilee80.quotes diff --git a/quotes/chrysalis.quotes b/ponysay/quotes/chrysalis.quotes similarity index 100% rename from quotes/chrysalis.quotes rename to ponysay/quotes/chrysalis.quotes diff --git a/quotes/derpy.quotes b/ponysay/quotes/derpy.quotes similarity index 100% rename from quotes/derpy.quotes rename to ponysay/quotes/derpy.quotes diff --git a/quotes/derpybags.quotes b/ponysay/quotes/derpybags.quotes similarity index 100% rename from quotes/derpybags.quotes rename to ponysay/quotes/derpybags.quotes diff --git a/quotes/derpycloud.quotes b/ponysay/quotes/derpycloud.quotes similarity index 100% rename from quotes/derpycloud.quotes rename to ponysay/quotes/derpycloud.quotes diff --git a/quotes/derpysad.quotes b/ponysay/quotes/derpysad.quotes similarity index 100% rename from quotes/derpysad.quotes rename to ponysay/quotes/derpysad.quotes diff --git a/quotes/derpysit.quotes b/ponysay/quotes/derpysit.quotes similarity index 100% rename from quotes/derpysit.quotes rename to ponysay/quotes/derpysit.quotes diff --git a/quotes/derpystand.quotes b/ponysay/quotes/derpystand.quotes similarity index 100% rename from quotes/derpystand.quotes rename to ponysay/quotes/derpystand.quotes diff --git a/quotes/derpystandwing.quotes b/ponysay/quotes/derpystandwing.quotes similarity index 100% rename from quotes/derpystandwing.quotes rename to ponysay/quotes/derpystandwing.quotes diff --git a/quotes/diamondtiara.quotes b/ponysay/quotes/diamondtiara.quotes similarity index 100% rename from quotes/diamondtiara.quotes rename to ponysay/quotes/diamondtiara.quotes diff --git a/quotes/discord.quotes b/ponysay/quotes/discord.quotes similarity index 100% rename from quotes/discord.quotes rename to ponysay/quotes/discord.quotes diff --git a/quotes/discordamused.quotes b/ponysay/quotes/discordamused.quotes similarity index 100% rename from quotes/discordamused.quotes rename to ponysay/quotes/discordamused.quotes diff --git a/quotes/discordpuppetmaster.quotes b/ponysay/quotes/discordpuppetmaster.quotes similarity index 100% rename from quotes/discordpuppetmaster.quotes rename to ponysay/quotes/discordpuppetmaster.quotes diff --git a/quotes/doctor.quotes b/ponysay/quotes/doctor.quotes similarity index 100% rename from quotes/doctor.quotes rename to ponysay/quotes/doctor.quotes diff --git a/quotes/doctornohat.quotes b/ponysay/quotes/doctornohat.quotes similarity index 100% rename from quotes/doctornohat.quotes rename to ponysay/quotes/doctornohat.quotes diff --git a/quotes/drhooves.quotes b/ponysay/quotes/drhooves.quotes similarity index 100% rename from quotes/drhooves.quotes rename to ponysay/quotes/drhooves.quotes diff --git a/quotes/fancypants.quotes b/ponysay/quotes/fancypants.quotes similarity index 100% rename from quotes/fancypants.quotes rename to ponysay/quotes/fancypants.quotes diff --git a/quotes/fillydash.quotes b/ponysay/quotes/fillydash.quotes similarity index 100% rename from quotes/fillydash.quotes rename to ponysay/quotes/fillydash.quotes diff --git a/quotes/fillydashfly.quotes b/ponysay/quotes/fillydashfly.quotes similarity index 100% rename from quotes/fillydashfly.quotes rename to ponysay/quotes/fillydashfly.quotes diff --git a/quotes/fillyjack.quotes b/ponysay/quotes/fillyjack.quotes similarity index 100% rename from quotes/fillyjack.quotes rename to ponysay/quotes/fillyjack.quotes diff --git a/quotes/fillyjacktravel.quotes b/ponysay/quotes/fillyjacktravel.quotes similarity index 100% rename from quotes/fillyjacktravel.quotes rename to ponysay/quotes/fillyjacktravel.quotes diff --git a/quotes/fillypinkie.quotes b/ponysay/quotes/fillypinkie.quotes similarity index 100% rename from quotes/fillypinkie.quotes rename to ponysay/quotes/fillypinkie.quotes diff --git a/quotes/fillypinkiecurly.quotes b/ponysay/quotes/fillypinkiecurly.quotes similarity index 100% rename from quotes/fillypinkiecurly.quotes rename to ponysay/quotes/fillypinkiecurly.quotes diff --git a/quotes/fillyrarity.quotes b/ponysay/quotes/fillyrarity.quotes similarity index 100% rename from quotes/fillyrarity.quotes rename to ponysay/quotes/fillyrarity.quotes diff --git a/quotes/fillyshy.quotes b/ponysay/quotes/fillyshy.quotes similarity index 100% rename from quotes/fillyshy.quotes rename to ponysay/quotes/fillyshy.quotes diff --git a/quotes/fillytwilight.quotes b/ponysay/quotes/fillytwilight.quotes similarity index 100% rename from quotes/fillytwilight.quotes rename to ponysay/quotes/fillytwilight.quotes diff --git a/quotes/fluttershy.quotes b/ponysay/quotes/fluttershy.quotes similarity index 100% rename from quotes/fluttershy.quotes rename to ponysay/quotes/fluttershy.quotes diff --git a/quotes/fluttershygala.quotes b/ponysay/quotes/fluttershygala.quotes similarity index 100% rename from quotes/fluttershygala.quotes rename to ponysay/quotes/fluttershygala.quotes diff --git a/quotes/fluttershyshy.quotes b/ponysay/quotes/fluttershyshy.quotes similarity index 100% rename from quotes/fluttershyshy.quotes rename to ponysay/quotes/fluttershyshy.quotes diff --git a/quotes/fluttershystare.quotes b/ponysay/quotes/fluttershystare.quotes similarity index 100% rename from quotes/fluttershystare.quotes rename to ponysay/quotes/fluttershystare.quotes diff --git a/quotes/gilda.quotes b/ponysay/quotes/gilda.quotes similarity index 100% rename from quotes/gilda.quotes rename to ponysay/quotes/gilda.quotes diff --git a/quotes/gildastand.quotes b/ponysay/quotes/gildastand.quotes similarity index 100% rename from quotes/gildastand.quotes rename to ponysay/quotes/gildastand.quotes diff --git a/quotes/goldenharvest.quotes b/ponysay/quotes/goldenharvest.quotes similarity index 100% rename from quotes/goldenharvest.quotes rename to ponysay/quotes/goldenharvest.quotes diff --git a/quotes/granny.quotes b/ponysay/quotes/granny.quotes similarity index 100% rename from quotes/granny.quotes rename to ponysay/quotes/granny.quotes diff --git a/quotes/grannychair.quotes b/ponysay/quotes/grannychair.quotes similarity index 100% rename from quotes/grannychair.quotes rename to ponysay/quotes/grannychair.quotes diff --git a/quotes/grannysleep.quotes b/ponysay/quotes/grannysleep.quotes similarity index 100% rename from quotes/grannysleep.quotes rename to ponysay/quotes/grannysleep.quotes diff --git a/quotes/harpass.quotes b/ponysay/quotes/harpass.quotes similarity index 100% rename from quotes/harpass.quotes rename to ponysay/quotes/harpass.quotes diff --git a/quotes/heartstrings.quotes b/ponysay/quotes/heartstrings.quotes similarity index 100% rename from quotes/heartstrings.quotes rename to ponysay/quotes/heartstrings.quotes diff --git a/quotes/ironwill.quotes b/ponysay/quotes/ironwill.quotes similarity index 100% rename from quotes/ironwill.quotes rename to ponysay/quotes/ironwill.quotes diff --git a/quotes/ironwillwalk.quotes b/ponysay/quotes/ironwillwalk.quotes similarity index 100% rename from quotes/ironwillwalk.quotes rename to ponysay/quotes/ironwillwalk.quotes diff --git a/quotes/lily.quotes b/ponysay/quotes/lily.quotes similarity index 100% rename from quotes/lily.quotes rename to ponysay/quotes/lily.quotes diff --git a/quotes/lulamoon.quotes b/ponysay/quotes/lulamoon.quotes similarity index 100% rename from quotes/lulamoon.quotes rename to ponysay/quotes/lulamoon.quotes diff --git a/quotes/luna.quotes b/ponysay/quotes/luna.quotes similarity index 100% rename from quotes/luna.quotes rename to ponysay/quotes/luna.quotes diff --git a/quotes/lunafly.quotes b/ponysay/quotes/lunafly.quotes similarity index 100% rename from quotes/lunafly.quotes rename to ponysay/quotes/lunafly.quotes diff --git a/quotes/lyra.quotes b/ponysay/quotes/lyra.quotes similarity index 100% rename from quotes/lyra.quotes rename to ponysay/quotes/lyra.quotes diff --git a/quotes/lyrabonbon.quotes b/ponysay/quotes/lyrabonbon.quotes similarity index 100% rename from quotes/lyrabonbon.quotes rename to ponysay/quotes/lyrabonbon.quotes diff --git a/quotes/lyrasit.quotes b/ponysay/quotes/lyrasit.quotes similarity index 100% rename from quotes/lyrasit.quotes rename to ponysay/quotes/lyrasit.quotes diff --git a/quotes/nightmare.quotes b/ponysay/quotes/nightmare.quotes similarity index 100% rename from quotes/nightmare.quotes rename to ponysay/quotes/nightmare.quotes diff --git a/quotes/oinkoinkoink.quotes b/ponysay/quotes/oinkoinkoink.quotes similarity index 100% rename from quotes/oinkoinkoink.quotes rename to ponysay/quotes/oinkoinkoink.quotes diff --git a/quotes/photofinish.quotes b/ponysay/quotes/photofinish.quotes similarity index 100% rename from quotes/photofinish.quotes rename to ponysay/quotes/photofinish.quotes diff --git a/quotes/pinkacopter.quotes b/ponysay/quotes/pinkacopter.quotes similarity index 100% rename from quotes/pinkacopter.quotes rename to ponysay/quotes/pinkacopter.quotes diff --git a/quotes/pinkie.quotes b/ponysay/quotes/pinkie.quotes similarity index 100% rename from quotes/pinkie.quotes rename to ponysay/quotes/pinkie.quotes diff --git a/quotes/pinkiebounce.quotes b/ponysay/quotes/pinkiebounce.quotes similarity index 100% rename from quotes/pinkiebounce.quotes rename to ponysay/quotes/pinkiebounce.quotes diff --git a/quotes/pinkiecannon.quotes b/ponysay/quotes/pinkiecannon.quotes similarity index 100% rename from quotes/pinkiecannon.quotes rename to ponysay/quotes/pinkiecannon.quotes diff --git a/quotes/pinkiecannonfront.quotes b/ponysay/quotes/pinkiecannonfront.quotes similarity index 100% rename from quotes/pinkiecannonfront.quotes rename to ponysay/quotes/pinkiecannonfront.quotes diff --git a/quotes/pinkiecannonhappy.quotes b/ponysay/quotes/pinkiecannonhappy.quotes similarity index 100% rename from quotes/pinkiecannonhappy.quotes rename to ponysay/quotes/pinkiecannonhappy.quotes diff --git a/quotes/pinkiechicken.quotes b/ponysay/quotes/pinkiechicken.quotes similarity index 100% rename from quotes/pinkiechicken.quotes rename to ponysay/quotes/pinkiechicken.quotes diff --git a/quotes/pinkiecrazyface.quotes b/ponysay/quotes/pinkiecrazyface.quotes similarity index 100% rename from quotes/pinkiecrazyface.quotes rename to ponysay/quotes/pinkiecrazyface.quotes diff --git a/quotes/pinkiefly.quotes b/ponysay/quotes/pinkiefly.quotes similarity index 100% rename from quotes/pinkiefly.quotes rename to ponysay/quotes/pinkiefly.quotes diff --git a/quotes/pinkiegala.quotes b/ponysay/quotes/pinkiegala.quotes similarity index 100% rename from quotes/pinkiegala.quotes rename to ponysay/quotes/pinkiegala.quotes diff --git a/quotes/pinkiegummy.quotes b/ponysay/quotes/pinkiegummy.quotes similarity index 100% rename from quotes/pinkiegummy.quotes rename to ponysay/quotes/pinkiegummy.quotes diff --git a/quotes/pinkiegummydisguise.quotes b/ponysay/quotes/pinkiegummydisguise.quotes similarity index 100% rename from quotes/pinkiegummydisguise.quotes rename to ponysay/quotes/pinkiegummydisguise.quotes diff --git a/quotes/pinkiehugfluttershy.quotes b/ponysay/quotes/pinkiehugfluttershy.quotes similarity index 100% rename from quotes/pinkiehugfluttershy.quotes rename to ponysay/quotes/pinkiehugfluttershy.quotes diff --git a/quotes/pinkiehugsfluttershy.quotes b/ponysay/quotes/pinkiehugsfluttershy.quotes similarity index 100% rename from quotes/pinkiehugsfluttershy.quotes rename to ponysay/quotes/pinkiehugsfluttershy.quotes diff --git a/quotes/pinkieoink.quotes b/ponysay/quotes/pinkieoink.quotes similarity index 100% rename from quotes/pinkieoink.quotes rename to ponysay/quotes/pinkieoink.quotes diff --git a/quotes/pinkieparade.quotes b/ponysay/quotes/pinkieparade.quotes similarity index 100% rename from quotes/pinkieparade.quotes rename to ponysay/quotes/pinkieparade.quotes diff --git a/quotes/pinkiepartycannon.quotes b/ponysay/quotes/pinkiepartycannon.quotes similarity index 100% rename from quotes/pinkiepartycannon.quotes rename to ponysay/quotes/pinkiepartycannon.quotes diff --git a/quotes/pinkieprincess.quotes b/ponysay/quotes/pinkieprincess.quotes similarity index 100% rename from quotes/pinkieprincess.quotes rename to ponysay/quotes/pinkieprincess.quotes diff --git a/quotes/pinkiesilly.quotes b/ponysay/quotes/pinkiesilly.quotes similarity index 100% rename from quotes/pinkiesilly.quotes rename to ponysay/quotes/pinkiesilly.quotes diff --git a/quotes/pinkietongue.quotes b/ponysay/quotes/pinkietongue.quotes similarity index 100% rename from quotes/pinkietongue.quotes rename to ponysay/quotes/pinkietongue.quotes diff --git a/quotes/pinkieumbrelahatfear.quotes b/ponysay/quotes/pinkieumbrelahatfear.quotes similarity index 100% rename from quotes/pinkieumbrelahatfear.quotes rename to ponysay/quotes/pinkieumbrelahatfear.quotes diff --git a/quotes/pinkieumbrellahat.quotes b/ponysay/quotes/pinkieumbrellahat.quotes similarity index 100% rename from quotes/pinkieumbrellahat.quotes rename to ponysay/quotes/pinkieumbrellahat.quotes diff --git a/quotes/pinkiewhoops.quotes b/ponysay/quotes/pinkiewhoops.quotes similarity index 100% rename from quotes/pinkiewhoops.quotes rename to ponysay/quotes/pinkiewhoops.quotes diff --git a/quotes/pinkiewhoopseat.quotes b/ponysay/quotes/pinkiewhoopseat.quotes similarity index 100% rename from quotes/pinkiewhoopseat.quotes rename to ponysay/quotes/pinkiewhoopseat.quotes diff --git a/quotes/pinkiewhoopsout.quotes b/ponysay/quotes/pinkiewhoopsout.quotes similarity index 100% rename from quotes/pinkiewhoopsout.quotes rename to ponysay/quotes/pinkiewhoopsout.quotes diff --git a/quotes/pipsqueak.quotes b/ponysay/quotes/pipsqueak.quotes similarity index 100% rename from quotes/pipsqueak.quotes rename to ponysay/quotes/pipsqueak.quotes diff --git a/quotes/rainbow.quotes b/ponysay/quotes/rainbow.quotes similarity index 100% rename from quotes/rainbow.quotes rename to ponysay/quotes/rainbow.quotes diff --git a/quotes/rainbowdrag.quotes b/ponysay/quotes/rainbowdrag.quotes similarity index 100% rename from quotes/rainbowdrag.quotes rename to ponysay/quotes/rainbowdrag.quotes diff --git a/quotes/rainbowfly.quotes b/ponysay/quotes/rainbowfly.quotes similarity index 100% rename from quotes/rainbowfly.quotes rename to ponysay/quotes/rainbowfly.quotes diff --git a/quotes/rainbowgala.quotes b/ponysay/quotes/rainbowgala.quotes similarity index 100% rename from quotes/rainbowgala.quotes rename to ponysay/quotes/rainbowgala.quotes diff --git a/quotes/rainbowhurricane.quotes b/ponysay/quotes/rainbowhurricane.quotes similarity index 100% rename from quotes/rainbowhurricane.quotes rename to ponysay/quotes/rainbowhurricane.quotes diff --git a/quotes/rainbowsalute.quotes b/ponysay/quotes/rainbowsalute.quotes similarity index 100% rename from quotes/rainbowsalute.quotes rename to ponysay/quotes/rainbowsalute.quotes diff --git a/quotes/rainbowshadowbolt.quotes b/ponysay/quotes/rainbowshadowbolt.quotes similarity index 100% rename from quotes/rainbowshadowbolt.quotes rename to ponysay/quotes/rainbowshadowbolt.quotes diff --git a/quotes/rainbowsleep.quotes b/ponysay/quotes/rainbowsleep.quotes similarity index 100% rename from quotes/rainbowsleep.quotes rename to ponysay/quotes/rainbowsleep.quotes diff --git a/quotes/rarity.quotes b/ponysay/quotes/rarity.quotes similarity index 100% rename from quotes/rarity.quotes rename to ponysay/quotes/rarity.quotes diff --git a/quotes/raritycomplaining.quotes b/ponysay/quotes/raritycomplaining.quotes similarity index 100% rename from quotes/raritycomplaining.quotes rename to ponysay/quotes/raritycomplaining.quotes diff --git a/quotes/raritydrama.quotes b/ponysay/quotes/raritydrama.quotes similarity index 100% rename from quotes/raritydrama.quotes rename to ponysay/quotes/raritydrama.quotes diff --git a/quotes/rarityelite.quotes b/ponysay/quotes/rarityelite.quotes similarity index 100% rename from quotes/rarityelite.quotes rename to ponysay/quotes/rarityelite.quotes diff --git a/quotes/rarityfly.quotes b/ponysay/quotes/rarityfly.quotes similarity index 100% rename from quotes/rarityfly.quotes rename to ponysay/quotes/rarityfly.quotes diff --git a/quotes/raritygala.quotes b/ponysay/quotes/raritygala.quotes similarity index 100% rename from quotes/raritygala.quotes rename to ponysay/quotes/raritygala.quotes diff --git a/quotes/rarityponder.quotes b/ponysay/quotes/rarityponder.quotes similarity index 100% rename from quotes/rarityponder.quotes rename to ponysay/quotes/rarityponder.quotes diff --git a/quotes/rose.quotes b/ponysay/quotes/rose.quotes similarity index 100% rename from quotes/rose.quotes rename to ponysay/quotes/rose.quotes diff --git a/quotes/roseluck.quotes b/ponysay/quotes/roseluck.quotes similarity index 100% rename from quotes/roseluck.quotes rename to ponysay/quotes/roseluck.quotes diff --git a/quotes/sapphire.quotes b/ponysay/quotes/sapphire.quotes similarity index 100% rename from quotes/sapphire.quotes rename to ponysay/quotes/sapphire.quotes diff --git a/quotes/scootaloo.quotes b/ponysay/quotes/scootaloo.quotes similarity index 100% rename from quotes/scootaloo.quotes rename to ponysay/quotes/scootaloo.quotes diff --git a/quotes/silverspoon.quotes b/ponysay/quotes/silverspoon.quotes similarity index 100% rename from quotes/silverspoon.quotes rename to ponysay/quotes/silverspoon.quotes diff --git a/quotes/soarin.quotes b/ponysay/quotes/soarin.quotes similarity index 100% rename from quotes/soarin.quotes rename to ponysay/quotes/soarin.quotes diff --git a/quotes/soarinofficer.quotes b/ponysay/quotes/soarinofficer.quotes similarity index 100% rename from quotes/soarinofficer.quotes rename to ponysay/quotes/soarinofficer.quotes diff --git a/quotes/spike.quotes b/ponysay/quotes/spike.quotes similarity index 100% rename from quotes/spike.quotes rename to ponysay/quotes/spike.quotes diff --git a/quotes/spikecrystal.quotes b/ponysay/quotes/spikecrystal.quotes similarity index 100% rename from quotes/spikecrystal.quotes rename to ponysay/quotes/spikecrystal.quotes diff --git a/quotes/spikefloat.quotes b/ponysay/quotes/spikefloat.quotes similarity index 100% rename from quotes/spikefloat.quotes rename to ponysay/quotes/spikefloat.quotes diff --git a/quotes/spikelove.quotes b/ponysay/quotes/spikelove.quotes similarity index 100% rename from quotes/spikelove.quotes rename to ponysay/quotes/spikelove.quotes diff --git a/quotes/spikemustache.quotes b/ponysay/quotes/spikemustache.quotes similarity index 100% rename from quotes/spikemustache.quotes rename to ponysay/quotes/spikemustache.quotes diff --git a/quotes/spitfire.quotes b/ponysay/quotes/spitfire.quotes similarity index 100% rename from quotes/spitfire.quotes rename to ponysay/quotes/spitfire.quotes diff --git a/quotes/sweetie.quotes b/ponysay/quotes/sweetie.quotes similarity index 100% rename from quotes/sweetie.quotes rename to ponysay/quotes/sweetie.quotes diff --git a/quotes/sweetiedrops.quotes b/ponysay/quotes/sweetiedrops.quotes similarity index 100% rename from quotes/sweetiedrops.quotes rename to ponysay/quotes/sweetiedrops.quotes diff --git a/quotes/sweetiesing.quotes b/ponysay/quotes/sweetiesing.quotes similarity index 100% rename from quotes/sweetiesing.quotes rename to ponysay/quotes/sweetiesing.quotes diff --git a/quotes/timeturner.quotes b/ponysay/quotes/timeturner.quotes similarity index 100% rename from quotes/timeturner.quotes rename to ponysay/quotes/timeturner.quotes diff --git a/quotes/trixie.quotes b/ponysay/quotes/trixie.quotes similarity index 100% rename from quotes/trixie.quotes rename to ponysay/quotes/trixie.quotes diff --git a/quotes/trixieamulet.quotes b/ponysay/quotes/trixieamulet.quotes similarity index 100% rename from quotes/trixieamulet.quotes rename to ponysay/quotes/trixieamulet.quotes diff --git a/quotes/trixielulamoon.quotes b/ponysay/quotes/trixielulamoon.quotes similarity index 100% rename from quotes/trixielulamoon.quotes rename to ponysay/quotes/trixielulamoon.quotes diff --git a/quotes/trixiestage.quotes b/ponysay/quotes/trixiestage.quotes similarity index 100% rename from quotes/trixiestage.quotes rename to ponysay/quotes/trixiestage.quotes diff --git a/quotes/trixiestand.quotes b/ponysay/quotes/trixiestand.quotes similarity index 100% rename from quotes/trixiestand.quotes rename to ponysay/quotes/trixiestand.quotes diff --git a/quotes/twilight.quotes b/ponysay/quotes/twilight.quotes similarity index 100% rename from quotes/twilight.quotes rename to ponysay/quotes/twilight.quotes diff --git a/quotes/twilightcrazyfromball.quotes b/ponysay/quotes/twilightcrazyfromball.quotes similarity index 100% rename from quotes/twilightcrazyfromball.quotes rename to ponysay/quotes/twilightcrazyfromball.quotes diff --git a/quotes/twilightcrystal.quotes b/ponysay/quotes/twilightcrystal.quotes similarity index 100% rename from quotes/twilightcrystal.quotes rename to ponysay/quotes/twilightcrystal.quotes diff --git a/quotes/twilightrage.quotes b/ponysay/quotes/twilightrage.quotes similarity index 100% rename from quotes/twilightrage.quotes rename to ponysay/quotes/twilightrage.quotes diff --git a/quotes/twilightspike.quotes b/ponysay/quotes/twilightspike.quotes similarity index 100% rename from quotes/twilightspike.quotes rename to ponysay/quotes/twilightspike.quotes diff --git a/quotes/twilightthebearded.quotes b/ponysay/quotes/twilightthebearded.quotes similarity index 100% rename from quotes/twilightthebearded.quotes rename to ponysay/quotes/twilightthebearded.quotes diff --git a/quotes/twilighttime.quotes b/ponysay/quotes/twilighttime.quotes similarity index 100% rename from quotes/twilighttime.quotes rename to ponysay/quotes/twilighttime.quotes diff --git a/quotes/twilightzero.quotes b/ponysay/quotes/twilightzero.quotes similarity index 100% rename from quotes/twilightzero.quotes rename to ponysay/quotes/twilightzero.quotes diff --git a/quotes/twist.quotes b/ponysay/quotes/twist.quotes similarity index 100% rename from quotes/twist.quotes rename to ponysay/quotes/twist.quotes diff --git a/quotes/zecora.quotes b/ponysay/quotes/zecora.quotes similarity index 100% rename from quotes/zecora.quotes rename to ponysay/quotes/zecora.quotes diff --git a/quotes/zecorabalance.quotes b/ponysay/quotes/zecorabalance.quotes similarity index 100% rename from quotes/zecorabalance.quotes rename to ponysay/quotes/zecorabalance.quotes diff --git a/ponystorm.py b/ponystorm.py index dd93b42..53e13a0 100755 --- a/ponystorm.py +++ b/ponystorm.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 import random -import ponysay +from ponysay import ponysay for i in range(0, 1000): pony = random.choice(ponysay.list_ponies_with_quotes()) diff --git a/ponythink b/ponythink deleted file mode 120000 index 31b2aba..0000000 --- a/ponythink +++ /dev/null @@ -1 +0,0 @@ -ponysay \ No newline at end of file diff --git a/setup.py b/setup.py index 7088f59..fc8d6d6 100755 --- a/setup.py +++ b/setup.py @@ -27,13 +27,14 @@ setup(name = 'ponysay', author = 'jaseg', author_email = 'ponysay@jaseg.net', url = 'https://github.com/jaseg/ponysay', - py_modules = ['ponysay'], - data_files = [dir_copy('quotes', 'ponies'), - dir_copy('genponies', 'ponies')], - scripts = ['ponysay', - 'ponythink', - 'termcenter', - 'ponysay-qotd'], + packages = ['ponysay'], + package_dir = {'ponysay': 'ponysay'}, + package_data = {'ponysay': ['quotes/*.quotes', 'ponies/*.pony']}, + entry_points = {'console_scripts': [ + 'ponysay=ponysay:main', + 'ponythink=ponysay:main', + 'ponysay-qotd=ponysay:qotd_server', + 'termcenter=ponysay:termcenter']}, zip_safe = False, classifiers = [ 'Development Status :: 5 - Production/Stable', diff --git a/termcenter b/termcenter deleted file mode 100755 index 54fffa0..0000000 --- a/termcenter +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -import os,sys,time, itertools -import argparse -from subprocess import * -try: - import re2 as re -except: - import re - -parser = argparse.ArgumentParser(description='Center stuff on terminals') -parser.add_argument('string', nargs='*', type=str) -args = parser.parse_args() - -for e in [sys.stdin] + args.string: - lines = [e] if isinstance(e, str) else e.readlines() - if lines: - width = max(map(len, map(lambda s: re.sub(r'\x1B\[[0-9;]+m|\$.*\$', '', s), lines))) - pad = int((os.get_terminal_size()[0]- width)/2) - for line in lines: - print(' '*pad + re.sub(r'\$.*\$|\n', '', line)) -