Skip to content

Commit

Permalink
Merge branch 'dev-implement-click' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeTravelPenguin committed Mar 4, 2024
2 parents 0a3f2d1 + 73215d4 commit 6b91188
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 557 deletions.
261 changes: 131 additions & 130 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ homepage = "https://github.com/TimeTravelPenguin/BulkAudioExtractTool"
repository = "https://github.com/TimeTravelPenguin/BulkAudioExtractTool"

[tool.poetry.scripts]
# baet = "BAET.__main__:main"
# cli = "BAET.cli.cli:test"
baet = "BAET.cli.cli:cli"
debug = "BAET.cli.__main__:debug"
baet = "BAET.__main__:main"

[tool.poetry.dependencies]
python = ">=3.11,<4.0.0"
Expand Down
3 changes: 3 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ line-length = 120
src = ["src", "tests"]
fix = true

[format]
docstring-code-format = true

[lint]
extend-select = [
"F", "I", "E", "W", "I", "D", "S", "G", "C4",
Expand Down
33 changes: 3 additions & 30 deletions src/BAET/__main__.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
"""Bulk Audio Export Tool (BAET) is a command line tool for exporting audio tracks from video files in bulk."""

import sys
from datetime import datetime
from pathlib import Path

import rich
from rich.live import Live
from rich.traceback import install

from . import app_console, configure_logging, create_logger
from .app_args import get_args
from .FFmpeg.extract import MultiTrackAudioBulkExtractor
from BAET.cli.cli import cli

# Enable rich traceback
install(show_locals=True)


def main() -> None:
"""Entry point for BAET."""
args = get_args()

if args.debug_options.print_args:
rich.print(args)
sys.exit(0)

if args.debug_options.logging:
log_path = Path("~/.baet").expanduser()
log_path.mkdir(parents=True, exist_ok=True)
log_file = log_path / f"logs_{datetime.now()}.txt"
log_file.touch()

configure_logging(enable_logging=True, file_out=log_file)
else:
configure_logging(enable_logging=False, file_out=None)

logger = create_logger()
extractor = MultiTrackAudioBulkExtractor(args)

with Live(extractor, console=app_console):
logger.info("Running jobs")
extractor.run_synchronously()

cli()
sys.exit(0)
Loading

0 comments on commit 6b91188

Please sign in to comment.