Ejemplo n.º 1
0
    def __init__(self, tags, wpconf, tag_match="AND"):
        def match_or(wp):
            for tag in wp['tags']:
                if r.expr(tags).contains(tag):
                    return True
            return False

        #TODO: Reimplement cycle_dirs option as cycle_tags
        self.log = WPLog(wpconf)
        self.conf = wpconf
        self.file_list = []

        _conn = r.connect(db='uowm')
        t = r.table('wallpapers')
        f = r.row['tags']
        if tag_match == 'OR':
            cur = []
            for tag in tags:
                cur += [x for x in t.filter(f.contains(tag)).run(_conn)]
        else: #AND
            cur = t.filter(f.contains(*tags)).run(_conn)

        for wallpaper in cur:
            fullpath = wallpaper['fullpath']
            if is_image(fullpath):
                self.file_list.append(fullpath)
Ejemplo n.º 2
0
    def __init__(self, tags, wpconf, tag_match="AND"):
        def match_or(wp):
            for tag in wp['tags']:
                if r.expr(tags).contains(tag):
                    return True
            return False

        #TODO: Reimplement cycle_dirs option as cycle_tags
        self.log = WPLog(wpconf)
        self.conf = wpconf
        self.file_list = []

        _conn = r.connect(db='uowm')
        t = r.table('wallpapers')
        f = r.row['tags']
        if tag_match == 'OR':
            cur = []
            for tag in tags:
                cur += [x for x in t.filter(f.contains(tag)).run(_conn)]
        else:  #AND
            cur = t.filter(f.contains(*tags)).run(_conn)

        for wallpaper in cur:
            fullpath = wallpaper['fullpath']
            if is_image(fullpath):
                self.file_list.append(fullpath)
Ejemplo n.º 3
0
def create_structures(basedir, paths):
    return map(lambda x: create_structure(basedir, x), 
               filter(lambda x: is_image(x[0]+'/'+x[1]), paths))
Ejemplo n.º 4
0
def create_structures(basedir, paths):
    return map(lambda x: create_structure(basedir, x),
               filter(lambda x: is_image(x[0] + '/' + x[1]), paths))