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
#!/bin/bash

[ -e /usr/bin/omxplayer.bin ] && OMXPLAYER="/usr/bin/omxplayer.bin" || exit 255

FNTOPT=
if [ -e /usr/share/fonts/TTF/FreeSans.ttf ]; then
  FNTOPT=$FNTOPT" --font /usr/share/fonts/TTF/FreeSans.ttf"
fi

if [ -e /usr/share/fonts/TTF/FreeSansOblique.ttf ]; then
  FNTOPT=$FNTOPT" --italic-font /usr/share/fonts/TTF/FreeSansOblique.ttf"
fi

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
  eval $(dbus-launch --sh-syntax)
  OMX_DBUS="started"
fi

if [ $# = 0 ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
  $OMXPLAYER --help
else
  clear
  $OMXPLAYER$FNTOPT "$@" #>/dev/null 2>&1
fi

if [ -n "$OMX_DBUS" ]; then
  kill $DBUS_SESSION_BUS_PID
  OMX_DBUS=
fi