Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 :)

share|improve this question
add comment

6 Answers

up vote 17 down vote accepted

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
share|improve this answer
    
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 '10 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. –  mac9416 Aug 6 '10 at 22:01
1  
BTW, If this answer actually answers your question, please hit the checkmark beside it. –  mac9416 Aug 9 '10 at 23:30
add comment

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

share|improve this answer
add comment
/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
share|improve this answer
add comment

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...

share|improve this answer
add comment

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.

share|improve this answer
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). –  mac9416 Aug 6 '10 at 22:09
add comment

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

share|improve this answer
1  
Can you explain how this allows what the OP was asking? Next, Prev, Stop, Play, Search database? –  DrSAR Feb 25 '13 at 5:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.