from cssbot import log, queue import utils def humanize_time(secs): # if secs < 0: return "+" # no need for millis. secs = int(secs) d = timedelta(seconds=secs) return str(d) # log = log.getLogger("cssbot") # now = time.time() queue = queue.Queue() for item in queue.items(): # rows, cols = os.popen('stty size', 'r').read().split() cols = int(cols) # # left_padding_len is the length of all the preceding text + paddings. left_padding_len = 52 if len(item["data"]["title"]) > (cols-left_padding_len): title = "%s..." % (item["data"]["title"]).replace("\n", " ")[:(cols-left_padding_len-3)] else: title = "%s" % (item["data"]["title"]).replace("\n", " ")
#!/usr/bin/env python2.6 # # Copyright (C) 2011 by Brian Weck # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # import utils from cssbot import log, queue # utils.usage(1, "usage: %s id") thing_id = utils.argv(1) # log = log.getLogger("cssbot.dequeue") # queue = queue.Queue() thing = queue.contains({"data.id": thing_id}) # if we have an item, and up for queueing. if thing and "next_ts" in thing: log.warn("removing item %s from queue", thing_id) queue.dequeue(thing) else: log.error("did not remove thing %s from the queue", thing_id)
def __init__(self, filenames=[]): self._config = ConfigParser.SafeConfigParser() self._config.read(filenames) self.log = log.getLogger("cssbot.config")
#!/usr/bin/env python2.6 # # Copyright (C) 2011 by Brian Weck # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # import utils from cssbot import log, queue # utils.usage(1, "usage: %s id") thing_id = utils.argv(1) # log = log.getLogger("cssbot.dequeue") # queue = queue.Queue() thing = queue.contains({"data.id":thing_id}) # if we have an item, and up for queueing. if thing and "next_ts" in thing: log.warn("removing item %s from queue", thing_id) queue.dequeue(thing) else: log.error("did not remove thing %s from the queue", thing_id)
def __init__(self, filenames=[]): self._config = ConfigParser.SafeConfigParser() self._config.read(filenames) self.log = log.getLogger("cssbot.config")