def main(args): try: params = json.loads(args) except: print "Invalid Params error" sys.exit(0) conn = util.opendb() c = conn.cursor() util.create_schema(c) action = params['action'] if action == 'add': add_bookmark(params, c) elif action == 'delete': delete_bookmark(params, c) elif action == 'copy': copy_bookmark(params, c) elif action == 'edit': edit_bookmark(params) elif action == 'secret-open': go(params, c, secret=True) else: go(params, c) util.closedb(conn)
def main(): # arg parsing category = sys.argv[1] try: q = unicodedata.normalize('NFC', unicode(sys.argv[2].strip())) except: q = "" conn = util.opendb() c = conn.cursor() util.create_schema(c) auth = util.authinfo(c) (q,option) = get_option(c,q) last_q = q.split(' ')[-1] if q.startswith('_'): # option process_option(c,q) elif q.startswith('+'): # add bookmark add_bookmark(c,q) elif last_q.startswith('#') and (':' not in q): # tag expansion pbsearch_tag(c,'',last_q[1:]) else: pbsearch_sql(c,option,q) util.closedb(conn)
def main(): # arg parsing category = sys.argv[1] try: q = unicodedata.normalize('NFC', unicode(sys.argv[2].strip())) except: q = "" conn = util.opendb() c = conn.cursor() util.create_schema(c) auth = util.authinfo(c) (q, option) = get_option(c, q) last_q = q.split(' ')[-1] if q.startswith('_'): # option process_option(c, q) elif q.startswith('+'): # add bookmark add_bookmark(c, q) elif last_q.startswith('#') and (':' not in q): # tag expansion pbsearch_tag(c, '', last_q[1:]) else: pbsearch_sql(c, option, q) util.closedb(conn)
def main(): category = sys.argv[1] try: q = unicodedata.normalize('NFC', unicode(sys.argv[2].strip())) except: q = "" conn = util.opendb() c = conn.cursor() util.create_schema(c) if category == 'add': add_bookmark(c, q) else: pbsearch_sql(c, q) util.closedb(conn)
def main(cmd, args): # ex) tag status change : #tag_mark=1 # option change : _mark=1 # add url : + tag tag ; desc conn = util.opendb() c = conn.cursor() util.create_schema(c) if args.startswith('#'): change_tag_status(args[1:], c) elif args.startswith('_pbreload'): relaunch("reload", "") elif args.startswith('_'): update_option(args[1:], c) elif args.startswith('+'): add_bookmark(args[1:], c) else: process(cmd, args, c) util.closedb(conn)
def main(cmd,args): # ex) tag status change : #tag_mark=1 # option change : _mark=1 # add url : + tag tag ; desc conn = util.opendb() c = conn.cursor() util.create_schema(c) if args.startswith('#'): change_tag_status(args[1:],c) elif args.startswith('_pbreload'): relaunch("reload",""); elif args.startswith('_'): update_option(args[1:], c) elif args.startswith('+'): add_bookmark(args[1:], c) else: process(cmd,args,c) util.closedb(conn)
conn = util.opendb() c = conn.cursor() util.create_schema(c) pinboard_token=util.authinfo(c) if not pinboard_token: print "Setup Pinboard authentication token" sys.exit(0) server_time = pinboard_update_time(pinboard_token) sql_time = util.sql_update_time(c) now = datetime.datetime.utcnow() if (sql_time < server_time): pins = load_pinboard_data(pinboard_token) populate_data(c,pins,now) tags = load_tags_data(pinboard_token) populate_tags(c,tags,now) print "Sync with pinboard done..." else: print "No new data found..." util.update_sql_update_time_to_now(c,now) util.closedb(conn)
conn = util.opendb() c = conn.cursor() util.create_schema(c) pinboard_token = util.authinfo(c) if not pinboard_token: print "Setup Pinboard authentication token" sys.exit(0) server_time = pinboard_update_time(pinboard_token) sql_time = util.sql_update_time(c) now = datetime.datetime.utcnow() if (sql_time < server_time): pins = load_pinboard_data(pinboard_token) populate_data(c, pins, now) tags = load_tags_data(pinboard_token) populate_tags(c, tags, now) print "Sync with pinboard done..." else: print "No new data found..." util.update_sql_update_time_to_now(c, now) util.closedb(conn)