View Single Post
Posts: 875 | Thanked: 918 times | Joined on Sep 2010
#457
Originally Posted by Addison View Post
I think -1c is correct.

The reason it wasn't playing the most recent video was because 30 seconds wasn't long enough of a delay for the video to begin downloading.
The -c flag sorts by ctime and -t sort by mtime, if a new file is created both should return it at the top (head -1). Maybe try the following code, it grabs the newest file prior to download and then compares it with the current newest file until it changes. Once it detects the downloading file it sleeps for 30 seconds to let it download some and then begins playing.

Code:
cd /media/mmc1/Videos
FILE=`/bin/ls -1t |head -1`
youtube-dl-x --no-part -f 5 -o "%(stitle)s.%(ext)s" `xclip -out` &
sleep 5
while [ "$FILE" = "`/bin/ls -1t |head -1`" ]; do sleep 5 ; done
sleep 30
mplayer `/bin/ls -1t |head -1`
 

The Following User Says Thank You to auouymous For This Useful Post: