Sample Header Ad - 728x90

Playing random videos on one's system; minor improvement to include DVDs

2 votes
1 answer
100 views
In my .bashrc I have a function which I use to play random videos (not written below, just fyi), and another one for all media files, e.g.: createmediafiles() { find ~+ -type f -iregex '.*\.\(mp3\|wav\|ogg\|flac\|mp4\|mov\|avi\)' > ~/mediafiles.txt find ~+ -type d -name VIDEO_TS >> ~+/mediafiles.txt } playmediafiles() { while true; do while read -r line; do shuf -n 1 | tee -a ~/played-log.txt | xargs -d "\n" mpv done < ~/mediafiles.txt done } I want to add the VIDEO_TS line to createmediafiles, but in the playmediafiles function I want to add an IF statement, such that if the line shuffled to in mediafiles.txt is a VIDEO_TS then rather than using mpv to play a file, it will do: tee -a ~/played-log.txt | xargs -d "\n" vlc --fullscreen Piping in mediafiles.txt read the same way as it does with mpv. How do I throw that in an IF statement with the condition being that the line ends in VIDEO_TS?
Asked by 1toneboy (465 rep)
Mar 26, 2024, 09:38 AM
Last activity: Mar 28, 2024, 10:04 AM