Example #1
0
import sys
import requests
import spotipy  # type: ignore
import mutagen  # type: ignore

from click_skeleton import backtrace, version_checker, helpers
from musicbot.config import Conf
from musicbot.cli import main_cli, PROG_NAME, __version__
from musicbot import exceptions

logger = logging.getLogger(__name__)

backtrace.hook(
    reverse=False,
    align=True,
    strip_path=False,
    enable_on_envvar_only=False,
    on_tty=False,
    conservative=False,
)


def main(**kwargs) -> int:
    helpers.raise_limits()
    check_version = helpers.str2bool(os.getenv('MB_CHECK_VERSION', 'true'))
    version_check = version_checker.VersionCheckerThread(
        prog_name=PROG_NAME,
        current_version=__version__,
        autostart=check_version,
    )
    exit_code = 1
    try:
Example #2
0
import uvloop
from beartype import beartype
from click_skeleton import backtrace, doc, helpers, skeleton, version_checker

import musicbot
import musicbot.commands
from musicbot import Config, MusicbotObject, version
# from musicbot.helpers import async_run
from musicbot.cli.config import config_options
from musicbot.cli.options import dry_option
from musicbot.exceptions import MusicbotError

PROG_NAME: Final[str] = "musicbot"
logger = logging.getLogger(__name__)

backtrace.hook(strip_path=False, enable_on_envvar_only=False, on_tty=False)


@skeleton(name=PROG_NAME, version=version.__version__, auto_envvar_prefix='MB')
@click.pass_context
@config_options
@dry_option
@beartype
def cli(
    ctx: click.Context,
    log: str | None,
    color: bool,
    quiet: bool,
    debug: bool,
    info: bool,
    warning: bool,