BukuBot/__main__.py
2024-05-31 11:42:37 +03:00

66 lines
1.9 KiB
Python

#!/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 bukubot.about import Documentation
from bukubot.config import Configuration
from bukubot.xmpp.chat import Chat
from bukubot.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()