started implementing sponsorblock

This commit is contained in:
Hellow2
2023-06-14 12:38:36 +02:00
parent 01f882e0a1
commit 1e49089de9
20 changed files with 632 additions and 371 deletions

View File

@@ -1,9 +1,29 @@
from typing import List, Tuple
import ffmpeg
from ..utils.shared import BITRATE, AUDIO_FORMAT, CODEX_LOGGER as LOGGER
from ..objects import Target
def remove_intervals(target: Target, interval_list: List[Tuple[float, float]]):
if not target.exists:
LOGGER.warning(f"Target doesn't exist: {target.file_path}")
return
# https://stackoverflow.com/questions/50594412/cut-multiple-parts-of-a-video-with-ffmpeg
aselect_list: List[str] = []
start = 0
for end, next_start in interval_list:
aselect_list.append(f"between(t,{start},{end})")
start = next_start
aselect_list.append(f"gte(t,{next_start})")
select = f"aselect='{'+'.join(aselect_list)}',asetpts=N/SR/TB"
def correct_codec(target: Target, bitrate_kb: int = BITRATE, audio_format: str = AUDIO_FORMAT):
if not target.exists:
LOGGER.warning(f"Target doesn't exist: {target.file_path}")