Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
PinfiniTV/run.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
40 lines (35 sloc)
1.16 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |