-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·40 lines (35 loc) · 1.16 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# base directory where all videos are stored
# this could be a USB drive, SD card or even a NAS
# videos will be sorted alphabetically
VIDEO_DIRECTORY='/mnt/mydisk/'
# list the file types you want played here. separated by pipes. not case sensitive
FILE_TYPES='mkv|mp4'
chk_video_dir()
{
[[ -f "${VIDEO_DIRECTORY}" ]] || echo ""${VIDEO_DIRECTORY}" does not exist"
}
get_playlist()
{
# get recursive list of files in video directory
playlist=$(find "${VIDEO_DIRECTORY}" -type f | sort -n)
# filter out the file types we dont want
playlist=$(echo "${playlist}" | grep -Ei "^.*\.($FILE_TYPES)$")
echo "${playlist}"
}
# start looping through the videos
while :
do
# check that our video directory still exists
chk_video_dir
# get new playlist after old has played
# this allows you do add new videos without stopping the service
playlist=$(get_playlist)
for video in $(echo "${playlist}")
do
echo "${video}"
# still playing with these settings but they seem to work for my TV
# you may have to adjust for your setup
omxplayer --display 5 -p -o hdmi --win "0 0 1920 1080" "${video}"
done
done