12

I love Banshee media player in general, and I already have an important library of music, which I've spent a lot of time organizing (labeling, correcting, etc).

I also use the command line a lot, so I wonder if there is a way I can control banshee from the command line. As in:

  • Next, Prev, Stop, Play, etc
  • In anyway query the Banshee database as if using the search box in the GUI

I was akin to program it myself if there isn't, but that would be another question :)

6 Answers 6

18

According to man banshee, it is possible to control playback. I'm not sure about searching though.

Here are a few of the controls that you mentioned. Check the man page for many more.

--next 
    Play the next track, optionally restarting if the 'restart' value is set

--previous 
    Play the previous track, optionally restarting if the 'restart value is set

--stop 
    Completely stop playback

--play 
    Start playback
4
  • Doh!, I guess need to RTFM!, thanks for pointing that out. There are plenty of options but looks like I can't query the database. the query-* commands are just for printing information on the stdout. :-/
    – tutuca
    Aug 6, 2010 at 21:45
  • 1
    Yeah, looks like the query arguments are only for getting info about the current track. Not quite what you're looking for. Aug 6, 2010 at 22:01
  • 1
    BTW, If this answer actually answers your question, please hit the checkmark beside it. Aug 9, 2010 at 23:30
  • 1
    banshee stores in a SQLite database. From there you could do queries.
    – hgoebl
    Jan 16, 2016 at 9:47
3
/usr/bin/banshee --next
/usr/bin/banshee --previous
/usr/bin/banshee --stop
/usr/bin/banshee --play

All those above can be used in XFCE for shortcuts on your keyboard, respectively for:

X86AudioNext
X86AudioPrev
X86AudioStop
X86AudioPlay
2

If you're looking to program an interface for Banshee (Other than just having the ability to send banshee --next or other control flag. Then you may be interested in the MPD - The Music Player Daemon which allows you to create your own interface or modify/use one of these Clients designed to work over MPD

1

There are quite a bit of commands you can use with banshee, it's been a ling time now, but here's a script I wrote because I could not find a way to play a smart playlist at login. It was months ago, it was one of my first scripts and I did it for fun so it's pretty bad, I haven't tried it since but this should at least give you an example of how usable is banshee on the terminal :

   #!/bin/bash
    banshee --hide &
    sleep 3;
    banshee --play;

    while true; do
        pos=`banshee --query-position| sed s/position:\ //| sed s/,.*//`;
        dur=`banshee --query-duration| sed s/duration:\ //| sed s/,.*//`;
        left="$(expr $dur - $pos)";

        rating=`banshee --query-rating|sed s/rating:\ //`;
        isHumour="$(banshee --query-uri|sed s/.*Music//|grep /Humour)";

      if [[ $pos -lt "3" ]] && ([[ $rating -lt "2" ]] || [[ -n "$isHumour" ]]);
      then
        echo "next";
        exec banshee --next &
      else
        echo "sleep for" $left;
        sleep "$left";
        pos=`banshee --query-position| sed s/position:\ //| sed s/,.*//`;
        dur=`banshee --query-duration| sed s/duration:\ //| sed s/,.*//`;
        left= expr $dur - $pos;
        echo $left;
    fi;
    sleep 0.0001;
    done;
    exit 0;

Hope it helps, sorry if it confuses you...

-1

I don't think there is a command-line interface to Banshee at this point. And I haven't heard anything to indicate that they would be working on one.

1
  • 1
    I think tutuca is just looking for a way to control Banshee from the command line; not a full-out command line interface (though that would be very cool). Aug 6, 2010 at 22:09
-1

Here is what everyone has been looking for:

sh -c "sleep 1m; banshee --hide & sleep 20; banshee --play"

the 1m stands for a timeout which you can change.

You need to put it in your start up applications

1
  • 1
    Can you explain how this allows what the OP was asking? Next, Prev, Stop, Play, Search database?
    – DrSAR
    Feb 25, 2013 at 5:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .