Now it is much faster
This commit is contained in:
parent
93d7c7e187
commit
b72c46c7a9
|
@ -6,11 +6,18 @@ scripts_folder=$(dirname "$(readlink -f "$0")")
|
||||||
|
|
||||||
[ -n "$3" ] && dateafter="--dateafter $3"
|
[ -n "$3" ] && dateafter="--dateafter $3"
|
||||||
|
|
||||||
sh "$scripts_folder/no-response-timeout.sh" -f 128 -r 10 \
|
|
||||||
youtube-dl --get-id "$channel" $dateafter 2>/dev/null |
|
fifo="/tmp/channel-videos-after-fifo$(date +%s%N)"
|
||||||
while read -r line && [ "$line" != "$last_watched_video" ]; do
|
mkfifo "$fifo"
|
||||||
|
|
||||||
|
youtube-dl --get-id "$channel" $dateafter 2>/dev/null > "$fifo" &
|
||||||
|
ytdlp="$!"
|
||||||
|
while read -r line && [ "$line" != "$last_watched_video" ]; do
|
||||||
echo "$line"
|
echo "$line"
|
||||||
done
|
done < "$fifo"
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
kill "$!"
|
||||||
|
|
||||||
# youtube-dl --get-id "$channel" | grep -B 4 "$last_watched_video" | tee /home/initega/test/test -a &
|
# youtube-dl --get-id "$channel" | grep -B 4 "$last_watched_video" | tee /home/initega/test/test -a &
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ command_pid="$!"
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
kill "$command_pid" 2>/dev/null
|
kill "$command_pid" 2>/dev/null
|
||||||
rm "$fifo"
|
rm "$fifo" 2>/dev/null
|
||||||
}
|
}
|
||||||
trap cleanup TERM INT PIPE
|
trap cleanup TERM INT PIPE
|
||||||
|
|
||||||
|
@ -54,5 +54,5 @@ while read -r line; do
|
||||||
echo "$line"
|
echo "$line"
|
||||||
done < "$fifo"
|
done < "$fifo"
|
||||||
|
|
||||||
rm "$fifo"
|
rm "$fifo" 2>/dev/null
|
||||||
kill "$checkpoint_pid" 2>/dev/null
|
kill "$checkpoint_pid" 2>/dev/null
|
||||||
|
|
16
wlvfs
16
wlvfs
|
@ -42,11 +42,11 @@ done
|
||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
scripts_folder="$(dirname "$(readlink -f "$0")")/scripts"
|
scripts_folder="$(dirname "$(readlink -f "$0")")/scripts"
|
||||||
videos_file="$HOME/.local/share/wlvfs_videos"
|
videos_file="${XDG_DATA_HOME:-$HOME/.local/share}/wlvfs_videos"
|
||||||
|
|
||||||
if [ -z "$subs_file" ]; then
|
if [ -z "$subs_file" ]; then
|
||||||
if [ -z "$YT_SUBS" ]; then
|
if [ -z "$YT_SUBS" ]; then
|
||||||
subs_file="$HOME/yt-subs"
|
subs_file="${XDG_CONFIG_HOME:-$HOME/.config}/yt-subs"
|
||||||
else
|
else
|
||||||
subs_file="$YT_SUBS"
|
subs_file="$YT_SUBS"
|
||||||
fi
|
fi
|
||||||
|
@ -181,10 +181,14 @@ fi
|
||||||
dateafter="$update_date"
|
dateafter="$update_date"
|
||||||
[ "$update_date" = "-" ] && dateafter=""
|
[ "$update_date" = "-" ] && dateafter=""
|
||||||
|
|
||||||
|
|
||||||
|
fifo="/tmp/wlvfs$(date +%s%N)"
|
||||||
|
mkfifo "$fifo"
|
||||||
|
|
||||||
|
sh "$scripts_folder/no-response-timeout.sh" -f 128 -r 10 \
|
||||||
sh "$scripts_folder/channel-videos-after.sh" \
|
sh "$scripts_folder/channel-videos-after.sh" \
|
||||||
"https://youtube.com/channel/$channel" "$last_video" "$dateafter" |
|
"https://youtube.com/channel/$channel" "$last_video" "$dateafter" | tee "$temp" > "$fifo" &
|
||||||
tee "$temp" |
|
while read -r video && [ -n "$video" ]; do
|
||||||
while read -r video; do
|
|
||||||
printf "\tFound video: %s\n" "$video"
|
printf "\tFound video: %s\n" "$video"
|
||||||
if [ ! -f "$videos_file" ]; then
|
if [ ! -f "$videos_file" ]; then
|
||||||
echo "ytdl://$video" >> "$videos_file"
|
echo "ytdl://$video" >> "$videos_file"
|
||||||
|
@ -200,7 +204,7 @@ fi
|
||||||
"$videos_file"
|
"$videos_file"
|
||||||
} &
|
} &
|
||||||
fi
|
fi
|
||||||
done
|
done < "$fifo"
|
||||||
new_last_video=$(head -n 1 "$temp")
|
new_last_video=$(head -n 1 "$temp")
|
||||||
if [ -z "$new_last_video" ]; then
|
if [ -z "$new_last_video" ]; then
|
||||||
new_last_video="$last_video"
|
new_last_video="$last_video"
|
||||||
|
|
Loading…
Reference in New Issue