commit
77a4c2c313
14
README.rst
14
README.rst
|
@ -61,20 +61,26 @@ Prepare Raspberry Pi
|
|||
--------------------
|
||||
|
||||
Before you can install and use Mopidy Pummeluff, you need to configure your Raspberry Pi.
|
||||
Just follow these steps:
|
||||
|
||||
We want to enable the ``SPI`` interface and give the ``mopidy`` user access to it. This is required for the communication to the RFID module. Enter this command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo raspi-config
|
||||
|
||||
In the configuraton utility, **Enable the SPI** under ``5 Interfacing Options – P4 SPI``.
|
||||
In the configuraton utility, **Enable the SPI** under ``5 Interfacing Options – P4 SPI``.
|
||||
|
||||
After that, add your ``mopidy`` user to the ``spi`` group and reboot the RPi:
|
||||
After that, add your ``mopidy`` user to the ``spi`` and ``gpio`` group:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo usermod -a -G spi,gpio mopidy
|
||||
sudo reboot
|
||||
|
||||
If you're planning to use a card to shutdown the system, you also need to create a sudo rule, so that the ``mopidy`` user can shutdown the system without a password prompt:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
echo "mopidy ALL = NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/mopidy
|
||||
|
||||
Install via pip
|
||||
---------------
|
||||
|
|
|
@ -7,12 +7,14 @@ from __future__ import absolute_import, unicode_literals, print_function
|
|||
|
||||
__all__ = (
|
||||
'Card',
|
||||
'VolumeCard',
|
||||
'TracklistCard',
|
||||
'VolumeCard',
|
||||
'PauseCard',
|
||||
'StopCard',
|
||||
'ShutdownCard',
|
||||
)
|
||||
|
||||
from os import system
|
||||
from logging import getLogger
|
||||
|
||||
from .registry import REGISTRY
|
||||
|
@ -228,21 +230,6 @@ class VolumeCard(Card):
|
|||
LOGGER.error(str(ex))
|
||||
|
||||
|
||||
class StopCard(Card):
|
||||
'''
|
||||
Stops the playback.
|
||||
'''
|
||||
|
||||
def action(self, mopidy_core): # pylint: disable=no-self-use
|
||||
'''
|
||||
Stop playback.
|
||||
|
||||
:param mopidy.core.Core mopidy_core: The mopidy core instance
|
||||
'''
|
||||
LOGGER.info('Stopping playback')
|
||||
mopidy_core.playback.stop()
|
||||
|
||||
|
||||
class PauseCard(Card):
|
||||
'''
|
||||
Pauses or resumes the playback, based on the current state.
|
||||
|
@ -262,3 +249,33 @@ class PauseCard(Card):
|
|||
else:
|
||||
LOGGER.info('Resuming the playback')
|
||||
playback.resume()
|
||||
|
||||
|
||||
class StopCard(Card):
|
||||
'''
|
||||
Stops the playback.
|
||||
'''
|
||||
|
||||
def action(self, mopidy_core): # pylint: disable=no-self-use
|
||||
'''
|
||||
Stop playback.
|
||||
|
||||
:param mopidy.core.Core mopidy_core: The mopidy core instance
|
||||
'''
|
||||
LOGGER.info('Stopping playback')
|
||||
mopidy_core.playback.stop()
|
||||
|
||||
|
||||
class ShutdownCard(Card):
|
||||
'''
|
||||
Shutting down the system.
|
||||
'''
|
||||
|
||||
def action(self, mopidy_core): # pylint: disable=no-self-use,unused-argument
|
||||
'''
|
||||
Shutdown.
|
||||
|
||||
:param mopidy.core.Core mopidy_core: The mopidy core instance
|
||||
'''
|
||||
LOGGER.info('Shutting down')
|
||||
system('sudo /sbin/shutdown -h now')
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[Unit]
|
||||
Description=Mopidy
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=mopidy
|
||||
ExecStart=/opt/mopidy/mopidy/bin/mopidy --conf /etc/mopidy/mopidy.conf
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in a new issue