Wikia

Music Player Daemon Community Wiki

Hack:Jump to file from console

525pages on
this wiki
Talk0

This is a hack bashmp and it requires mpc to work, it allows you to jump to a file from the console based on regexp to find the song you are looking for:

#!/bin/bash

function sJump () {
  if [ -z = $1 ]; then
    echo "Missing parameters"
    echo "Usage: sJump <autor> <song-title>"
    echo "You may use regexp on both parameters"
    echo "To list all artist's song use ? en <song-title>"
  elif [ -z = $2 ]; then
    echo "Missing parameters"
    echo "Usage: sJump <autor> <song-title>"
    echo "You may use regexp on both parameters"
    echo "To list all artist's song use ? en <song-title>"
  else
    SONGS=`mpc playlist | egrep -i $1 | egrep -i $2 | awk '1 {print $1-1+1}'`
    cont=1;
    for foo in $SONGS
    do
      let cont=$cont+1
    done
    if [ $cont -lt 2 ]; then
      mpc play $SONG --no-status
    else
      SONGS=`mpc playlist | egrep -i $1 | egrep -i $2`
      echo -e "$SONGS"
      echo -n "Ingrese el numero de  la canción a la que desea saltar :: "
      read -e wSong
      mpc play $wSong --no-status
    fi
  fi
}

Add this to your .bashrc

Around Wikia's network

Random Wiki