Advertisement
Guest User

omxplayer script

a guest
Apr 19th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Cambiar opcion local por hdmi si se quiere usar la salida de audio digital
  4. #OPT="-b -o local"
  5. OPT="-b --align center -o hdmi"
  6.  
  7. omx_local() {
  8.    #detectar subtitulos
  9.    sub="${1%%.*}.str"
  10.    if [ -f "$sub" ]
  11.    then
  12.       omxplayer ${OPT} --subtitles "$sub" "$1" #| clear
  13.    else
  14.       omxplayer ${OPT} "$1" #| clear
  15.    fi
  16. }
  17.  
  18. omx_remote() {
  19.    START_TIME=$SECONDS
  20.    omx_local "$1"
  21.    ELAPSED_TIME=$(($SECONDS - $START_TIME))
  22.    if [ "$ELAPSED_TIME" -lt 5 ]; then
  23.       if [[ "$1" =~ 'http' ]]; then
  24.          omxplayer ${OPT} $(youtube-dl -g "$1") #| clear
  25.       fi
  26.    fi
  27. }
  28.  
  29. for (( i=1;$i<=$#;i=$i+1 )) do
  30.    
  31.    if [ -d "${!i}" ]
  32.    then  
  33.       for FILE in `find ${!i} -name "*.mp4" -o -name ".avi" -o -name "*.mkv" -type f`
  34.       do
  35.          omx_local "$FILE"
  36.       done
  37.    else
  38.       if [ -f "${!i}" ]
  39.       then
  40.          if [[ "${!i}" =~ ".lst" ]]
  41.          then
  42.             for line in $(cat ${!i}); do
  43.                omx_remote  "$line"
  44.             done
  45.          else
  46.             omx_local "${!i}"
  47.          fi
  48.       else
  49.          omx_remote  "${!i}"
  50.       fi
  51.    fi
  52.  
  53. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement