Trying to install mopidy on sailfishos

Hi,

I am trying to install mopidy on my sailfish phone (oneplus one using a community port).
I did (as root):
pip install -U mopidy
pip install -U gi
pip install -U Mopidy-MusicBox-Webclient

Also had to install pygobject2 and build python-gst myself. Now mopidy starts, musicbox works, I can browse the list from the somafm extension but when I try to play a stream I get a stack trace:

File “/usr/lib/python2.7/site-packages/mopidy/audio/scan.py”, line 84, in _setup_pipeline
src = Gst.Element.make_from_uri(Gst.URIType.SRC, uri)
TypeError: make_from_uri() takes exactly 3 arguments (2 given)

Can anybody point me in a direction to solve this?

If memory serves that’s when the pygst bindings are missing. I think I created a github issue about trying to better detect that error case but I can’t find it right now. If you can find it you may get some hints about where the files are expected to be.

Thanks for your response. I cannot find what you mean. Besides how can those bindings be missing when the trace shows Gst is there only the function is expected to be called differently. But I have to confess I know nothing of python.

I’m not saying it is that, but some gstreamer stuff is missing. Maybe the required elements are compile options and you didn’t specify them? I’m really just guessing.

Edit. Actually it take that back. I’m pretty sure it’s exactly what I said. The 3rd argument is optional, the overrides let you omit that argument when calling from python. Your install is broken.

Yes I am pretty sure the installation is broken. Not mopidy.

I followed your guess and now I suspect the pygobject2 package for sailfishos is for gstreamer-0.10 even though gstreamer-1.0 is used for the rest. Will try to build a newer version.

Newer version of pygobject (3.10.2 -> 3.15.91) makes mopidy work better.
Also needed to enable pulseaudio (#configure-pulseaudio).
Now I have to find out why I still do not get any sound.

mopidy sink was muted.

Hey ! How did you install pygobject 3.15.91 on sailfish ? I tried to compile it but it does’t find autoconf-archive. I tried to compile autoconf-archive but it fails with " rule to make target ax_prog_date.texi', needed byautoconf-archive.info’" (I tried both tar and git version, tar version doesn’t even do anything (Nothing to do for target all-am)

I have built it on OBS. See: https://api.merproject.org/package/show/home:wdehoog/pygobject2

Sorry but I do not remember much of what I did then to get things working.

Wow that worked ! Thank you very much, there even was a pre compiled RPM
That’s much easier that building it from scratch… I’m always having trouble building packages for Sailfish OS, I didn’t know about the OBS, can you access it directly from a package manager? I’ve tried osc but it seems I would need an account from the Mer Bugzilla, which is closed to new members…

Mopidy is such a great music server, I use ncmpcpp as my main music player on desktops, which I will be able to do on sailfish as well now !

Do you remember how you got the audio working with pulseaudio ? I set output = pulsesink client-name=mopidy in [audio] in mopidy.conf but it doesn’t seem to work.

for an OBS account mail the guy mentioned on the bugzilla page or ask on irc #mer, #sailfishos or #sailfishos-porters

I found some notes. I did:

mkdir mopidy/playlists

created /etc/pulse/xpolicy.conf.d/mopidy.conf with
[stream]
exe = mopidy
group = player

and uncommented load-module module-native-protocol-tcp and added auth-ip-acl=127.0.0.1
to the /etc/pulse/xxx.pa file
xxx differs by phone. mine was arm_msm8974_oneplus-bacon.pa

use ‘pacmd list-sink-inputs’ to see what sink-inputs are active
use ‘pacmd set-sink-input-mute 8 false’ to unmute one

hope this helps.

It works ! Thank you ! I missed the xpolicy file. My pa file was default.pa on Sailfish X and mopidy ended up using Sink 40. Also, mopidy needs to be launched as regular user, not as root or with service file, otherwise it fails with permission error (cannot launch neither mpd or http), if anybody sees this thread and faces the same issue.

However, the sink assigned to mopidy seems to be chosen randomly each time I change song, which is quite annoying. I’ll read pulseaudio’s doc to see if I can fix the sink for mopidy. For now I use a dirty workaround : r i in {1..30}; do echo $i;pacmd set-sink-input-mute $i false; done

It should be possible to start mopidy using a service file in /etc/systemd/user/ . Maybe something similar to https://github.com/kimmoli/gesture-daemon/blob/master/config/gestured.service.

This random input-sinks of mopidy are terrible. cutespot from openrepos also does that but it’s version from harbour does not so there is a solution but I have no idea what or how.