Ejemplo n.º 1
0
 def __init__(self, directories, collection):
     self.directories = directories
     self.loop_proc = None
     self.sleep_secs = 0
     self.last_change_ts = Value('i', 0)
     self.collection = Array('c', 64)
     self.collection.value = collection
     self._conf = WPConfiguration()
Ejemplo n.º 2
0
Archivo: uowms.py Proyecto: phowat/uowm
def config():
    wpconf = WPConfiguration()
    if request.method == 'POST':
        for x in request.form:
            wpconf.set(x, request.form[x]) 
    return render_template('index.html', conf=wpconf)
Ejemplo n.º 3
0
Archivo: t.py Proyecto: phowat/uowm
 def setUp(self):
     self._conf = WPConfiguration("./uowmrc-example")
Ejemplo n.º 4
0
            print len(self.file_list)
            candidate = random.choice(self.file_list)
            if len(self.file_list) > self.conf.no_repeat:
                if not self.log.in_last(self.conf.no_repeat, candidate):
                    chosen = candidate
            else:
                print "This collection has less items than the no_repeat \
parameter. We cannot guarantee this."

                chosen = candidate
        self.log.add(chosen)
        return chosen


def simple_draw():
    _conn = r.connect(db='uowm')
    cur = r.table('wallpapers').\
          filter(r.row['tags'].contains("earthporn")).run(_conn)
    collection = []
    for cu in cur:
        collection.append(cu)
    print random.choice(collection)


if __name__ == '__main__':
    conf = WPConfiguration()
    a = WPDBColletion(['earthporn', 'comics'], conf, tag_match="OR")
    b = WPDBColletion(['earthporn'], conf, tag_match="AND")
    print a.draw()
    print b.draw()