Awesome
Mopidy
A Mopidy client library for Elixir.
Installation
Add mopidy to your list of dependencies in mix.exs
:
def deps do
[{:mopidy, "~> 0.3.0"}]
end
Ensure mopidy is started before your application:
def application do
[applications: [:mopidy]]
end
Within your application you will need to configure the Mopidy API URL. You do
not want to put this information in your config.exs
file! Either put it in a
{prod,dev,test}.secret.exs
file which is sourced by config.exs
, or read the
values in from the environment:
config :mopidy,
api_url: System.get_env("MOPIDY_API_URL")
Usage
The online documentation for the Mopidy HTTP API will give you a general idea of the modules and available functionality. Where possible the namespacing has been matched.
iex> {:ok, search_results} = Mopidy.Library.search(%{artist: "radiohead"}, ["spotify:"])
iex> search_results.artists
[%Mopidy.Artist{__model__: "Artist",
name: "Radiohead Tribute Band",
uri: "spotify:artist:0ADkBHZhR2cVfANgK5gHQO"},
%Mopidy.Artist{__model__: "Artist", name: "Radiohead",
uri: "spotify:artist:4Z8W4fKeB5YxbusRsdQVPb"}]
License
MIT License, see LICENSE for details.