BukuBot/__main__.py

66 lines
2 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
# Slixmark: The XMPP Bookmark Manager
# Copyright (C) 2024 Schimon Zackary
# This file is part of Slixmark.
# See the file LICENSE for copying permission.
import buku
from bukuxmpp.about import Documentation
from bukuxmpp.config import Configuration
from bukuxmpp.xmpp.chat import Chat
from bukuxmpp.xmpp.client import Client
from getpass import getpass
from argparse import ArgumentParser
import logging
import os
import slixmpp
import sys
# bookmarks_db = buku.BukuDb(dbfile='temp.db')
# bookmarks_db.get_tag_all
# bookmarks_db.search_keywords_and_filter_by_tags
# bookmarks_db.exclude_results_from_search
def main():
# Setup the command line arguments.
parser = ArgumentParser(description=Client.__doc__)
# Output verbosity options.
parser.add_argument("-q", "--quiet", help="set logging to ERROR",
action="store_const", dest="loglevel",
const=logging.ERROR, default=logging.INFO)
parser.add_argument("-d", "--debug", help="set logging to DEBUG",
action="store_const", dest="loglevel",
const=logging.DEBUG, default=logging.INFO)
# JID and password options.
parser.add_argument("-j", "--jid", dest="jid",
help="JID to use")
parser.add_argument("-p", "--password", dest="password",
help="password to use")
args = parser.parse_args()
# Setup logging.
logging.basicConfig(level=args.loglevel,
format='%(levelname)-8s %(message)s')
if args.jid is None:
args.jid = input("Username: ")
if args.password is None:
args.password = getpass("Password: ")
# Setup the bot and register plugins. Note that while plugins may
# have interdependencies, the order in which you register them does
# not matter.
xmpp = Client(args.jid, args.password)
xmpp.connect()
xmpp.process()
if __name__ == '__main__':
main()