All pastes #71308 Raw Edit

Unnamed

public text v1 · immutable
#71308 ·published 2006-06-25 16:01 UTC
rendered paste body
import commands
from random import randint
import kibot.BaseModule


class art(kibot.BaseModule.BaseModule):
        _ascii_cperm = 1
        prefix = "/home/norc/art/"
        def ascii(self, cmd):
                """streams random asciiart
                in a query to [nick]"""

                cmd.msg("starting now")
# working until here
                cmd = "image2ascii -geometry 80x24 %s%s" % (self.prefix, self.findfile())
# it does not call the method findfile() 
                artlist = commands.getoutput(self.cmd).split('\n')

                for i in range(len(self.artlist)):
                        cmd.msg("%s" % self.artlist[i])

        def findfile(self):
                cmd.msg("getting random file")
                files = commands.getoutput("ls %s" % self.prefix).split('\n')
                return(self.files[randint(0, (len(self.files)-1))])