"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2002-2014 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2002-2017 PhiloSoft Design"
__license__ = "GNU GPL"
import sys, os, time
root_folder = storage.load()
if report_stats:
- print "Ok"
+ print("Ok")
href = args[0]
now = int(time.time())
storage.store(root_folder)
if report_stats:
- print "Ok"
+ print("Ok")
if __name__ == '__main__':
This file is a part of Bookmarks database and Internet robot.
"""
-__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 1997-2012 PhiloSoft Design"
-__license__ = "GNU GPL"
-
+from __future__ import print_function
import sys, os
from getopt import getopt
from bkmk_parser import BkmkParser
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 1997-2017 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+
def run():
optlist, args = getopt(sys.argv[1:], "is")
try:
size = os.path.getsize(filename)
except:
- print filename, ": no such file"
+ print(filename, ": no such file")
sys.exit(1)
del pbar
if report_stats:
- print "Ok"
- print line_no, "lines proceed"
- print parser.urls, "urls found"
- print parser.objects, "objects created"
+ print("Ok")
+ print(line_no, "lines proceed")
+ print(parser.urls, "urls found")
+ print(parser.objects, "objects created")
if ok:
from storage import storage
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 1997-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 1997-2017 PhiloSoft Design"
__license__ = "GNU GPL"
__all__ = ['BkmkParser']
if DEBUG:
def debug(note):
- print note
+ print(note)
def dump_names(folder_stack):
l = []
This file is a part of Bookmarks database and Internet robot.
"""
+from __future__ import print_function
+import sys
+
+
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
__license__ = "GNU GPL"
-import sys
-
log_file = None
if log_file:
log_file.write("%s\n" % s)
else:
- print s
+ print(s)
def run():
pass
if report_stats:
- print "Broytman check_dups, Copyright (C) 2000-2007 PhiloSoft Design"
+ print("Broytman check_dups, Copyright (C) 2000-2017 PhiloSoft Design")
if args:
sys.stderr.write("check_urls: too many arguments\n")
objects = len(root_folder.linear)
if report_stats:
- print "Ok"
+ print("Ok")
dup_dict = {}
log_file.close()
if report_stats:
- print "Ok"
- print objects, "objects passed"
+ print("Ok")
+ print(objects, "objects passed")
if __name__ == '__main__':
This file is a part of Bookmarks database and Internet robot.
"""
-__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2002-2012 PhiloSoft Design"
-__license__ = "GNU GPL"
-
+from __future__ import print_function
import sys
from bkmk_objects import make_linear, quote_title, unquote_title
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2002-2017 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+
def run():
from getopt import getopt
optlist, args = getopt(sys.argv[1:], "s")
pass
if report_stats:
- print "Broytman check_title, Copyright (C) 2002-2010 PhiloSoft Design"
+ print("Broytman check_title, Copyright (C) 2002-2017 PhiloSoft Design")
if args:
sys.stderr.write("check_title: too many arguments\n")
objects = len(root_folder.linear)
if report_stats:
- print "Ok"
+ print("Ok")
for object_no in range(objects):
unquoted_title = unquote_title(quote_title(object.real_title))
unquoted_name = unquote_title(object.name)
if unquoted_name <> unquoted_title:
- print object.href
- print unquoted_name
- print unquoted_title
- print
+ print(object.href)
+ print(unquoted_name)
+ print(unquoted_title)
+ print()
else:
- print object.href
- print object.name
- print "NO REAL TITLE!!!"
- print
+ print(object.href)
+ print(object.name)
+ print("NO REAL TITLE!!!")
+ print()
if report_stats:
- print objects, "objects passed"
+ print(objects, "objects passed")
if __name__ == '__main__':
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2010-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2010-2017 PhiloSoft Design"
__license__ = "GNU GPL"
import sys
def run():
- print "Broytman check_url, Copyright (C) 2010 PhiloSoft Design"
+ print("Broytman check_url, Copyright (C) 2010-2017 PhiloSoft Design")
if len(sys.argv) < 2:
sys.stderr.write("Usage: check_url.py url1 [url2...]\n")
bookmark.parent = None
rcode = robot.check_url(bookmark)
- print "check_url: %s" % rcode
+ print("check_url: %s" % rcode)
if hasattr(bookmark, 'error'):
- print bookmark.error
+ print(bookmark.error)
else:
- print """\
+ print("""\
URL: %s
Title: %s
LastModified: %s
IconURI: %s
Icon: %s
-""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon)
+""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon))
robot.stop()
log.close()
This file is a part of Bookmarks database and Internet robot.
"""
+from __future__ import print_function
+import sys, os
+
+
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
__license__ = "GNU GPL"
-import sys, os
-
def run():
from getopt import getopt
pass
if report_stats:
- print "Broytman check_urls, Copyright (C) 1997-2010 PhiloSoft Design"
+ print("Broytman check_urls, Copyright (C) 1997-2017 PhiloSoft Design")
if args:
sys.stderr.write("check_urls: too many arguments\n")
log = openlog("check.log")
log("chk_urls restarted for errors")
if report_stats:
- print "chk_urls restarted for errors"
+ print("chk_urls restarted for errors")
else:
log = makelog("check.log")
log("check_urls started")
if report_stats:
- print " check_urls: normal start"
+ print(" check_urls: normal start")
from storage import storage
storage = storage()
objects = len(root_folder.linear)
if report_stats:
- print "Ok"
+ print("Ok")
if report_stats:
if only_errors:
del pbar
if report_stats:
- print "Ok"
- print object_count, "objects passed"
- print urls_no, "URLs checked"
- print size, "bytes eaten"
+ print("Ok")
+ print(object_count, "objects passed")
+ print(urls_no, "URLs checked")
+ print(size, "bytes eaten")
break_tree(root_folder.linear)
storage.store(root_folder)
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
__license__ = "GNU GPL"
import sys
root_folder = storage.load()
if report_stats:
- print "Ok"
+ print("Ok")
sys.stdout.write("Converting to %s: " % new_storage.filename)
sys.stdout.flush()
new_storage.store(root_folder)
if report_stats:
- print "Ok"
+ print("Ok")
if __name__ == '__main__':
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
__license__ = "GNU GPL"
import sys
root_folder = storage.load()
if report_stats:
- print "Ok"
+ print("Ok")
sys.stdout.write("Writing %s: " % output_filename)
sys.stdout.flush()
outfile.close()
if report_stats:
- print "Ok"
+ print("Ok")
if __name__ == '__main__':
"""
-__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2014 PhiloSoft Design"
-__license__ = "GNU GPL"
+from __future__ import print_function
+from .bkmk_parse_html import parse_filename
-from .bkmk_parse_html import parse_filename
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2014-2017 PhiloSoft Design"
+__license__ = "GNU GPL"
def main():
sys.exit("Usage: main filename [charset]")
parser = parse_filename(filename, charset, log=lambda s: sys.stdout.write(s + '\n'))
- print " refresh:", parser.refresh
- print " icon :", parser.icon
+ print(" refresh:", parser.refresh)
+ print(" icon :", parser.icon)
if __name__ == '__main__':
main()
This file is a part of Bookmarks database and Internet robot.
"""
+from __future__ import print_function
+import sys
+
+
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2002-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2002-2017 PhiloSoft Design"
__license__ = "GNU GPL"
-import sys
-
def run():
from getopt import getopt
pass
if report_stats:
- print "Broytman set-real_title, Copyright (C) 2003 PhiloSoft Design"
+ print("Broytman set-real_title, Copyright (C) 2003-2017 PhiloSoft Design")
if args:
sys.stderr.write("set-real_title: too many arguments\n")
objects = len(root_folder.linear)
if report_stats:
- print "Ok"
+ print("Ok")
changed = 0
storage.store(root_folder)
if changed and report_stats:
- print "Ok"
- print objects, "objects passed"
- print changed, "objects changed"
+ print("Ok")
+ print(objects, "objects passed")
+ print(changed, "objects changed")
if __name__ == '__main__':
This file is a part of Bookmarks database and Internet robot.
"""
+from __future__ import print_function
+import sys
+
+
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2003-2012 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2003-2017 PhiloSoft Design"
__license__ = "GNU GPL"
-import sys
-
def run():
from getopt import getopt
pass
if report_stats:
- print "Broytman set-title-list, Copyright (C) 2003-2007 PhiloSoft Design"
+ print("Broytman set-title-list, Copyright (C) 2003-2017 PhiloSoft Design")
if len(args) <> 1:
sys.stderr.write("Usage: set-title-list [-s] title_list_file\n")
objects = len(root_folder.linear)
if report_stats:
- print "Ok"
+ print("Ok")
# Run through the list of objects and check URLs/titles
storage.store(root_folder)
if changed and report_stats:
- print "Ok"
- print objects, "objects passed"
- print changed, "objects changed"
+ print("Ok")
+ print(objects, "objects passed")
+ print(changed, "objects changed")
if __name__ == '__main__':
"""
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2014 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
__license__ = "GNU GPL"
import sys
root_folder = storage.load()
if report_stats:
- print "Ok"
+ print("Ok")
sys.stdout.write("Sorting (by %s): " % sort_by)
sys.stdout.flush()
output_filename = output_filename + "-reverse"
if report_stats:
- print "done"
+ print("done")
sys.stdout.write("Writing %s: " % output_filename)
sys.stdout.flush()
outfile.close()
if report_stats:
- print "Ok"
+ print("Ok")
if __name__ == '__main__':
os.kill(self.pid, signal.SIGSTOP)
except os.error:
if verbose:
- print "Stop failed for '%s' - '%s'" % (self.cmd, sys.exc_value)
+ print("Stop failed for '%s' - '%s'" % (self.cmd, sys.exc_value))
return 0
- if verbose: print "Stopped '%s'" % self.cmd
+ if verbose: print("Stopped '%s'" % self.cmd)
return 'stopped'
def cont(self, verbose=0):
os.kill(self.pid, signal.SIGCONT)
except os.error:
if verbose:
- print ("Continue failed for '%s' - '%s'" %
- (self.cmd, sys.exc_value))
+ print(("Continue failed for '%s' - '%s'" %
+ (self.cmd, sys.exc_value)))
return 0
- if verbose: print "Continued '%s'" % self.cmd
+ if verbose: print("Continued '%s'" % self.cmd)
return 'continued'
def die(self):
# WNOHANG == 1 on sunos, presumably same elsewhere.
if os.waitpid(self.pid, os.WNOHANG):
if self.expire_noisily:
- print ("\n(%s subproc %d '%s' / %s)" %
+ print(("\n(%s subproc %d '%s' / %s)" %
(sig[0], self.pid, self.cmd,
- hex(id(self))[2:]))
+ hex(id(self))[2:])))
for i in self.pipefiles:
os.close(i)
self.pid = 0
#############################################################################
def test(p=0):
- print "\tOpening subprocess:"
+ print("\tOpening subprocess:")
p = Subprocess('cat', 1) # set to expire noisily...
- print p
- print "\tOpening bogus subprocess, should fail:"
+ print(p)
+ print("\tOpening bogus subprocess, should fail:")
try:
b = Subprocess('/', 1)
- print "\tOops! Null-named subprocess startup *succeeded*?!?"
+ print("\tOops! Null-named subprocess startup *succeeded*?!?")
except SubprocessError:
- print "\t...yep, it failed."
- print '\tWrite, then read, two newline-teriminated lines, using readline:'
+ print("\t...yep, it failed.")
+ print('\tWrite, then read, two newline-teriminated lines, using readline:')
p.write('first full line written\n'); p.write('second.\n')
- print `p.readline()`
- print `p.readline()`
- print '\tThree lines, last sans newline, read using combination:'
+ print(`p.readline()`)
+ print(`p.readline()`)
+ print('\tThree lines, last sans newline, read using combination:')
p.write('first\n'); p.write('second\n'); p.write('third, (no cr)')
- print '\tFirst line via readline:'
- print `p.readline()`
- print '\tRest via readPendingChars:'
- print p.readPendingChars()
- print "\tStopping then continuing subprocess (verbose):"
+ print('\tFirst line via readline:')
+ print(`p.readline()`)
+ print('\tRest via readPendingChars:')
+ print(p.readPendingChars())
+ print("\tStopping then continuing subprocess (verbose):")
if not p.stop(1): # verbose stop
- print '\t** Stop seems to have failed!'
+ print('\t** Stop seems to have failed!')
else:
- print '\tWriting line while subprocess is paused...'
+ print('\tWriting line while subprocess is paused...')
p.write('written while subprocess paused\n')
- print '\tNonblocking read of paused subprocess (should be empty):'
- print p.readPendingChars()
- print '\tContinuing subprocess (verbose):'
+ print('\tNonblocking read of paused subprocess (should be empty):')
+ print(p.readPendingChars())
+ print('\tContinuing subprocess (verbose):')
if not p.cont(1): # verbose continue
- print '\t** Continue seems to have failed! Probly lost subproc...'
+ print('\t** Continue seems to have failed! Probly lost subproc...')
return p
else:
- print '\tReading accumulated line, blocking read:'
- print p.readline()
- print "\tDeleting subproc, which was set to die noisily:"
+ print('\tReading accumulated line, blocking read:')
+ print(p.readline())
+ print("\tDeleting subproc, which was set to die noisily:")
del p
- print "\tDone."
+ print("\tDone.")
return None