diff -r 6c774496bb00 -r b75f9514e797 detag.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/detag.py Wed Jan 16 16:28:03 2008 +0000 @@ -0,0 +1,46 @@ +#!/usr/bin/env python2.4 +# +# DeGAL - A pretty simple web image gallery +# Copyright (C) 2007 Tero Marttila +# http://marttila.de/~terom/degal/ +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +from lib import tags, shorturl + +from sys import argv + +argv.pop(0) + +pos = argv.index("--") + +image_list = argv[:pos] +tag_list = argv[pos+1:] + +tag_db = tags.TagDB(read_only=False) +shorturl_db = shorturl.DB() + +img_codes = shorturl_db.shorturls_for(image_list) + +print "Have %d images and %d tags" % (len(img_codes), len(tag_list)) + +for img_code in img_codes : + for tag in tag_list : + tag_db.tag(img_code, tag) + +tag_db.close() +