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"
|
||||
|
||||
sh "$scripts_folder/no-response-timeout.sh" -f 128 -r 10 \
|
||||
youtube-dl --get-id "$channel" $dateafter 2>/dev/null |
|
||||
while read -r line && [ "$line" != "$last_watched_video" ]; do
|
||||
|
||||
fifo="/tmp/channel-videos-after-fifo$(date +%s%N)"
|
||||
mkfifo "$fifo"
|
||||
|
||||
youtube-dl --get-id "$channel" $dateafter 2>/dev/null > "$fifo" &
|
||||
ytdlp="$!"
|
||||
while read -r line && [ "$line" != "$last_watched_video" ]; do
|
||||
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 &
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ command_pid="$!"
|
|||
|
||||
cleanup() {
|
||||
kill "$command_pid" 2>/dev/null
|
||||
rm "$fifo"
|
||||
rm "$fifo" 2>/dev/null
|
||||
}
|
||||
trap cleanup TERM INT PIPE
|
||||
|
||||
|
@ -54,5 +54,5 @@ while read -r line; do
|
|||
echo "$line"
|
||||
done < "$fifo"
|
||||
|
||||
rm "$fifo"
|
||||
rm "$fifo" 2>/dev/null
|
||||
kill "$checkpoint_pid" 2>/dev/null
|
||||
|
|
16
wlvfs
16
wlvfs
|
@ -42,11 +42,11 @@ done
|
|||
shift $((OPTIND-1))
|
||||
|
||||
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 "$YT_SUBS" ]; then
|
||||
subs_file="$HOME/yt-subs"
|
||||
subs_file="${XDG_CONFIG_HOME:-$HOME/.config}/yt-subs"
|
||||
else
|
||||
subs_file="$YT_SUBS"
|
||||
fi
|
||||
|
@ -181,10 +181,14 @@ fi
|
|||
dateafter="$update_date"
|
||||
[ "$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" \
|
||||
"https://youtube.com/channel/$channel" "$last_video" "$dateafter" |
|
||||
tee "$temp" |
|
||||
while read -r video; do
|
||||
"https://youtube.com/channel/$channel" "$last_video" "$dateafter" | tee "$temp" > "$fifo" &
|
||||
while read -r video && [ -n "$video" ]; do
|
||||
printf "\tFound video: %s\n" "$video"
|
||||
if [ ! -f "$videos_file" ]; then
|
||||
echo "ytdl://$video" >> "$videos_file"
|
||||
|
@ -200,7 +204,7 @@ fi
|
|||
"$videos_file"
|
||||
} &
|
||||
fi
|
||||
done
|
||||
done < "$fifo"
|
||||
new_last_video=$(head -n 1 "$temp")
|
||||
if [ -z "$new_last_video" ]; then
|
||||
new_last_video="$last_video"
|
||||
|
|
Loading…
Reference in New Issue