]> git.phdru.name Git - bookmarks_db.git/commitdiff
No need to split bookmark.href - a robot will split it itself.
authorOleg Broytman <phd@phdru.name>
Thu, 11 Oct 2007 01:27:08 +0000 (01:27 +0000)
committerOleg Broytman <phd@phdru.name>
Thu, 11 Oct 2007 01:27:08 +0000 (01:27 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@83 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/bkmk_rforking.py
Robots/bkmk_rforking_sub.py
Robots/bkmk_rsimple.py
Robots/bkmk_rsimple_tos.py
bkmk-add.py
bkmk_objects.py
check_urls.py

index 1fb18a0adb4a884a8a8d2b841df6baabcbdc7075..4693f52979741235db3beb7fe4947e7ae6055823 100644 (file)
@@ -1,7 +1,7 @@
 """
    Forking robot
 
-   Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design
+   Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design.
 """
 
 
@@ -36,7 +36,7 @@ def restart_subp(log):
 from bkmk_objects import Robot
 
 class robot_forking(Robot):
-   def check_url(self, bookmark, url_type, url_rest):
+   def check_url(self, bookmark):
       if not check_subp:
          restart_subp(self.log) # Not restart, just start afresh
 
index 91460f3167f2c629fb6ea0fabaa936a3a1b97e5d..6ae0d8c521ed50e35b61387a9e2413af0b3e05d6 100755 (executable)
@@ -1,12 +1,12 @@
 #! /usr/bin/env python
 """
-   Check URL - subprocess
+   Check URL - subprocess for the forking robot
 
-   Written by BroytMann, Mar 1999 - Aug 2002. Copyright (C) 1999-2002 PhiloSoft Design
+   Written by BroytMann. Copyright (C) 1999-2007 PhiloSoft Design.
 """
 
 
-import sys, os, urllib
+import sys, os
 
 lib_dir = os.path.normpath(os.path.dirname(sys.argv[0]) + os.sep + os.pardir)
 sys.path.append(lib_dir) # for bkmk_objects.py
@@ -33,8 +33,7 @@ def run():
    while 1:
       bookmark = pickle.loads(bkmk_in.read_record())
       log(bookmark.href)
-      url_type, url_rest = urllib.splittype(bookmark.href)
-      robot.check_url(bookmark, url_type, url_rest)
+      robot.check_url(bookmark)
       bkmk_out.write_record(pickle.dumps(bookmark))
       log.outfile.flush()
 
index 58879b01bc3a76f33b059dd7e7f272bd8375900e..1c4795c11d6aecb8bfc6a460a260be5b56a65d8b 100644 (file)
@@ -83,13 +83,14 @@ from bkmk_objects import Robot
 from parse_html import parse_html
 
 class robot_simple(Robot):
-   def check_url(self, bookmark, url_type, url_rest):
+   def check_url(self, bookmark):
       if not self.tempfname:
          self.tempfname = bookmark.tempfname
 
       try:
          try:
             self.start = int(time.time())
+            url_type, url_rest = urllib.splittype(bookmark.href)
             url_host, url_path = urllib.splithost(url_rest)
             url_path, url_tag  = urllib.splittag(url_path)
 
index cecb515bfa87e7ff0a034bdee8451619802a0672..b7e89e8ca366168c13176803af2bc6efb1ce0ece 100644 (file)
@@ -11,9 +11,9 @@ timeoutsocket.setDefaultSocketTimeout(900)
 from bkmk_rsimple import robot_simple, get_error
 
 class robot_simple_tos(robot_simple):
-   def check_url(self, bookmark, url_type, url_rest):
+   def check_url(self, bookmark):
       try:
-         return robot_simple.check_url(self, bookmark, url_type, url_rest)
+         return robot_simple.check_url(self, bookmark)
 
       except (socket.error, timeoutsocket.Timeout), msg:
          bookmark.error = get_error(msg)
index 24952ce0d74423c93010d3a075d9d8f603c94053..6bd02c5cac0331a3bdae97e59d6ce72c5bc079ab 100755 (executable)
@@ -2,11 +2,11 @@
 """
    Add a bookmark to the database.
 
-   Written by BroytMann, Aug 2002. Copyright (C) 2002 PhiloSoft Design
+   Written by BroytMann. Copyright (C) 2002-2007 PhiloSoft Design.
 """
 
 
-import sys, os, time, urllib
+import sys, os, time
 from bkmk_objects import Bookmark
 from Robots.bkmk_rsimple import robot_simple
 
@@ -54,9 +54,8 @@ def run():
    bookmark.name = ''
 
    robot = robot_simple(tempfname, None)
-   url_type, url_rest = urllib.splittype(href)
 
-   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"):
index 584b87f56af1d01188ab7d0c6557c373e820ea48..344312ca0f91b9d22a7481612d0868fc23a389d0 100644 (file)
@@ -159,3 +159,10 @@ def make_tree(linear):
       object.parent.append(object)
 
    return root_folder
+
+def break_tree(linear):
+   root_folder = linear[0]
+   del linear[0]
+
+   for object in linear:
+      del object.parent
index 75f31559b89ab3b12216d0e93b7b3eadf8535e0f..4081637952acef7cf072efbe7923c7e8f7f3e4db 100755 (executable)
@@ -2,11 +2,11 @@
 """
    Robot interface - check URLs from bookmarks database
 
-   Written by BroytMann, Mar 2000 - Aug 2002. Copyright (C) 2000-2002 PhiloSoft Design
+   Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design.
 """
 
 
-import sys, os, urllib, tempfile
+import sys, os, tempfile
 tempfname = "check_urls" + tempfile.gettempprefix() + "tmp"
 
 
@@ -31,7 +31,7 @@ def run():
       pass
 
    if report_stats:
-      print "BroytMann check_urls, Copyright (C) 1997-2002 PhiloSoft Design"
+      print "BroytMann check_urls, Copyright (C) 1997-2007 PhiloSoft Design"
 
    if args:
       sys.stderr.write("check_urls: too many arguments\n")
@@ -118,9 +118,8 @@ def run():
                if hasattr(old_object, attr_name):
                   setattr(object, attr_name, getattr(old_object, attr_name))
          else:
-            url_type, url_rest = urllib.splittype(object.href)
-            log("Checking %s:%s" % (url_type, url_rest))
-            rcode = robot.check_url(object, url_type, url_rest)
+            log("Checking %s" % object.href)
+            rcode = robot.check_url(object)
 
             if rcode:
                checked[object.href] = object_no