Soundnode / soundnode-app

Soundnode App is the Soundcloud for desktop. Built with Electron, Angular.js and Soundcloud API.
https://soundnode.github.io/soundnode-website/
Other
5.13k stars 641 forks source link

[FEATURE SUGGESTION] control soundone-app from console #685

Open xelite opened 8 years ago

xelite commented 8 years ago

I would like to control soundnode-app from linux console. Something like tihs:

./Soundnode-App --next-track
./Soundnode-App --status
./Soundnode-App --like-current-track
./Soundnode-App --add-to-playlist
jakejarrett commented 8 years ago

Once media key support is added to soundnode, You can actually do this relatively easy (somewhat, it wouldn't be via --option parameters)

Xbindkeys / XF86Audio

then setup some aliases like.

alias play="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.soundnode /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"

which would only require you to type play into your terminal.

There are other tools like playerctl, But i haven't personally tested these with mpris support yet.

ghost commented 8 years ago

@jakejarett and what about Windows?

jakejarrett commented 8 years ago

@wb9688 the original question was regarding Linux, There might be a way of setting up parameters for Soundnode, but i believe nwjs will execute the entire program instead of running in a daemon state/pass through commands without executing. I could be wrong.

xelite commented 8 years ago

@jakejarrett thanks for a tip. Maybe Soundnode should have API listening on lo interface? Then users on every platform could control/recive information from app by POST/GET via curl or something. I care about like and rewind songs.

curl -X POST http://127.0.0.1:31337  -d '{ "action": "rewind-back", value: "10%" }'
curl -X POST http://127.0.0.1:31337  -d '{ "action": "rewind-forward", value: "10s" }'
curl -X POST http://127.0.0.1:31337  -d '{ "action": "like-current-song", value: "true" }'
curl http://127.0.0.1:31337/status
xelite commented 8 years ago

@jakejarrett i don't see Soundnote in my dbus.

mdbus2 | grep -ci soundnode
0

Got newest version (0.6.2).

jakejarrett commented 8 years ago

@xelite try PR #645

xelite commented 8 years ago

@jakejarrett works but not all methods, Seek() do nothing, eg:

dbus-send --dest=org.mpris.MediaPlayer2.soundnode /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek int64:10000000 

...and can't get some properties or there are not true:

$ dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.soundnode /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Position'
method return time=1459341224.478248 sender=:1.1050820 -> destination=:1.1055076 serial=145 reply_serial=2
   variant       byte 0

$ dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.soundnode /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'
method return time=1459341211.757982 sender=:1.1050820 -> destination=:1.1055053 serial=144 reply_serial=2
   variant       array [
         dict entry(
            string "mpris:trackid"
            variant                string "/org/node/mediaplayer/soundnode/track/0"
         )
         dict entry(
            string "mpris:length"
            variant                string "0"
         )
         dict entry(
            string "mpris:artUrl"
            variant                string "https://i1.sndcdn.com/artworks-000153849394-ucxhte-large.jpg"
         )
         dict entry(
            string "xesam:title"
            variant                string "Coppa & Benny L - Panic (Samy Nicks Remix)(OUT NOW)"
         )
         dict entry(
            string "xesam:album"
            variant                string ""
         )
         dict entry(
            string "xesam:artist"
            variant                string "MC Coppa"
         )
      ]

Position is empty and mpris:length is always 0. Is the way to add "like" method or property to set?

jakejarrett commented 8 years ago

@xelite Those features were not added yet. There are other complications i have to fix before working on those (will cause npm to fail on windows/osx) Once those are fixed, i'll definitely finish the PR and add in position, length & other features.