This commit is contained in:
Hellow2 2023-04-05 16:11:30 +02:00
parent 2a1d5bef1c
commit 4efef86793
4 changed files with 42 additions and 10 deletions

View File

@ -1,7 +1,9 @@
from . import metadata
from . import codex
from . import codec
AudioMetadata = metadata.AudioMetadata
write_many_metadata = metadata.write_many_metadata
write_metadata = metadata.write_metadata
write_metadata_to_target = metadata.write_metadata_to_target
correct_codec = codec.correct_codec

View File

@ -0,0 +1,38 @@
from pathlib import Path
import ffmpeg
from ..utils.shared import BITRATE, CODEX_LOGGER as LOGGER
from ..objects import Target
def correct_codec(target: Target, bitrate: int = BITRATE):
if not target.exists:
LOGGER.warning(f"Target doesn't exist: {target.file_path}")
output_file = Path(str(target.file_path) + ".out")
# https://www.audioranger.com/audio-formats.php
# https://kkroening.github.io/ffmpeg-python/index.html?highlight=audio#ffmpeg.output
ffmpeg_out = ffmpeg.output(
ffmpeg.input(target.file_path),
output_file,
audio_bitrate=bitrate,
format="mp3"
).run()
"""
in_file = ffmpeg.input('input.mp4')
overlay_file = ffmpeg.input('overlay.png')
(
ffmpeg
.concat(
in_file.trim(start_frame=10, end_frame=20),
in_file.trim(start_frame=30, end_frame=40),
)
.overlay(overlay_file.hflip())
.drawbox(50, 50, 120, 120, color='red', thickness=5)
.output('out.mp4')
.run()
)
"""

View File

@ -1,8 +0,0 @@
import ffmpeg
from ..utils.shared import BITRATE
from ..objects import Target
def correct_codex(target: Target, bitrate: int = BITRATE):
if not target.exists:
pass

View File

@ -62,8 +62,8 @@ ENCYCLOPAEDIA_METALLUM_LOGGER = logging.getLogger("ma")
DOWNLOAD_LOGGER = logging.getLogger("download")
TAGGING_LOGGER = logging.getLogger("tagging")
CODEX_LOGGER = logging.getLogger("codex")
NOT_A_GENRE = ".", "..", "misc_scripts", "Music", "script", ".git", ".idea"
MUSIC_DIR: Path = Path(os.path.expanduser("~"), "Music")
NOT_A_GENRE_REGEX: List[str] = (
r'^\.', # is hidden/starts with a "."