FCR001 / cantata

Automatically exported from code.google.com/p/cantata
GNU General Public License v3.0
0 stars 0 forks source link

Request: pass collection/server as argument #634

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of Cantata?
trunk

It would be very handy to be able to pass the collection or server name as an 
argument to Cantata, e.g. "cantata localhost" or "cantata 192.168.0.10".

Original issue reported on code.google.com by alphadel...@gmail.com on 25 Feb 2015 at 4:43

GoogleCodeExporter commented 9 years ago
Not sure I really see the use case for this. Cantata is a graphical client, as 
such commandline switching of collections seems a little out-of scope.

Original comment by craig.p....@gmail.com on 25 Feb 2015 at 4:11

GoogleCodeExporter commented 9 years ago
Well, it would let me do things like make panel launchers or global keyboard 
shortcut launchers in KDE to run a script that kills Cantata if it's already 
running and starts it with a certain server as an argument.  Then I could 
switch between MPD servers with a single click or keyboard shortcut.

Original comment by alphadel...@gmail.com on 25 Feb 2015 at 4:23

GoogleCodeExporter commented 9 years ago
But, perhaps extending the dbus interface to change collections would be 
better? Therefore, no need to kill Cantata. i.e. a script could check if its 
running, if not start it, then send a signal via qdbus to change the collection?

Original comment by craig.p....@gmail.com on 25 Feb 2015 at 6:03

GoogleCodeExporter commented 9 years ago
That would be handy too.  One way that would be more difficult to use is if 
Cantata weren't already running, in which case you have to start it, then loop 
while waiting for its dbus interface to come up, which is sort of messy in a 
script.

It's also more complex to do something like "qdbus com.googlecode.cantata 
/cantata com.googlecode.cantata.collection localhost" than simply "cantata -c 
localhost".  But it would let you control a running instance more easily, I 
guess.  

Although, for example, Clementine can control a running instance from a 
separate process, e.g. if it's already running, you can run "clementine 
--play-pause" and it will play or pause the running instance.  I haven't looked 
at the code, so I don't know how it accomplishes that.

Anyway, this isn't a big deal, and I'd be glad either way.  :)

Original comment by alphadel...@gmail.com on 25 Feb 2015 at 6:09

GoogleCodeExporter commented 9 years ago
I've added the dbus interface change to trunk.

Cantata also includes a script like Clementine's - see 
/usr/share/cantata/scripts/cantata-remote  This is used for Unity (to add 
play/pause/etc actions to the launcher)

The DBUS method is more flexible, and will allow you to accomplish what you 
want. Currently Cantata has no real commandline parsing - whilst this is 
trivial with the KDE version, its a little more complicated (but not much) with 
Qt only. As the DBUS allows you to do what is requested, I'm closing this for 
now.

Original comment by craig.p....@gmail.com on 25 Feb 2015 at 6:31

GoogleCodeExporter commented 9 years ago
Thanks.  :)

I wasn't aware of that script.  Should it be in /usr/bin also?  BTW, I think I 
found a small bug in it:

$ /usr/share/cantata/scripts/cantata-remote PlaybackStatus
Path 'com.googlecode.cantata' is not a valid path name.

In the script, in the qdbus section, it has this:

service=com.googlecode.cantata
...
    $qt $service com.googlecode.cantata /org/mpris/MediaPlayer2 $1 > /dev/null

Which results in "com.googlecode.cantata" being passed to qdbus twice.

Original comment by alphadel...@gmail.com on 25 Feb 2015 at 8:28

GoogleCodeExporter commented 9 years ago
Oops! script fixed now. And no, it should not be in /usr/bin as its only 
intended to be called via the launcher actions in Unity.

Original comment by craig.p....@gmail.com on 26 Feb 2015 at 11:10