Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print debug even if PyAV not installed #621

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auto_editor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "26.1.0"
__version__ = "26.1.1"
18 changes: 11 additions & 7 deletions auto_editor/__main__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3

import platform as plat
import re
import sys
from os import environ
from os.path import exists, isdir, isfile, lexists, splitext
from subprocess import run

import auto_editor
from auto_editor.edit import edit_media
from auto_editor.utils.func import get_stdout
from auto_editor.utils.log import Log
from auto_editor.utils.types import (
Expand Down Expand Up @@ -329,15 +329,17 @@ def main() -> None:
return

if args.debug and not args.input:
import platform as plat
print(f"OS: {plat.system()} {plat.release()} {plat.machine().lower()}")
print(f"Python: {plat.python_version()}")

import av
try:
import av

license = av._core.library_meta["libavcodec"]["license"]
license = av._core.library_meta["libavcodec"]["license"]
print(f"PyAV: {av.__version__} ({license})")
except (ModuleNotFoundError, ImportError):
print("PyAV: error")

print(f"OS: {plat.system()} {plat.release()} {plat.machine().lower()}")
print(f"Python: {plat.python_version()}")
print(f"PyAV: {av.__version__} ({license})")
print(f"Auto-Editor: {auto_editor.__version__}")
return

Expand All @@ -363,6 +365,8 @@ def main() -> None:
log.error(f"Option/Input file doesn't exist: {my_input}")
paths.append(my_input)

from auto_editor.edit import edit_media

try:
edit_media(paths, args, log)
except KeyboardInterrupt:
Expand Down
5 changes: 3 additions & 2 deletions auto_editor/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from shutil import get_terminal_size, rmtree
from tempfile import mkdtemp
from time import perf_counter, sleep
from typing import NoReturn
from typing import TYPE_CHECKING, NoReturn

import av
if TYPE_CHECKING:
import av


class Log:
Expand Down
Loading