Skip to main content

A Python wrapper library for the Subsonic REST API

Project description

py-sonic

A Python wrapper library for the Subsonic REST API.

Installation

Install from PyPI using pip:

pip install py-sonic2

Or install from source:

git clone https://github.com/m00n/py-sonic.git
cd py-sonic
pip install .

Usage

This library follows the Subsonic REST API. For detailed API documentation, see:

Basic Tutorial

This is about as basic as it gets. We are just going to set up the connection and then get a couple of random songs.

#!/usr/bin/env python

from pprint import pprint
import libsonic

# We pass in the base url, the username, password, and port number
# Be sure to use https:// if this is an ssl connection!
conn = libsonic.Connection('https://music.example.com' , 'myuser' , 
    'secretpass' , port=443)
# Let's get 2 completely random songs
songs = conn.getRandomSongs(size=2)
# We'll just pretty print the results we got to the terminal
pprint(songs)

As you can see, it's really pretty simple. If you use the documentation provided in the library:

pydoc libsonic.connection

or the api docs on subsonic.org (listed above), you should be able to make use of your server without too much trouble.

Right now, only plain old dictionary structures are returned. The plan for a later release includes the following:

  • Proper object representations for Artist, Album, Song, etc.
  • Lazy access of members (the song objects aren't created until you want to do something with them)

Development

Building and Publishing

This project includes a Makefile for easy building and publishing:

# View all available commands
make help

# Build the package
make build

# Run full release workflow
make release

# Upload to TestPyPI
make upload-test

# Upload to PyPI
make upload

For detailed instructions, see PYPI_RELEASE.md.

CI/CD

This project uses GitLab CI/CD for automated testing and publishing. The pipeline includes:

  • Testing across Python 3.8-3.13
  • Code quality checks with ruff
  • Security scanning with safety and bandit
  • Automated building of distributions
  • Publishing to TestPyPI and PyPI

For CI/CD setup and configuration, see CI_CD.md.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_sonic2-1.0.3.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_sonic2-1.0.3-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file py_sonic2-1.0.3.tar.gz.

File metadata

  • Download URL: py_sonic2-1.0.3.tar.gz
  • Upload date:
  • Size: 48.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for py_sonic2-1.0.3.tar.gz
Algorithm Hash digest
SHA256 8e7451b30c041ee8fd226a3a5c30e488cca326c31c4fc9e10652c45f8dc9c30c
MD5 21834d1bd5e423f81a803c1c1c75e438
BLAKE2b-256 893c6591ab329e351e25b9c17723dfb1086d6b1dfcb9eddd8f6969ed2223bc1c

See more details on using hashes here.

File details

Details for the file py_sonic2-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: py_sonic2-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for py_sonic2-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ab09677338bc95b1d64080fbaf53e2b5908d29255b3ad092e9a1b9289e49e257
MD5 cfe2d1fa641a64fb37562b0d742f3390
BLAKE2b-256 db6e8c7ef31da1a2e34945b35198ee6a45c7272ff5e613782898b9bd44497cbb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page