Skip to content

Commit

Permalink
https://github.com/ytdl-org/youtube-dl/issues/31530
Browse files Browse the repository at this point in the history
  • Loading branch information
gnawhleinad committed Apr 21, 2023
1 parent 41c4800 commit 7e27093
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
brew "youtube-dl"
brew "ffmpeg"
brew "yt-dlp"
cask "vlc"
11 changes: 6 additions & 5 deletions youtube
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

VLC="cvlc"
YOUTUBEDL="yt-dlp"

vlc_opts="--play-and-exit"
yt_opts=""
Expand Down Expand Up @@ -52,23 +53,23 @@ fi
if [[ $link =~ list= ]]; then
yt_opts="${yt_opts} --ignore-errors"

directory=`youtube-dl --playlist-items 1 --get-filename \
directory=`${YOUTUBEDL} --playlist-items 1 --get-filename \
--output "%(playlist_id)s" "$link"`
out="${out}/${directory}"

mkdir -p ${out}
youtube-dl $yt_opts --no-part --output "${out}/%(id)s.%(ext)s" \
${YOUTUBEDL} $yt_opts --no-part --output "${out}/%(id)s.%(ext)s" \
"$link" && \
${listen} $out/* &
else
file=`youtube-dl $yt_opts --get-filename --output "%(id)s.%(ext)s" "$link"`
file=`${YOUTUBEDL} $yt_opts --get-filename --output "%(id)s.%(ext)s" "$link"`
out="${out}/${file}"

if [[ -z $offset ]]; then
youtube-dl $yt_opts --no-part --output "$out" \
${YOUTUBEDL} $yt_opts --no-part --output "$out" \
--exec "${listen} {} &" "$link"
else
youtube-dl $yt_opts --no-part --output "$out" \
${YOUTUBEDL} $yt_opts --no-part --output "$out" \
--postprocessor-args "-ss $offset -t $duration" \
--exec "${listen} --quiet {} &" "$link"
fi
Expand Down

0 comments on commit 7e27093

Please sign in to comment.