def add_tag_photoid(self, tag, photoid): tagentry = self.get_tag(tag) if tagentry[1] is None: photos = [] else: photos = tagentry[1].split(",") assert id_to_thumb(photoid) not in photos photos.append(id_to_thumb(photoid)) self.db.execute("UPDATE TagTable SET photo_id_list=? WHERE id=?", [",".join(photos),tagentry[0]]) self.db.commit()
def add_tag_photoid(self, tag, photoid): tagentry = self.get_tag(tag) if tagentry[1] is None: photos = [] else: photos = tagentry[1].split(",") assert id_to_thumb(photoid) not in photos photos.append(id_to_thumb(photoid)) self.db.execute("UPDATE TagTable SET photo_id_list=? WHERE id=?", [",".join(photos), tagentry[0]]) self.db.commit()
def add_tag(self, tag, photoids): c = self.db.cursor() c.execute(""" INSERT INTO TagTable (name, photo_id_list) VALUES (?,?)""", [tag, ",".join([id_to_thumb(photoid) for photoid in photoids])]) self.db.commit() return c.lastrowid
def photo_hastags(self, photoid): """ Check tags for specified photo """ c = self.db.cursor() c.execute("SELECT id,name FROM TagTable WHERE name LIKE ? ", ["%%%s%%" % id_to_thumb(photoid)]) return c.fetchall()
def add_tag(self, tag, photoids): c = self.db.cursor() c.execute( """ INSERT INTO TagTable (name, photo_id_list) VALUES (?,?)""", [tag, ",".join([id_to_thumb(photoid) for photoid in photoids])]) self.db.commit() return c.lastrowid
def tag_hasphoto(self, tag, photoid): """ Check if photo is already marked with specified tag """ if not self.tag_exists(tag): return False photos = self.get_tag(tag)[1] if photos is None: return False return id_to_thumb(photoid) in photos.split(",")
def add_tag_photolist(self, tag, photoids): tagentry = self.get_tag(tag) if tagentry[1] is None: photos = [] else: photos = tagentry[1].split(",") for photo in [id_to_thumb(photoid) for photoid in photoids]: if photo not in photos: photos.append(photo) self.db.execute("UPDATE TagTable SET photo_id_list=? WHERE id=?", [",".join(photos),tagentry[0]]) self.db.commit()
def add_tag_photolist(self, tag, photoids): tagentry = self.get_tag(tag) if tagentry[1] is None: photos = [] else: photos = tagentry[1].split(",") for photo in [id_to_thumb(photoid) for photoid in photoids]: if photo not in photos: photos.append(photo) self.db.execute("UPDATE TagTable SET photo_id_list=? WHERE id=?", [",".join(photos), tagentry[0]]) self.db.commit()