X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=bkmk-add.py;h=03cf5c3cad3133953ab0d5864b19b1a0bbb860a2;hb=3fa95e7ba73b268164c50290b394e57fcf790cf0;hp=24952ce0d74423c93010d3a075d9d8f603c94053;hpb=9edef5a570ea28f7c06d8d92fdd70afe0ea86809;p=bookmarks_db.git diff --git a/bkmk-add.py b/bkmk-add.py index 24952ce..03cf5c3 100755 --- a/bkmk-add.py +++ b/bkmk-add.py @@ -1,18 +1,20 @@ #! /usr/bin/env python -""" - Add a bookmark to the database. +"""Add a bookmark to the database - Written by BroytMann, Aug 2002. Copyright (C) 2002 PhiloSoft Design +This file is a part of Bookmarks database and Internet robot. """ +__version__ = "$Revision$"[11:-2] +__revision__ = "$Id$"[5:-2] +__date__ = "$Date$"[7:-2] +__author__ = "Oleg Broytman " +__copyright__ = "Copyright (C) 2002-2011 PhiloSoft Design" +__license__ = "GNU GPL" -import sys, os, time, urllib +import sys, os, time from bkmk_objects import Bookmark from Robots.bkmk_rsimple import robot_simple -import tempfile -tempfname = "bkmk-add" + tempfile.gettempprefix() + "tmp" - def run(): from getopt import getopt @@ -53,10 +55,9 @@ def run(): bookmark = Bookmark(href, str(now), '0', '0') bookmark.name = '' - robot = robot_simple(tempfname, None) - url_type, url_rest = urllib.splittype(href) + robot = robot_simple(None) - if robot.check_url(bookmark, url_type, url_rest): # get real title and last modified date + if robot.check_url(bookmark): # get real title and last modified date if title: # forced title bookmark.name = title elif hasattr(bookmark, "real_title"): @@ -75,11 +76,5 @@ def run(): print "Ok" - try: - os.unlink(tempfname) - except os.error: - pass - - if __name__ == '__main__': run()