Play from the oldest file first with omxplayer

CatOnRug solve, automate, speed up Play from the oldest file first with omxplayer
youtube-dl utility is so brilliant.
It evens set modify time for file exactly the same when the video has actually uploaded to YouTube :)

Now I have interest to generete some playlist sequences.

Here is some of them.

Play smallest files at first. This is great way how to find [skit] videos you will want to delete:
ls -Sr1
Play the bigest files at first. Sometimes I want to delete these video cause it takes a lot of space:
ls -S1
Play the oldes files at first. Live the story
youtube-dl https://www.youtube.com/channel/UCAL3JXZSzSm8AlZyD3nQdBA/videos
ls -tr1 > play.lst
Play the latest files first:
ls -t1
For example this is my sample program to play from the oldest file first:
sudo vi /usr/bin/livethestory
Enter content:
#!/bin/sh

#take the oldest files first
printf %s "`ls -tr1 | head -4`" | while IFS= read -r file
do {

#execute omxplayer instance in new terminal window
#this is quite the only way to enable omxplayer controls
lxterminal -e omxplayer -r "$file"

#just to make sure the omxplayer has time to execute
sleep 1

#do not let go to the next file unless there is some omxinstance running
while ps aux | grep [o]mxplayer
do
sleep 1
done

} done
Set the file executable:
sudo chmod 755 /usr/bin/livethestory
Every time I want to start watch from the oldest videos first I open the directory and press F4:

Now I execute command:
livethestory

No comments:

Post a Comment