Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial 0.0.0 version #1

Merged
merged 13 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release
run-name: Creating releases/${{ inputs.version }}

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: string

jobs:
create_release_branch:
name: Create release branch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update version
run: |
echo "${{ github.event.inputs.version }}" > src/linkplay/__version__.py
- name: Create release branch
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B releases/${{ github.event.inputs.version }}
git commit --allow-empty -am "Create version ${{ github.event.inputs.version }}"
git push --set-upstream origin releases/${{ github.event.inputs.version }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

pypi-publish:
runs-on: ubuntu-latest
name: Upload release to PyPI
environment:
name: pypi
url: https://pypi.org/p/python-linkplay
permissions:
id-token: write
steps:
- uses: pypa/gh-action-pypi-publish@release/v1
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ['3.11']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

.vscode
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Velleman Group nv

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@

[![PyPI package](https://badge.fury.io/py/python-linkplay.svg)](https://pypi.org/project/python-linkplay/)

[![Release](https://github.com/velleman/python-linkplay/actions/workflows/release/badge.svg)](https://github.com/velleman/python-linkplay/actions/workflows/release.yaml)

# python-linkplay
LinkPlay library for Python
A Python Library for Seamless LinkPlay Device Control

## Intro

Welcome to python-linkplay, a powerful and user-friendly Python library designed to simplify the integration and control of LinkPlay-enabled devices in your projects. LinkPlay technology empowers a wide range of smart audio devices, making them interconnected and easily controllable. With python-linkpaly, you can harness this capability and seamlessly manage your LinkPlay devices from within your Python applications.

## Key features

1. Unified Control: python-linkplay provides a unified interface for controlling various LinkPlay-enabled devices, streamlining the process of interacting with speakers, smart home audio systems, and more.

2. Device Discovery: Easily discover and connect to LinkPlay devices on your network, ensuring a hassle-free setup and integration into your Python applications.

3. Playback Management: Take charge of audio playback on LinkPlay devices with functions to play, pause, skip tracks, adjust volume, and more, offering a comprehensive set of controls for a seamless user experience.

4. Metadata Retrieval: Retrieve essential metadata such as track information, artist details, and album data, enabling you to enhance the user interface and display relevant information in your applications.

## LinkPlay API documentation

- https://github.com/n4archive/LinkPlayAPI
- https://github.com/nagyrobi/home-assistant-custom-components-linkplay
- https://github.com/ramikg/linkplay-cli
- https://developer.arylic.com/httpapi/
- http://airscope-audio.net/core2/pdf/airscope-module-http.pdf
- https://www.wiimhome.com/pdf/HTTP%20API%20for%20WiiM%20Mini.pdf

## Multiroom

![Alt text](image.png)
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["setuptools>=42.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = [
"tests",
]

log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"

[tool.mypy]
mypy_path = "src"
check_untyped_defs = true
disallow_any_generics = true
ignore_missing_imports = true
no_implicit_optional = true
show_error_codes = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
no_implicit_reexport = true
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# requirements.txt
#
# installs dependencies from ./setup.py, and the package itself,
# in editable mode
-e .

# (the -e above is optional). you could also just install the package
# normally with just the line below (after uncommenting)
# .
9 changes: 9 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# requirements_dev.txt
#
# installs dev dependencies from ./setup.py, and the package itself,
# in editable mode
-e ./[testing]

# (the -e above is optional). you could also just install the package
# normally with just the line below (after uncommenting)
# .
41 changes: 41 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[metadata]
name = python_linkplay
description = A Python Library for Seamless LinkPlay Device Control
author = Velleman Group nv
version = attr: linkplay.VERSION
license = MIT
classifiers =
Programming Language :: Python :: 3

[options]
packages = find_namespace:
install_requires =
async-timeout==4.0.3
aiohttp==3.9.1
async_upnp_client==0.38.0
python_requires = >=3.8
package_dir =
=src
zip_safe = no

[options.package_data]
linkplay = py.typed

[options.packages.find]
where = src

[options.extras_require]
testing =
pytest>=7.3.1
pytest-cov>=4.1.0
pytest-mock>=3.10.0
pytest-asyncio>=0.23.3
mypy>=1.3.0
flake8>=6.0.0
tox>=4.6.0
typing-extensions>=4.6.3

[flake8]
max-line-length = 160
per-file-ignores =
*/__init__.py: F401
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from setuptools import setup


if __name__ == "__main__":
setup()
1 change: 1 addition & 0 deletions src/linkplay/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from linkplay.__version__ import __version__ as VERSION
14 changes: 14 additions & 0 deletions src/linkplay/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import asyncio
import aiohttp

from linkplay.discovery import discover_linkplay_bridges, discover_multirooms


async def main():
async with aiohttp.ClientSession() as session:
bridges = await discover_linkplay_bridges(session)
multirooms = await discover_multirooms(bridges)
return bridges, multirooms

if __name__ == "__main__":
asyncio.run(main())
1 change: 1 addition & 0 deletions src/linkplay/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.0'
Loading