mrss.sh: do not delete video files until mpv successfully exits
This commit is contained in:
parent
61aa9344c1
commit
4eb30e0db3
@ -60,22 +60,35 @@ sub_link() {
|
|||||||
|
|
||||||
list_read() {
|
list_read() {
|
||||||
VID=""
|
VID=""
|
||||||
|
VIDFILES=""
|
||||||
|
|
||||||
while read -r art; do
|
while read -r art; do
|
||||||
LINK="$(sub_link "$art")"
|
LINK="$(sub_link "$art")"
|
||||||
if [ ! -z "$(printf "%s" "$LINK" | grep 'youtube.com\|odycdn\|simplecastaudio\|podcasts\|twitch')" ]; then
|
if [ ! -z "$(printf "%s" "$LINK" | grep 'youtube.com\|odycdn\|simplecastaudio\|podcasts\|twitch')" ]; then
|
||||||
VID="$VID$LINK "
|
VID="$VID$LINK "
|
||||||
|
if [ -n "$VIDFILES" ]; then
|
||||||
|
VIDFILES=$(printf "%s\n%s" "$VIDFILES" "$art")
|
||||||
|
else
|
||||||
|
VIDFILES="$art"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
xdg-open $LINK 2> /dev/null &
|
xdg-open $LINK 2> /dev/null &
|
||||||
fi
|
if [ -h "$art" ]; then
|
||||||
if [ -h "$art" ]; then
|
# remove symlinks from new/
|
||||||
# remove symlinks from new/
|
rm "$art"
|
||||||
rm "$art"
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$VID" ]; then
|
if [ -n "$VID" ]; then
|
||||||
mpv $VID 2> /dev/null &
|
if mpv $VID 2> /dev/null; then
|
||||||
|
printf "%s" "$VIDFILES" | xargs -d "\n" rm
|
||||||
|
else
|
||||||
|
printf "\n%s%s%s\n" \
|
||||||
|
$blue \
|
||||||
|
"mrss: Non-zero return code from mpv, not marking video files as read" \
|
||||||
|
$normal
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user