MCPcopy Index your code
hub / github.com/crustymonkey/py-sonic

github.com/crustymonkey/py-sonic @1.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.2 ↗ · + Follow
114 symbols 432 edges 4 files 88 documented · 77%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

py-sonic

INSTALL

Installation is fairly simple. Just do the standard install as root:

tar -xvzf py-sonic-*.tar.gz
cd py-sonic-*
python setup.py install

You can also install directly using pip or easy_install

pip install py-sonic

USAGE

This library follows the REST API almost exactly (for now). If you follow the documentation on http://www.subsonic.org/pages/api.jsp or you do a:

pydoc libsonic.connection

I have also added documentation at http://stuffivelearned.org/doku.php?id=programming:python:py-sonic

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)

Core symbols most depended-on inside this repo

_checkStatus
called by 75
libsonic/connection.py
_doInfoReq
called by 71
libsonic/connection.py
_getRequest
called by 70
libsonic/connection.py
_getQueryDict
called by 33
libsonic/connection.py
_ts2milli
called by 6
libsonic/connection.py
_doBinReq
called by 5
libsonic/connection.py
_getOpener
called by 4
libsonic/connection.py
_getRequestWithLists
called by 4
libsonic/connection.py

Shape

Method 104
Class 9
Function 1

Languages

Python100%

Modules by API surface

libsonic/connection.py105 symbols
libsonic/errors.py9 symbols

For agents

$ claude mcp add py-sonic \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact