Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: REST API
#1
Music 
It would be great to have a REST API to control moOde remotely, and get status updates remotely, etc. This would open the possibility of plugins for things like Home Assistant.
Reply
#2
There are already ways to control moOde remotely and get status via http so it would be better to be more specific about what you want to accomplish instead of just saying make a REST API or a plugin for Home Assistant.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(11-02-2022, 10:25 AM)Tim Curtis Wrote: There are already ways to control moOde remotely and get status via http so it would be better to be more specific about what you want to accomplish instead of just saying make a REST API or a plugin for Home Assistant.

Hi Tim,

I would like to write a python script to control playback, get status of volume, get information about song or radio stream being played, etc.

When you write that there is already a way to control moOde remotely and get status via http, where do I look for documentation or examples?

I thought I may be able to start with something simple myself and tried doing this: 
curl http://moode/command/?cmd=status
and I get no return. I found a post where you mentioned un-commenting an echo $resp in /var/www/command/index.php , but looking at /var/www/command/index.php I don't see an echo $resp being commented out.

To be clear, I want to control moOde playback, not MPD.

Thanks

Edit: Or would you recommend that I direct attention to controlling MPD?
Reply
#4
It's in the Setup guide
https://github.com/moode-player/moode/bl.../setup.txt
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
(11-02-2022, 11:15 AM)Tim Curtis Wrote: It's in the Setup guide
https://github.com/moode-player/moode/bl.../setup.txt

Thanks for that Tim Smile  It has been a while since I've read the setup guide... years...   Big Grin

Had a quick look, and http://moode/command/?cmd=get_currentsong returns
[]
http://moode/command/playback.php?cmd=get_mpd_status returns
useful info that I can work with

I'll look around to see if I can find a way to do everything I am after.

Are the commands a work in progress as per Setup guide example not working, and needing an alternative url? Or do you think you think you'll keep them fairly constant?
Reply
#6
@gwurb

Go to m > Configure > System and turn on the metadata file local service.  Now you’ll get currentsong info via the API.

Regards,
Kent
Reply
#7
Thank you very much for this thread this helps a lot to get the info if the player is in play or stop mode!!
2 Solutions:
- http://moode/command/?cmd=get_currentsong
- http://moode/command/?cmd=get_mpd_status

After this i was able to connect a zigbee Button to "play" or "stop" sound .... and adjust the volume up and down.
Reply
#8
+1 For making this feature more visible, maybe a mention in the homepage feature list Smile
A few years ago I remember going for Volumio because it had a rest api and I couldn't find a way to interact programmatically with moOde.
Reply
#9
(02-18-2023, 08:19 PM)adam_zzz Wrote: +1 For making this feature more visible, maybe a mention in the homepage feature list Smile
A few years ago I remember going for Volumio because it had a rest api and I couldn't find a way to interact programmatically with moOde.

It's in the Setup Guide but I suppose that dev's don't read it ;-)

But not a bad idea to mention it in the Feature list and Developer page. I'll add to the TODO list.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#10
(11-02-2022, 10:38 AM)gwurb Wrote:
(11-02-2022, 10:25 AM)Tim Curtis Wrote: There are already ways to control moOde remotely and get status via http so it would be better to be more specific about what you want to accomplish instead of just saying make a REST API or a plugin for Home Assistant.

Hi Tim,

I would like to write a python script to control playback, get status of volume, get information about song or radio stream being played, etc.

When you write that there is already a way to control moOde remotely and get status via http, where do I look for documentation or examples?

I thought I may be able to start with something simple myself and tried doing this: 
curl http://moode/command/?cmd=status
and I get no return. I found a post where you mentioned un-commenting an echo $resp in /var/www/command/index.php , but looking at /var/www/command/index.php I don't see an echo $resp being commented out.

To be clear, I want to control moOde playback, not MPD.

Thanks

Edit: Or would you recommend that I direct attention to controlling MPD?


I would also recommend the MPD route. Moode has a very good integration with MPD and for Python, there already is a good module with MPD support (https://github.com/Mic92/python-mpd2). I used this in developing mpd2chromecast for casting playback to chromecast devices.

You will get the same results as using the moode API, but it will be a bit more generic and portable to other MPD-based solutions.
Reply


Forum Jump: