Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Howto: StreamTuner2 + MPD

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Howto: StreamTuner2 + MPD

#1 Post by bester69 »

Image
subir imagenes




mpd-player.sh
-->>Toggle play/stop song by pressing Streamtuner "play button"<<--

Code: Select all

#!/bin/bash
#
MYHOST='192.168.1.128' # or your MPD host

touch ~/.mpd/flag
touch ~/.mpd/song
A=$(cat ~/.mpd/flag)
ANT=$(cat ~/.mpd/song)
mpc clearerror
killall  mpc &
killall  mpd &
killall  -9 mpc &
killall  -9 mpd &
mpd
mpd

#echo $1 > ~/fich.txt
case "$1" in
*m3u*) OPT="m3u" ;; # Para SurfMusci Tab
*pls*) OPT="m3u" ;; # Para Shoutcast tab
*  ) OPT="gener";;
esac
  
#Pinta la opción escogida  
#echo $OPT > ~/fich.txt;echo "$1" >> ~/fich.txt;echo "$2" >> ~/fich.txt
  
  
if [ "$A" = "1" ]
  then
  
 
 if [ "$OPT" = "m3u" ]
  then
    mpc -h $MYHOST load $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index
      
  else
    mpc -h $MYHOST add $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index 
  fi
  
   
  ACT=$(mpc -h $MYHOST current)
  mpc -h $MYHOST stop
  if [ "$ACT" = "$ANT" ]
    then
      echo "0" > ~/.mpd/flag
      mpc stop   
     
     else
   
 
  
 if [ "$OPT" = "m3u" ]
  then
    mpc -h $MYHOST load $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index
   
      
  else
    mpc -h $MYHOST add $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index 
   
  fi

   mpc -h $MYHOST current >  ~/.mpd/song
    echo "1" > ~/.mpd/flag
     
    fi
     else
     
if [ "$OPT" = "m3u" ]
  then
    mpc -h $MYHOST load $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index
   
      
  else
    mpc -h $MYHOST add $1
    index=$(mpc -h $MYHOST playlist|wc -l)
    mpc -h $MYHOST play $index 
   
  fi
  
  mpc -h $MYHOST current >  ~/.mpd/song
   echo "1" > ~/.mpd/flag

fi



bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply