5
0

vivy: tv: friendship ended with funi & subsplease

Erai-Raws has good funi audio still if amazon isn't out in time
This commit is contained in:
louis f 2021-04-17 18:19:28 -04:00
parent f94427318c
commit 69c3ddaa61
Signed by: louis
GPG Key ID: 44D7E1DE4E23D6F2
4 changed files with 21 additions and 41 deletions

4
.gitignore vendored
View File

@ -6,8 +6,12 @@
*.png
*.aac
*.m4a
*.h264
*.h265
*.eac3
*.ass
*.mka
*.xml
cudnn_data/
*.webm
ffmpeg2pass*.log

View File

@ -1,32 +0,0 @@
#!/usr/bin/env python3
import vapoursynth as vs
import acsuite
import os
import sys
from subprocess import DEVNULL, call
from vivy_common.util import FUNI_FILENAME, FUNI_INTRO, glob_crc
EPNUM: int = int(sys.argv[1])
ac = acsuite.AC()
core = vs.core
funi: str = glob_crc(os.path.join(f"{EPNUM:02d}", FUNI_FILENAME.format(epnum=EPNUM)))
src = core.ffms2.Source(funi)
if __name__ == "__main__":
funi_audio: str = f"{EPNUM:02d}/funi.aac"
if not os.path.isfile(funi_audio):
call(["ffmpeg",
"-i", funi,
"-vn",
"-sn",
"-map_metadata", "-1",
"-c:a", "copy",
funi_audio],
stdout=DEVNULL, stderr=DEVNULL
)
ac.eztrim(src, (FUNI_INTRO, 0), funi_audio, f"{EPNUM:02d}/{EPNUM:02d}_cut.mka")

View File

@ -24,7 +24,7 @@ ignore_errors = False
allow_untyped_globals = False
allow_redefinition = False
implicit_reexport = False
implicit_reexport = True
strict_equality = True
show_error_context = False
@ -34,6 +34,8 @@ color_output = True
error_summary = True
pretty = True
mypy_path = .
[mypy-cytoolz.*]
ignore_errors = True

View File

@ -184,13 +184,16 @@ class AudioGetter():
print(f"{SUCCESS}Found Amazon audio{RESET}")
return
# as of Ep4 SubsPlease is using new funi 128kbps aac while erai has 256kbps still
try:
if os.path.isfile(ER_FILENAME.format(epnum=epnum)):
self.audio_file = ER_FILENAME.format(epnum=epnum)
self.video_src = core.ffms2.Source(ER_FILENAME.format(epnum=epnum))
if os.path.isfile(glob_crc(SUBSPLS_FILENAME.format(epnum=epnum))):
self.audio_file = glob_crc(SUBSPLS_FILENAME.format(epnum=epnum))
self.video_src = core.ffms2.Source(glob_crc(SUBSPLS_FILENAME.format(epnum=epnum)))
elif os.path.isfile(ER_FILENAME.format(epnum=epnum)):
self.audio_file = ER_FILENAME.format(epnum=epnum)
self.video_src = core.ffms2.Source(ER_FILENAME.format(epnum=epnum))
if (epnum >= 4):
print(f"{WARNING}Using SubsPlease, audio may be worse than Erai-Raws{RESET}")
else:
raise FileNotFoundError()
except FileNotFoundError:
@ -305,7 +308,8 @@ class SelfRunner():
try:
print(f"{STATUS}--- MUXING FILE ---{RESET}")
if self._mux(f"{TITLE.lower()}_{epnum:02d}_{args.suffix}.mkv", not args.no_metadata) != 0:
if self._mux(f"{TITLE.lower()}_{epnum:02d}_{args.suffix}.mkv", not args.no_metadata,
not args.no_metadata and start == 0 and end == self.clip.num_frames) != 0:
raise Exception("mkvmerge failed")
except Exception:
print(f"{ERROR}--- MUXING FAILED ---{RESET}")
@ -321,7 +325,7 @@ class SelfRunner():
print(f"{SUCCESS}--- ENCODE COMPLETE ---{RESET}")
def _mux(self, name: str, metadata: bool = True) -> int:
def _mux(self, name: str, metadata: bool = True, chapters: bool = True) -> int:
mkvtoolnix_args = [
"mkvmerge",
"--output", name,
@ -337,10 +341,12 @@ class SelfRunner():
mkvtoolnix_args += [
"--title", f"[{SUBGROUP}] {TITLE_LONG} - {self.epnum:02d}",
]
chapters = [f for f in ["{self.epnum:02d}.xml", "chapters.xml"] if os.path.isfile(f)]
if len(chapters) != 0:
if chapters:
chap = [f for f in ["{self.epnum:02d}.xml", "chapters.xml"] if os.path.isfile(f)]
if len(chap) != 0:
mkvtoolnix_args += [
"--chapters", chapters[0],
"--chapters", chap[0],
]
print("+ " + " ".join(mkvtoolnix_args))