blob: 615822fe74298f22735df025543eaff9f7eeeeac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0"
if [[ -n "${args['--download']}" ]]; then
START=$(date +%s)
yt_dlp_command=(
"yt-dlp"
"--all-subs"
"--cookies-from-browser" "firefox"
"--embed-subs"
"--external-downloader=aria2c"
"--external-downloader-args"
'--min-split-size=1M --max-connection-per-server=16 --max-concurrent-downloads=16 --split=16'
"-f" 'best[height=1080]'
"--remux" "mkv"
"--merge" "mkv"
"--verbose"
"--user-agent" "${user_agent}"
"${args[uri]}"
)
if [ -n "${args['--username']}" ] || [ -n "${args['--password']}" ]; then
yt_dlp_command+=(-u "${args['--username']}")
yt_dlp_command+=(-p "${args['--password']}")
fi
if [ -n "${args['--cookies']}" ]; then
yt_dlp_command+=(--cookies "${args['--cookies']}")
fi
"${yt_dlp_command[@]}"
printf "\ntook %s seconds\n" $(($(date +%s || true) - START))
return
fi
# mpv "$(yt-dlp \
# --cookies-from-browser firefox \
# --extractor-args crunchyrollbeta:hardsub=en-US \
# -f 'best[height=1080]' \
# -g \
# --verbose \
# "${1}")"
subtitles_command=(
'yt-dlp'
'--cookies-from-browser' 'firefox'
'--no-download'
'-o' '/tmp/skyla_subtitles'
'--sub-lang' "${args['--language']}"
'--write-subs'
'--user-agent' "${user_agent}"
"${args[uri]}"
)
if [ -n "${args['--username']}" ] || [ -n "${args['--password']}" ]; then
subtitles_command+=(-u "${args['--username']}")
subtitles_command+=(-p "${args['--password']}")
fi
if [ -n "${args['--cookies']}" ]; then
subtitles_command+=(--cookies "${args['--cookies']}")
fi
"${subtitles_command[@]}"
if [[ -n "${args['--fix']}" ]]; then
sed -i 's/{an\d*}//g' /tmp/skyla_subtitles.*.ass
fi
media_command=(
'yt-dlp'
'--cookies-from-browser' 'firefox'
'-f' 'best[height=1080]'
'-g'
'--user-agent' "${user_agent}"
"${args[uri]}"
)
if [ -n "${args['--username']}" ]; then
media_command+=(-u "${args['--username']}")
media_command+=(-p "${args['--password']}")
fi
memento \
--sub-file="/tmp/skyla_subtitles.${args['--language']}.ass" \
"$("${media_command[@]}")"
rm /tmp/skyla_subtitles.*.ass
|