From: Oleg Broytman Date: Mon, 28 Jul 2003 12:31:39 +0000 (+0000) Subject: Updated to m_lib version 1.2. Extended support for Mozilla. X-Git-Tag: v4.5.3~363 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=387f77d110986aa12967c9cd788ab0e4f41f2be2;p=bookmarks_db.git Updated to m_lib version 1.2. Extended support for Mozilla. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@13 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Makefile b/Makefile index a157484..d5c900e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -VERSION=3.3.2 +VERSION=3.4.0 EXAMPLE_SHELL=ns-unescape mz-unescape bkmk2db koi2win.db \ bkmk-koi bkmk-win bkmk-chk bkmk-set bkmk-sort hotexplode.pl \ check_title.py set-real_title.py set-title-list.py.py \ - bkmk-add.py bkmk-add bkmk-rsync + bkmk-add.py bkmk-add bkmk-rsync mz2ns .PHONY: all diff --git a/Robots/bkmk_rsimple.py b/Robots/bkmk_rsimple.py index 7a96d25..e2f4dad 100644 --- a/Robots/bkmk_rsimple.py +++ b/Robots/bkmk_rsimple.py @@ -17,7 +17,7 @@ class RedirectException(Exception): import string, os import time, urllib -from m_lib.www.util import parse_time +from m_lib.net.www.util import parse_time from m_lib.md5wrapper import md5wrapper diff --git a/Robots/parse_html.py b/Robots/parse_html.py index a534e21..ffacbee 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -12,7 +12,7 @@ DEFAULT_CHARSET = "windows-1251" # Stupid default for Russian Cyrillic from HTMLParser import HTMLParseError -from m_lib.www.html import HTMLParser as _HTMLParser +from m_lib.net.www.html import HTMLParser as _HTMLParser class HTMLHeadDone(Exception): pass diff --git a/bkmk-chk b/bkmk-chk index 82f3fbe..4faadd2 100755 --- a/bkmk-chk +++ b/bkmk-chk @@ -13,4 +13,4 @@ check_dups.py -s -l bookmarks.err || exit 1 # Write results to output bookmarks files db2bkmk.py || exit 1 -diff $HOME/.netscape/bookmarks.html bookmarks.html > diff.out +#diff $HOME/.netscape/bookmarks.html bookmarks.html > diff.out diff --git a/bkmk-koi b/bkmk-koi index 8657b3c..36d2edc 100755 --- a/bkmk-koi +++ b/bkmk-koi @@ -2,17 +2,8 @@ PATH=$HOME/lib/bookmarks_db:$PATH -if [ -f ./bookmarks.html ]; then - BKMK= -elif [ -f $HOME/.netscape/bookmarks.html ]; then - BKMK=$HOME/.netscape/bookmarks.html -else - echo Cannot find bookmarks.html, aborted - exit 1 -fi - -ns-unescape || exit 1 +mz-unescape || exit 1 bkmk2db || exit 1 #check_db.py -l bookmarks.err || exit 1 @@ -37,9 +28,9 @@ replace public-win.tmp http://koi.postman.ru/ http://win.postman.ru/ towin < private-win.tmp > bookmark.ht0 towin < public-win.tmp > bookmark.ht1 -diff $HOME/.netscape/bookmarks.html bookmarks.html > diff.out - -if [ "$1" = "-c" ]; then - echo -n "Copying to home: " - cp -p bookmarks.html $HOME/.netscape/bookmarks.html && echo "Ok" -fi +#diff $HOME/.netscape/bookmarks.html bookmarks.html > diff.out +# +#if [ "$1" = "-c" ]; then +# echo -n "Copying to home: " +# cp -p bookmarks.html $HOME/.netscape/bookmarks.html && echo "Ok" +#fi diff --git a/bkmk-rsync b/bkmk-rsync index b819382..8af153e 100755 --- a/bkmk-rsync +++ b/bkmk-rsync @@ -2,7 +2,7 @@ remote_server=sun -rsync -avz "$HOME/.netscape/bookmarks.html" "$remote_server:.netscape" # && \ +#rsync -avz "$HOME/.netscape/bookmarks.html" "$remote_server:.netscape" # && \ #rsync -avz "$HOME/Internet/WWW/phd.pp.ru/Bookmarks/bkmk-koi.html" \ # "$HOME/Internet/WWW/phd.pp.ru/Bookmarks/bkmk-win.html" \ diff --git a/bkmk-win b/bkmk-win index c737d3d..fab966d 100755 --- a/bkmk-win +++ b/bkmk-win @@ -10,7 +10,6 @@ fi fromwin < bookmark.htm > bookmarks.html || exit 1 -ns-unescape || exit 1 bkmk2db || exit 1 #check_db.py -l bookmarks.err || exit 1 @@ -25,17 +24,15 @@ towin < bookmarks.html > bookmark.ht0 towin < public-win.tmp > bookmark.ht1 -replace() { - sed "s^$2^$3^" $1 > _tmp.$$ - mv _tmp.$$ $1 -} +#replace() { +# sed "s^$2^$3^" $1 > _tmp.$$ +# mv _tmp.$$ $1 +#} +# +#replace bookmarks.html http://win.postman.ru/ http://koi.postman.ru/ +#replace public-koi.tmp http://win.postman.ru/ http://koi.postman.ru/ -replace bookmarks.html http://win.aha.ru/ http://koi.aha.ru/ -replace public-koi.tmp http://win.aha.ru/ http://koi.aha.ru/ -replace bookmarks.html http://win.postman.ru/ http://koi.postman.ru/ -replace public-koi.tmp http://win.postman.ru/ http://koi.postman.ru/ - -if [ "$1" = "-c" ]; then - echo -n "Copying to home: " - cp -p bookmarks.html $HOME/.netscape/bookmarks.html && echo "Ok" -fi +#if [ "$1" = "-c" ]; then +# echo -n "Copying to home: " +# cp -p bookmarks.html $HOME/.netscape/bookmarks.html && echo "Ok" +#fi diff --git a/bkmk2db b/bkmk2db index 1874e28..c3c8d20 100755 --- a/bkmk2db +++ b/bkmk2db @@ -1,18 +1,21 @@ #! /bin/sh -PATH=$HOME/lib/bookmarks_db:$PATH +PATH="$HOME/lib/bookmarks_db:$PATH" +. "$HOME/lib/config/mozilla_home" if [ ! -f ./bookmarks_db.pickle -a ! -f ./bookmarks_db.flad ]; then if [ -f ./bookmarks.html ]; then - BKMK= - elif [ -f $HOME/.netscape/bookmarks.html ]; then - BKMK=$HOME/.netscape/bookmarks.html + BKMK=bookmarks.html + elif [ -f "$mozilla_home/bookmarks.html" ]; then + BKMK="$mozilla_home/bookmarks.html" + elif [ -f "$HOME/.netscape/bookmarks.html" ]; then + BKMK="$HOME/.netscape/bookmarks.html" else echo Cannot find bookmarks.html, aborted exit 1 fi - bkmk2db.py $BKMK || exit 1 + bkmk2db.py "$BKMK" || exit 1 elif [ -f ./bookmarks_db.pickle -a -f ./bookmarks.html -a ./bookmarks.html -nt ./bookmarks_db.pickle ]; then bkmk2db.py || exit 1 diff --git a/bkmk_objects.py b/bkmk_objects.py index 2cb4600..04fe535 100644 --- a/bkmk_objects.py +++ b/bkmk_objects.py @@ -1,7 +1,7 @@ """ Objects to represent bookmarks.html structure - Written by BroytMann, Mar 2000 - Jul 2002. Copyright (C) 2000-2002 PhiloSoft Design + Written by BroytMann, Mar 2000 - Jul 2003. Copyright (C) 2000-2003 PhiloSoft Design """ @@ -42,7 +42,8 @@ class Bookmark: isFolder = 0 isBookmark = 1 - def __init__(self, href, add_date, last_visit, last_modified, comment = ''): + def __init__(self, href, add_date, last_visit=None, last_modified=None, + comment = ''): self.comment = comment self.href = href self.add_date = add_date diff --git a/bkmk_parser.py b/bkmk_parser.py index f396e2e..c156cb7 100755 --- a/bkmk_parser.py +++ b/bkmk_parser.py @@ -1,12 +1,12 @@ """ Parser for Netscape Navigator's bookmarks.html - Written by BroytMann, Jun 1997 - Jun 2002. Copyright (C) 1997-2002 PhiloSoft Design + Written by BroytMann, Jun 1997 - Jul 2003. Copyright (C) 1997-2003 PhiloSoft Design """ import string -from m_lib.www.html import HTMLParser +from m_lib.net.www.html import HTMLParser from bkmk_objects import Folder, Bookmark, Ruler @@ -116,6 +116,9 @@ class BkmkParser(HTMLParser): # Start bookmark def start_a(self, attrs): + last_visit = None + last_modified = None + for attrname, value in attrs: value = string.strip(value) if attrname == 'href': diff --git a/doc/ANNOUNCE b/doc/ANNOUNCE index 3dcc08f..5160ef7 100644 --- a/doc/ANNOUNCE +++ b/doc/ANNOUNCE @@ -9,6 +9,10 @@ extend Navigator's "What's new" feature (Navigator 4 calls it "Update bookmarks"). +WHAT'S NEW in version 3.4.0 + Updated to m_lib version 1.2. Extended support for Mozilla. + + WHAT'S NEW in version 3.3.2 parse_html.py can now recode unicode entities in titles. diff --git a/mz-unescape b/mz-unescape index 8bf8865..841c80a 100755 --- a/mz-unescape +++ b/mz-unescape @@ -1,6 +1,6 @@ #! /bin/sh -dest_dir=$HOME/.mozilla/phd/`ls -1 $HOME/.mozilla/phd` +. "$HOME/lib/config/mozilla_home" sed -e 's/<//g' -e 's/&/\&/g' \ - $dest_dir/bookmarks.html >_tmp.$$ && \ -exec mv _tmp.$$ $dest_dir/bookmarks.html + "$mozilla_home/bookmarks.html" >_tmp.$$ && \ +exec mv _tmp.$$ "$mozilla_home/bookmarks.html" diff --git a/ns-unescape b/ns-unescape index 90f4f8f..7fc559a 100755 --- a/ns-unescape +++ b/ns-unescape @@ -1,5 +1,5 @@ #! /bin/sh sed -e 's/<//g' -e 's/&/\&/g' \ - $HOME/.netscape/bookmarks.html >_tmp.$$ && \ -exec mv _tmp.$$ $HOME/.netscape/bookmarks.html + "$HOME/.netscape/bookmarks.html" >_tmp.$$ && \ +exec mv _tmp.$$ "$HOME/.netscape/bookmarks.html"