Show all bookmarks with empty titles or no tags.
Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
parent
eae1237ea7
commit
b5f066ba43
@ -46,6 +46,7 @@ If you find `buku` useful, please consider donating via PayPal.
|
||||
- Refresh all bookmarks online
|
||||
- Auto-compact DB on a single bookmark removal
|
||||
- Delete all bookmarks from DB
|
||||
- Show all bookmarks with empty titles or no tags (for bookkeeping)
|
||||
- Add a bookmark at N<sup>th</sup> index, to fill deleted bookmark indices
|
||||
- Secure parameterized SQLite3 queries to access database
|
||||
- Handle multiple HTTP redirections (reports redireted URL, loops, IP blocking)
|
||||
@ -130,6 +131,7 @@ You may need to use `sudo` with `PREFIX` depending on your permissions on destin
|
||||
-a URL tag 1, tag 2, ... add URL as bookmark with comma separated tags
|
||||
-d N delete entry at DB index N (from -P), move last entry to N
|
||||
-D delete ALL bookmarks
|
||||
-e show bookmarks with empty titles or no tags
|
||||
-g show all tags (sorted alphabetically)
|
||||
-i N insert entry at DB index N, useful to fill deleted index
|
||||
-k decrypt (unlock) database file
|
||||
|
22
buku
22
buku
@ -51,6 +51,7 @@ addurl = False
|
||||
addindex = None
|
||||
online = False
|
||||
delete = False
|
||||
empty = False
|
||||
openurl = None
|
||||
show = False
|
||||
showindex = None
|
||||
@ -79,6 +80,7 @@ def usage():
|
||||
print(" -a URL tag 1, tag 2, ... add URL as bookmark with comma separated tags")
|
||||
print(" -d N delete entry at DB index N (from -P), move last entry to N")
|
||||
print(" -D delete ALL bookmarks")
|
||||
print(" -e show bookmarks with empty titles or no tags")
|
||||
print(" -g show all tags (sorted alphabetically)")
|
||||
print(" -i N insert entry at DB index N, useful to fill deleted index")
|
||||
print(" -k decrypt (unlock) database file")
|
||||
@ -420,11 +422,20 @@ def cleardb(conn, cur, index):
|
||||
|
||||
|
||||
# Print all records in the table
|
||||
def printdb(cur, index):
|
||||
def printdb(cur, index, empty=False):
|
||||
global showOpt
|
||||
resultset = None
|
||||
|
||||
if index == None: # Show all entries
|
||||
for row in cur.execute('SELECT * FROM bookmarks'):
|
||||
if empty == False:
|
||||
cur.execute('SELECT * FROM bookmarks')
|
||||
resultset = cur.fetchall()
|
||||
else:
|
||||
cur.execute("SELECT * FROM bookmarks WHERE metadata = '' OR tags = ','")
|
||||
resultset = cur.fetchall()
|
||||
print("\x1b[1m%d records found\x1b[21m\n" % len(resultset))
|
||||
|
||||
for row in resultset:
|
||||
if showOpt == 1:
|
||||
print("%s %s" % (row[0], row[1]))
|
||||
elif showOpt == 2:
|
||||
@ -743,7 +754,7 @@ if len(sys.argv) < 2:
|
||||
|
||||
# Check cmdline options
|
||||
try:
|
||||
optlist, keywords = getopt(sys.argv[1:], "d:i:m:o:p:t:u:x:aDgklPRrsSwz")
|
||||
optlist, keywords = getopt(sys.argv[1:], "d:i:m:o:p:t:u:x:aDegklPRrsSwz")
|
||||
if len(optlist) < 1:
|
||||
usage()
|
||||
|
||||
@ -773,6 +784,8 @@ try:
|
||||
usage()
|
||||
|
||||
delete = True
|
||||
elif opt[0] == "-e":
|
||||
empty = True
|
||||
elif opt[0] == "-g":
|
||||
showTags = True
|
||||
elif opt[0] == "-i":
|
||||
@ -933,6 +946,9 @@ if show == True:
|
||||
if showTags == True:
|
||||
showUniqueTags(cur)
|
||||
|
||||
if empty == True:
|
||||
printdb(cur, None, empty)
|
||||
|
||||
# Open URL in browser
|
||||
if openurl != None:
|
||||
fetchopen(openurl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user