From 620ef6e1ce010a5693b90fc8fab1669752ea944d Mon Sep 17 00:00:00 2001 From: jess <jess@jward.io> Date: Thu, 13 Sep 2018 21:03:21 +0000 Subject: [PATCH] Changes to get service working: add dependencies and entry point in setup Moved snap and main file to darkmute directory and created init/main files --- README.md | 7 +++++-- darkmute/__init__.py | 1 + darkmute/__main__.py | 4 ++++ darkmute.py => darkmute/dark_mute.py | 2 +- snap.py => darkmute/snap.py | 0 setup.py | 9 ++++++--- 6 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 darkmute/__init__.py create mode 100644 darkmute/__main__.py rename darkmute.py => darkmute/dark_mute.py (97%) rename snap.py => darkmute/snap.py (100%) diff --git a/README.md b/README.md index 4ca9615..c080d37 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,11 @@ connected to a Raspberry Pi running Snapcast. # Setup/Usage -* `sudo pip install DarkMute` -* `darkmute.py` +As the `pi` user in its home directory: + +* `python3 -m venv darkmute-venv` +* `. darkmute-venv/bin/activate` +* `sudo python3 -m pip install DarkMute` To run this as a service, create a systemd service definition. Instructions pending. diff --git a/darkmute/__init__.py b/darkmute/__init__.py new file mode 100644 index 0000000..b17cb34 --- /dev/null +++ b/darkmute/__init__.py @@ -0,0 +1 @@ +from .dark_mute import dark_mute diff --git a/darkmute/__main__.py b/darkmute/__main__.py new file mode 100644 index 0000000..e2050df --- /dev/null +++ b/darkmute/__main__.py @@ -0,0 +1,4 @@ +from .dark_mute import dark_mute + +if __name__ == "__main__": + dark_mute() diff --git a/darkmute.py b/darkmute/dark_mute.py similarity index 97% rename from darkmute.py rename to darkmute/dark_mute.py index dbd9c3d..d51369a 100644 --- a/darkmute.py +++ b/darkmute/dark_mute.py @@ -2,7 +2,7 @@ import asyncio import logging import time import RPi.GPIO as GPIO -from snap import get_snapcast_client +from .snap import get_snapcast_client SENSOR_PIN = 7 diff --git a/snap.py b/darkmute/snap.py similarity index 100% rename from snap.py rename to darkmute/snap.py diff --git a/setup.py b/setup.py index 3565678..8cdcc99 100644 --- a/setup.py +++ b/setup.py @@ -5,17 +5,20 @@ with open("README.md", "r") as fh: setup( name="DarkMute", - version="0.1", + version="0.1.7", author="Jessica Ward", description="Mute snapcast client playing on raspi3", long_description=long_description, long_description_content_type="text/markdown", url="https://git.xhost.io/jess/Dark-Mute", packages=find_packages(), - scripts=['darkmute.py'], + entry_points={ + 'console_scripts': ['darkmute = darkmute:dark_mute'], + }, install_requires=[ "RPi.GPIO==0.6.3", - "snapcast==2.0.8" + "snapcast==2.0.8", + "zeroconf==0.20.0" ], classifiers=[ "License :: OSI Approved :: MIT License", -- GitLab