Mopidy server for desktop users

The plan is, to run mopidy as service, and then be able to log in as whatever user, and control it from the web interface.

What works:

  • launching mopidy as a service at system boot time
  • connecting to the Iris interface
  • starting some music playback
  • test tone with: gst-launch-1.0 audiotestsrc ! audioresample ! pulsesink
  • test tone with: gst-launch-1.0 audiotestsrc ! audioresample ! alsasink

What doesn’t work:

  • sound output of any sort, not with the default autosink, nor with alsasink or pulsesink

Platform: an old MacBook Air running Kali Linux with Xfce4

Config: (output of mopidyctl config)

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume =
output = pulsesink
buffer_time =

[proxy]
scheme =
hostname =
port =
username =
password =

[iris]
enabled = true
country = NZ
locale = en_NZ
verify_certificates = true
snapcast_enabled = true
snapcast_host = localhost
snapcast_port = 1780
snapcast_ssl = false
snapcast_stream = Default
spotify_authorization_url = someURL
lastfm_authorization_url = someURL
genius_authorization_url = someURL
data_dir = $XDG_DATA_DIR/iris

[file]
enabled = true
media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.pdf
.png
.txt
.zip
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[http]
enabled = true
hostname = 127.0.0.1
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

[softwaremixer]
enabled = true

[stream]
enabled = true
protocols =
http
https
mms
rtmp
rtmps
rtsp
metadata_blacklist =
timeout = 5000

[alsamixer]
enabled = true
card = 0
control = Master
min_volume = 0
max_volume = 100
volume_scale = cubic

[beets]
enabled = true
hostname = 127.0.0.1
port = 8337

[internetarchive]
enabled = true
base_url = someURL
collections =
audio
etree
librivoxaudio
audio_bookspoetry
audio_tech
audio_music
audio_news
audio_foreign
audio_podcast
audio_religion
audio_formats =
VBR MP3
64Kbps MP3
image_formats =
JPEG
JPEG Thumb
browse_limit = 100
browse_views =
downloads desc|Views
titleSorter asc|Title
publicdate desc|Date Archived
date desc|Date Published
creatorSorter asc|Creator
search_limit = 20
search_order =
cache_size = 128
cache_ttl = 86400
retries = 3
timeout = 10

[local]
enabled = true
max_search_results = 100
media_dir = /var/lib/mopidy/media
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
included_file_extensions =
excluded_file_extensions =
.cue
.directory
.html
.jpeg
.jpg
.log
.nfo
.pdf
.png
.txt
.zip
directories =
Albums local:directory?type=album
Artists local:directory?type=artist
Composers local:directory?type=artist&role=composer
Genres local:directory?type=genre
Performers local:directory?type=artist&role=performer
Release Years local:directory?type=date&format=%25Y
Tracks local:directory?type=track
Last Week’s Updates local:directory?max-age=604800
Last Month’s Updates local:directory?max-age=2592000
timeout = 10
use_artist_sortname = false
album_art_files =
*.jpg
*.jpeg
*.png

[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
listall
listallinfo
default_playlist_scheme = m3u

[mpris]
enabled = true
bus_type = session

[podcast]
enabled = true
browse_root = Podcasts.opml
browse_order = desc
lookup_order = asc
cache_size = 64
cache_ttl = 86400
timeout = 10

[podcast-itunes]
enabled = true
base_url = someURL
country = US
explicit =
charts = audioPodcasts
charts_limit = 20
search_limit = 20
timeout = 10
retries = 3

[scrobbler]
enabled = false ; Extension disabled due to config errors.
username = ; Must be set.
password = ; Must be set.

[somafm]
enabled = true
encoding = mp3
quality = fast
dj_as_artist = true

[soundcloud]
enabled = false ; Extension disabled due to config errors.
explore_songs = 25
auth_token = ; Must be set.

[tunein]
enabled = true
timeout = 5000
filter =

[dleyna]
enabled = true
upnp_browse_limit = 500
upnp_lookup_limit = 20
upnp_search_limit = 100
dbus_start_session = dbus-daemon --fork --session --print-address=1 --print-pid=1

I strongly suspect, that this is a privilege issue, as e.g.
gst-launch-1.0 audiotestsrc ! audioresample ! alsasink
works in a terminal session of the logged in user, but not in a terminal session of another (e.g. root) user.

mopidy as service obviously runs as user mopidy, but equally obviously, I’m not logged in as mopidy, but some other user, so in a way, in a secure system, one would expect that mopidy can’t just pipe audio into any login session of any user.

So…
is there a way to

  • EITHER authenticate mopidy/iris to send audio directly to the hardware output
  • OR to authenticate mopidy/iris to send audio pulseaudio mixer of the the logged in user session
  • OR have audio sent to the browser running the iris control interface, and have the browser play back the audio within the current log in session

NB: I can’t post the unmodified config, because discourse complains about “more than URLs in a post”, so I replaced all URLs with “someURL”, but they are not something that should matter in this context, but in a different context, that limitation could be quite a nuissance…

Did you read the section in the docs about pulse and running as a service?

Also, I would expect there to be relevant log messages when you try and play a song.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.