Quark – a command line audio player for Linux – Bash script to add a directory to player

Animation showing Quark player's minimal interface.

I was writing a Nautilus Actions Configuration script for adding a directory to the playlist of Audacious (the Winamp clone for Linux).

Strangely, I forgot the name of the app. I did a search for command-line players but could not find it. Even cvlc was not listed. It was listed in the Ubuntu Software Manager. It is called Quark.

Quark calls itself as the anti-GUI player. It sits in the tray and you interact with it using a context menu from the tray – similar to Subhash VCDPlayer.

The GUI command for it is strange-quark. The CLI command is charm-quark.

Here is the script. You need to start the player with strange-quark.

charm-quark clear
for sFilename in $1/*
do
  sExtension="${sFilename##*.}"
  if [ $sExtension = "ogg" -o \
       $sExtension = "OGG" -o \
       $sExtension = "mp3" -o \
       $sExtension = "MP3" -o \
       $sExtension = "wav" -o \
       $sExtension = "WAV" -o \
       $sExtension = "wma" -o \
       $sExtension = "WMA" ] 
  then
    charm-quark append "$sFilename"
    echo "$sFilename" 
  fi    
done
charm-quark play

Here is another script to load a directory in Audacious2. There is some difficulty when reading pathnames with spaces. There are a few roundabout ways to do this. My solution is to just cd into the directory.

cd "$1"
for sFileName in *
do
  sExtension="${sFileName##*.}"
  if [ $sExtension = "ogg" -o \
       $sExtension = "OGG" -o \
       $sExtension = "mp3" -o \
       $sExtension = "MP3" -o \
       $sExtension = "wav" -o \
       $sExtension = "WAV" -o \
       $sExtension = "wma" -o \
       $sExtension = "WMA" ] 
  then
    audacious2 -E "$1/$sFileName" &
    #echo "$1/$sFileName" 
  fi
done
audacious2 -p &
Advertisements
This entry was posted in news. Bookmark the permalink.