Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
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)
Beispiel #4
0
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)
Beispiel #5
0
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)
Beispiel #6
0
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)
Beispiel #7
0
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)
Beispiel #8
0
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)
Beispiel #9
0
        except:
            print data
            sys.exit(0)
        else:
            # print "Loading tags completed"
            return tags
    except IOError as e:
        print e
        sys.exit(0)

if __name__ == '__main__':

    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)
Beispiel #10
0
            print data
            sys.exit(0)
        else:
            # print "Loading tags completed"
            return tags
    except IOError as e:
        print e
        sys.exit(0)


if __name__ == '__main__':

    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)