Control mopidy by python code

Hi, how can I control mopidy by my python code? I would be grateful if someone give me full example with simply commend like stop music, next song.

You will have to use the api. There are a couple ways. One is to send RPC cmds to the websocket. The other is to build a custom frontend.

https://docs.mopidy.com/en/latest/api/

The easiest way is using the python mpd library. Their documentation has examples.

Maybe also take a look at https://github.com/ismailof/mopidy-json-client. Not sure how active it is or how far it progressed.

Hi! As @jcass77 says, you can use mopidy-json-client to control mopidy from python (it uses the websocket interface).

To install it run:
sudo pip install https://github.com/ismailof/mopidy-json-client/archive/master.zip

Sorry if there is a big lack of documentation. I’ll hopefully update it soon. A sample program would be something like:

from mopidy-json-client import MopidyClient

mopidy = MopidyClient()

mopidy.playback.play()

Available commands are all exposed by the websocket API (mopidy.core — Core API — Mopidy 3.4.2 documentation)