diff options
| author | Fuwn <[email protected]> | 2023-12-05 18:47:03 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-12-05 18:47:03 -0800 |
| commit | 6d8d0786c191ac1b4796b3fe1351dfcae1cf62a8 (patch) | |
| tree | 8188a152e47d7780ece8a90042e8f8d0a3833eae /src/stream_command.sh | |
| parent | feat(stream): better fast forward defaults (diff) | |
| download | kaguya-main.tar.xz kaguya-main.zip | |
Diffstat (limited to 'src/stream_command.sh')
| -rw-r--r-- | src/stream_command.sh | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/stream_command.sh b/src/stream_command.sh index 97eee4c..a483882 100644 --- a/src/stream_command.sh +++ b/src/stream_command.sh @@ -1,29 +1,40 @@ user_agent="${args['--user-agent']}" -if [[ -n "${user_agent}" ]]; then - user_agent="--user-agent=${user_agent}" -fi - if [[ -n "${args['--download']}" ]]; then START=$(date +%s) - yt-dlp \ - --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' \ - --cookies-from-browser "${args[--browser]}" \ - --all-subs \ - --embed-subs \ - --af="scaletempo=stride=28:overlap=.9:search=25" \ - "${user_agent}" \ - "${args[uri]}" + download_command=( + yt-dlp + --format 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' + --cookies-from-browser "${args[--browser]}" + --all-subs + --embed-subs + ) + + if [ -n "${user_agent}" ]; then + download_command+=(--user-agent "${user_agent}") + fi + + download_command+=("${args[uri]}") + + "${download_command[@]}" printf "\ntook %s seconds\n" $(($(date +%s || true) - START)) return fi -mpv \ - --ytdl-raw-options-append=format='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' \ - --ytdl-raw-options-append=cookies-from-browser="${args[--browser]}" \ - --af="scaletempo=stride=28:overlap=.9:search=25" \ - "${user_agent}" \ - "${args[uri]}" +stream_command=( + mpv + --ytdl-raw-options-append=format='bestvideo[ext=mp4]+bestaudio[ext=m4a]/best' + --ytdl-raw-options-append=cookies-from-browser="${args[--browser]}" + --af="scaletempo=stride=28:overlap=.9:search=25" +) + +if [ -n "${user_agent}" ]; then + stream_command+=(--ytdl-raw-options-append=user-agent="${user_agent}") +fi + +stream_command+=("${args[uri]}") + +"${stream_command[@]}" |