NoPaste

One-Touch v0.1 Script

von Anonymous

SNIPPET_TEXT:
  1. #!/bin/bash
  2.  
  3. # One-Touch Version 0.1
  4. # Contact Homeless1: At this Time only over PM at debianforum.de Forum (You can write your Question in German or English)
  5.  
  6. # Copyright (C) 2008 Homeless1
  7. # This program is free software;
  8. # you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
  9. # either version 3 of the License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  12. # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. # See the GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along with this program;
  16. # if not, see <http://www.gnu.org/licenses/>.
  17.  
  18.  
  19. #########################################
  20. # Setting up Path to File one-touch.log and Playlist
  21.  
  22. CHECK_PATH=/home/user
  23. PLAYLIST_PATH=/home/user/playlists
  24.  
  25.  
  26. ############################
  27. # Check if File one-touch.log exists.
  28.  
  29.         if [ "$(cat $CHECK_PATH/one-touch.log)" = "" ]; then
  30.                 echo "Create Station Checklist"                                 # Debug Output
  31.                         echo "0" > $CHECK_PATH/one-touch.log
  32.                                 exit
  33.         fi
  34.  
  35.  
  36. ###################
  37. # Activate Station 0
  38.  
  39.         if [ "$(cat $CHECK_PATH/one-touch.log)" = "0" ]; then
  40.                 echo "Activate Station 0"                                       # Debug Output
  41.                         pls-handler.sh $PLAYLIST_PATH/station-0.pls
  42.                                 echo "1" > $CHECK_PATH/one-touch.log
  43.                                         sleep 2
  44.                                                 exit
  45.         fi
  46.  
  47.  
  48. ###################
  49. # Activate Station 1
  50.  
  51.         if [ "$(cat $CHECK_PATH/one-touch.log)" = "1" ]; then
  52.                 echo "Activate Station 1"                                       # Debug Output
  53.                         pls-handler.sh $PLAYLIST_PATH/station-1.pls
  54.                                 echo "2" > $CHECK_PATH/one-touch.log
  55.                                         sleep 2
  56.                                                 exit
  57.         fi
  58.  
  59.  
  60. ###################
  61. # Activate Station 2
  62.         if [ "$(cat $CHECK_PATH/one-touch.log)" = "2" ]; then
  63.                 echo "Activate Station 2"                                       # Debug Output
  64.                         pls-handler.sh $PLAYLIST_PATH/station-2.pls
  65.                                 echo "3" > $CHECK_PATH/one-touch.log
  66.                                         sleep 2
  67.                                                 exit
  68.         fi
  69.  
  70. ##############
  71. # Stop the MPD
  72.         if [ "$(cat $CHECK_PATH/one-touch.log)" = "3" ]; then
  73.                 echo "Stop the Mediaplayer Daemon"                                      # Debug Output
  74.                         mpc stop
  75.                                 echo "0" > $CHECK_PATH/one-touch.log
  76.                                         sleep 2
  77.                                                 exit
  78.         fi

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN