Thank you for your donation!


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


[HOW-TO] Spotify Connect Web for Moode
#61
If all else is good, rewriting the spotify-connect.sh script should not require a fresh install. The script is running the main program with wrong parameters. So, no, don't start with the fresh install just yet.

To avoid the loud noise, simply avoid the speaker test. That is, don't run the line:
$ speaker-test -Dsoftvol -c2
Reply
#62
Hi Rafa,

I followed the directions you provided but it seems like spotify-connect-web.service never activates.

And I never see 'Moode Connect' show up as a option in Spotify.

Ran the sound test and it works fine.

Can you take a look and see if I am missing something?

Thanks in advance

pi@moode:~ $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
   Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) since Mon 2018-05-21 21:36:49 PDT; 7s ago
  Process: 2373 ExecStart=/home/pi/spotify/spotify-connect.sh (code=exited, status=0/SUCCESS)
 Main PID: 2373 (code=exited, status=0/SUCCESS)


spotify-connect.sh content

#!/bin/sh

cd /
cd home/pi/spotify/spotify-connect-web
LD_LIBRARY_PATH=/home/pi/spotify/spotify-connect-web python main.py --playback_device softvol -m Master --mixer_device_index 1 --bitrate 320 --name "moOde Connect" --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key
cd /



asound.conf

cm.softvol {
  type softvol
  slave {
    pcm "hw:0"
  }
  control {
    name "Master"
    card 0
  }
}
Reply
#63
I wish people would report back what has worked for them so we can have this figured out sooner rather than later. All seems good, perhaps setting the --mixer_device_index to 0?

What is the result of
$ aplay -L
$ aplay -l

Also, have you tried running the script directly and see what it outputs?
$ cd /home/pi/spotify/
$ ./spotify-connect.sh

It's really hard to remote troubleshoot this, so if someone has ideas on how to debug this, I'm all ears!

Best regards,
Rafa.
Reply
#64
(05-19-2018, 02:38 PM)RafaPolit Wrote: Miklau, there is a missing space after "SpotifyMaster" in my pasted code, please add the space after the word before the --

Thanks again and good point regarding the missing space. I changed that but still not solved the problem. I checked again that the name SpotifyMaster is spelled correctly and it is both places. 
I tryed to change the mixer_device_ index to 1, rebooted, but still the same problem.
asound.conf
Code:
pcm.softvol {
 type softvol
 slave {
   pcm "hw:0"
 }
 control {
   name "SpotifyMaster"
   card 0
 }
}

spotify-connect.sh
Code:
#!/bin/sh

cd /
cd home/pi/spotify/spotify-connect-web
LD_LIBRARY_PATH=/home/pi/spotify/spotify-connect-web python main.py --playback_device softvol -m SpotifyMaster --mixer_device_index 0 --bitrate 320 --name "moOde Connect" --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key
cd /
And the error code:
Code:
Last login: Tue May 22 09:15:14 2018 from 192.168.1.4
pi@moode:~ $ cd /etc
pi@moode:/etc $ sudo systemctl start avahi-spotify-connect-multiuser.service
pi@moode:/etc $ sudo systemctl start spotify-connect-web.service
pi@moode:/etc $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
  Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; enabled; vendor preset: enabled)
  Active: activating (auto-restart) (Result: exit-code) since Tue 2018-05-22 10:08:42 CEST; 5s ago
 Process: 4558 ExecStart=/home/pi/spotify/spotify-connect.sh (code=exited, status=203/EXEC)
Main PID: 4558 (code=exited, status=203/EXEC)

May 22 10:08:42 moode systemd[1]: spotify-connect-web.service: Failed with result 'exit-code'.
pi@moode:/etc $ cd
pi@moode:~ $ sudo nano spotify-connect.sh
pi@moode:~ $ cd /etc
pi@moode:/etc $ sudo nano asound.conf
pi@moode:/etc $ cd
pi@moode:~ $ sudo nano spotify-connect.sh
pi@moode:~ $ cd /etc
pi@moode:/etc $ cd
pi@moode:~ $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
  Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; enabled; vendor preset: enabled)
  Active: activating (auto-restart) (Result: exit-code) since Tue 2018-05-22 10:13:08 CEST; 9s ago
 Process: 8208 ExecStart=/home/pi/spotify/spotify-connect.sh (code=exited, status=203/EXEC)
Main PID: 8208 (code=exited, status=203/EXEC)

May 22 10:13:08 moode systemd[1]: spotify-connect-web.service: Unit entered failed state.
May 22 10:13:08 moode systemd[1]: spotify-connect-web.service: Failed with result 'exit-code'.
pi@moode:~ $
I am not sure if i am not doing this correctly.

Thanks again  Smile
Reply
#65
(05-22-2018, 05:55 AM)RafaPolit Wrote: I wish people would report back what has worked for them so we can have this figured out sooner rather than later.  All seems good, perhaps setting the --mixer_device_index to 0?

What is the result of
$ aplay -L
$ aplay -l

Also, have you tried running the script directly and see what it outputs?
$ cd /home/pi/spotify/
$ ./spotify-connect.sh

It's really hard to remote troubleshoot this, so if someone has ideas on how to debug this, I'm all ears!

Best regards,
Rafa.

Hi Rafa,

Thank you for you help on this.

it looks like I am missing a module called wsgi, see below.





aplay -L output:


null
    Discard all samples (playback) or generate zero samples (capture)
btaplay_dmix
alsaequal
plug_alsaequal
btstream
crossfeed
plug_bs2b
eqfa4p
plug_eqfa4p
softvol
default:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplus,
    Default Audio Device
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dacplus,
    Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus,
    Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus,
    Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus,
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dacplus,
    Hardware device with all software conversions

aplay -l output:

pi@moode:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

 Message after running spotify-connect.sh: 

pi@moode:~/spotify $ ./spotify-connect.sh
Traceback (most recent call last):
  File "main.py", line 12, in <module>
    from gevent.wsgi import WSGIServer
ImportError: No module named wsgi
Reply
#66
(05-22-2018, 10:03 PM)Platheo Wrote:
(05-22-2018, 05:55 AM)RafaPolit Wrote: I wish people would report back what has worked for them so we can have this figured out sooner rather than later.  All seems good, perhaps setting the --mixer_device_index to 0?

Hi Rafa,  

I was able to get spotify-connect-web.service to activate by changing --mixer_device_index to 2; 0 did not work.

However, i still don't see it Moode Connect show up in Spotify as an option.

Code:
pi@moode:~ $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
  Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; disabled; vendor preset: enabled)
  Active: active (running) since Tue 2018-05-22 16:05:38 PDT; 207ms ago
Main PID: 2198 (spotify-connect)
  CGroup: /system.slice/spotify-connect-web.service
          ├─2198 /bin/sh /home/pi/spotify/spotify-connect.sh
          └─2199 python main.py --playback_device softvol -m Master --mixer_device_index 2 --bitrate 320 --name mo

May 22 16:05:38 moode systemd[1]: Started spotify-connect-web.service.

Here is my spotify-connect.sh contents:
Code:
#!/bin/sh

cd /
cd home/pi/spotify/spotify-connect-web
LD_LIBRARY_PATH=/home/pi/spotify/spotify-connect-web python main.py --playback_device softvol -m Master --mixer_device_index 2 --bitrate 320 --name "moOde Connect" --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key
cd /
Reply
#67
(05-22-2018, 11:11 PM)Platheo Wrote:
(05-22-2018, 10:03 PM)Platheo Wrote:
(05-22-2018, 05:55 AM)RafaPolit Wrote: I wish people would report back what has worked for them so we can have this figured out sooner rather than later.  All seems good, perhaps setting the --mixer_device_index to 0?

Hi Rafa,  

I was able to get spotify-connect-web.service to activate by changing --mixer_device_index to 2; 0 did not work.

However, i still don't see it Moode Connect show up in Spotify as an option.

Code:
pi@moode:~ $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
  Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; disabled; vendor preset: enabled)
  Active: active (running) since Tue 2018-05-22 16:05:38 PDT; 207ms ago
Main PID: 2198 (spotify-connect)
  CGroup: /system.slice/spotify-connect-web.service
          ├─2198 /bin/sh /home/pi/spotify/spotify-connect.sh
          └─2199 python main.py --playback_device softvol -m Master --mixer_device_index 2 --bitrate 320 --name mo

May 22 16:05:38 moode systemd[1]: Started spotify-connect-web.service.

Here is my spotify-connect.sh contents:
Code:
#!/bin/sh

cd /
cd home/pi/spotify/spotify-connect-web
LD_LIBRARY_PATH=/home/pi/spotify/spotify-connect-web python main.py --playback_device softvol -m Master --mixer_device_index 2 --bitrate 320 --name "moOde Connect" --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key
cd /

I was able to resolve the issue with wsgi module missing by changing gevent.wsgi to gevent.pywsgi in main.py.

Now, i'm able to get spotify-connect-web.service to become active and not restart constantly.  Also, Moode Connect is visible in Spotify now.

Everything works now!!

#!/usr/bin/env python
#First run the command avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf
#TODO: Add error checking
#TODO: Show when request fails on webpage
import os
import sys
import argparse
import re
from flask import Flask, request, abort, jsonify, render_template, redirect, flash, url_for
from flask_bootstrap import Bootstrap
from flask_cors import CORS
from gevent.pywsgi import WSGIServer
from gevent import spawn_later, sleep
from connect_ffi import ffi, lib
from connect import Connect
from utils import get_zeroconf_vars, get_metadata, get_image_url
Reply
#68
(05-22-2018, 08:15 AM)miklau Wrote: I am not sure if i am not doing this correctly.

Thanks again  Smile
I think you are. It's not that easy, and if you are not familiar with the OS, it even harder.

Let's try the same approach of not running the service, but the script and see if we get to the bottom of this. Run the script:
$ cd /home/pi/spotify
$ ./spotify-connect.sh

What does that output?
Reply
#69
Glad you worked it out Platheo, hopefully someone will use that to solve their issues. Thanks for sharing your process.
Reply
#70
(05-23-2018, 05:23 AM)RafaPolit Wrote:
(05-22-2018, 08:15 AM)miklau Wrote: I am not sure if i am not doing this correctly.

Thanks again  Smile
I think you are. It's not that easy, and if you are not familiar with the OS, it even harder.

Let's try the same approach of not running the service, but the script and see if we get to the bottom of this.  Run the script:
$ cd /home/pi/spotify
$ ./spotify-connect.sh

What does that output?
Thanks again

Well that does output something very strange:

Code:
pi@moode:~ $ cd /home/pi/spotify
pi@moode:~/spotify $ ./spotify-connect.sh
-bash: ./spotify-connect.sh: No such file or directory
pi@moode:~/spotify $

I will try to reinstall the whole thing and make sure that the spotify-connect.sh file is at the correct folder, unless you have any other good ideas ? Smile
Reply


Forum Jump: