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