Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.30 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: gmediarender
  5. # Required-Start: $remote_fs $syslog $all
  6. # Required-Stop: $remote_fs $syslog
  7. # Default-Start: 2 3 4 5
  8. # Default-Stop: 0 1 6
  9. # Short-Description: Start GMediaRender at boot time
  10. # Description: Start GMediaRender at boot time.
  11. ### END INIT INFO
  12.  
  13. # User and group the daemon will be running as. On the Raspberry Pi, let's use
  14. # the default user.
  15. DAEMON_USER="pi:audio"
  16.  
  17. # Device name as it will be advertised to and shown in the UPnP controller UI.
  18. # Some string that helps you recognize the player, e.g. "Livingroom Player"
  19. UPNP_DEVICE_NAME="raspberrypi"
  20.  
  21. # Initial volume in decibel. 0.0 is 'full volume', -10 correspondents to '75' on
  22. # the exported volume scale (Note, this does not change the ALSA volume, only
  23. # internal to gmrender. So make sure to leave the ALSA volume always to 100%).
  24. INITIAL_VOLUME_DB=-1
  25.  
  26. #Added BufferDuration
  27. BUFFER_DURATION=1
  28.  
  29. # If you explicitly choose a specific ALSA device here (find them with 'aplay -L'), then
  30. # gmediarenderer will use that ALSA device to play audio.
  31. # Otherwise, whatever default is configured for gstreamer for the '$DAEMON_USER' is
  32. # used.
  33. ALSA_DEVICE="sysdefault"
  34. #ALSA_DEVICE="iec958"
  35.  
  36. # Path to the gmediarender binary.
  37. BINARY_PATH=/usr/local/bin/gmediarender
  38.  
  39. if [ -n "$ALSA_DEVICE" ] ; then
  40.         GS_SINK_PARAM="--gstout-audiosink=alsasink"
  41.         GS_DEVICE_PARAM="--gstout-audiodevice=$ALSA_DEVICE"
  42. fi
  43.  
  44. # A simple stable UUID, based on this systems' first ethernet devices MAC address,
  45. # only using tools readily available to generate.
  46. UPNP_UUID=`ip link show | awk '/ether/ {print "salt:)-" $2}' | head -1 | md5sum | awk '{print $1}'`
  47.  
  48. USER=root
  49. HOME=/root
  50. export USER HOME
  51. case "$1" in
  52.         start)
  53.                 echo "Starting GMediaRender"
  54.                 start-stop-daemon -x $BINARY_PATH -c "$DAEMON_USER" -S -- -f "$UPNP_DEVICE_NAME" -d -u "$UPNP_UUID" $GS_SINK_PARAM $GS_DEVICE_PARAM --gstout-initial-volume-db=$INITIAL_VOLUME_DB --gstout-buffer-duration=$BUFFER_DURATION
  55.                 ;;
  56.  
  57.         stop)
  58.                 echo "Stopping GMediaRender"
  59.                 start-stop-daemon -x $BINARY_PATH -K
  60.                 ;;
  61.  
  62.         *)
  63.                 echo "Usage: /etc/init.d/gmediarender {start|stop}"
  64.                 exit 1
  65.                 ;;
  66. esac
  67.  
  68. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement