Show only error and skipped if --tacit is used
This commit is contained in:
parent
c80a5a8e82
commit
c40cd302bf
20
buku.py
20
buku.py
@ -50,7 +50,7 @@ tagsearch = False # Search bookmarks by tag
|
|||||||
title_data = None # Title fetched from a webpage
|
title_data = None # Title fetched from a webpage
|
||||||
interrupted = False # Received SIGINT
|
interrupted = False # Received SIGINT
|
||||||
DELIM = ',' # Delimiter used to store tags in DB
|
DELIM = ',' # Delimiter used to store tags in DB
|
||||||
SKIP_MIMES = {'.txt', '.pdf'} # Skip connecting to web for these mimes
|
SKIP_MIMES = {'.pdf', '.txt'} # Skip connecting to web for these mimes
|
||||||
http_handler = None # urllib3 PoolManager handler
|
http_handler = None # urllib3 PoolManager handler
|
||||||
|
|
||||||
# Crypto globals
|
# Crypto globals
|
||||||
@ -702,15 +702,23 @@ class BukuDb:
|
|||||||
for row in resultset:
|
for row in resultset:
|
||||||
title = network_handler(row[1])
|
title = network_handler(row[1])
|
||||||
if title == '':
|
if title == '':
|
||||||
print('\x1b[1mIndex %d: no title\x1b[21m\x1B[0m\n' % row[0])
|
skip = False
|
||||||
|
for mime in SKIP_MIMES:
|
||||||
|
if row[1].lower().endswith(mime):
|
||||||
|
skip = True
|
||||||
|
break
|
||||||
|
if skip:
|
||||||
|
print('\x1b[1mIndex %d: skipped mime\x1B[0m\n' % row[0])
|
||||||
|
else:
|
||||||
|
print('\x1b[1mIndex %d: no title\x1B[0m\n' % row[0])
|
||||||
continue
|
continue
|
||||||
else:
|
|
||||||
print('Title: [%s]' % title)
|
|
||||||
|
|
||||||
self.cur.execute(query, (title, row[0],))
|
self.cur.execute(query, (title, row[0],))
|
||||||
print('\x1B[92mIndex %d updated\x1B[0m\n' % row[0])
|
|
||||||
|
if self.chatty:
|
||||||
|
print('Title: [%s]\n\x1B[92mIndex %d updated\x1B[0m\n'
|
||||||
|
% (title, row[0]))
|
||||||
if interrupted:
|
if interrupted:
|
||||||
logger.warning('^C pressed. Aborting DB refresh...')
|
|
||||||
break
|
break
|
||||||
|
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user