gunny Documentation Release 0.1.0 David Blewett December 29, 2013
Contents 1 gunny 3 1.1 Features.................................................. 3 2 Installation 5 2.1 Dependencies............................................... 5 2.2 Python Package............................................. 5 3 Usage 7 4 Contributing 9 4.1 Types of Contributions.......................................... 9 4.2 Get Started!................................................ 10 4.3 Pull Request Guidelines......................................... 10 4.4 Tips.................................................... 11 5 Credits 13 5.1 Development Lead............................................ 13 5.2 Contributors............................................... 13 6 History 15 6.1 0.1.0 (2013-12-08)............................................ 15 7 Indices and tables 17 i
ii
gunny Documentation, Release 0.1.0 Contents: Contents 1
gunny Documentation, Release 0.1.0 2 Contents
CHAPTER 1 gunny Gunny is the control package for the Reveille music protocol. Free software: BSD license Documentation: http://gunny.rtfd.org. 1.1 Features Uses Twisted for the server, client and player components Uses the PySoundFile Python binding for libsndfile to decode audio files Uses the PySoundCard Python binding for PortAudio to play audio files 3
gunny Documentation, Release 0.1.0 4 Chapter 1. gunny
CHAPTER 2 Design The design of the Reveille music protocol encompasses 3 pieces of functionality: 1. Music file cataloging and serving (flakd) On any device where you have music stored (desktop, NAS, etc) 2. Central catalog and dispatch of music requests (gunnyd) 3. Music search and playback (coxswaind) One on any device you want to play music from (laptop, netbook, etc) There can be multiple instances of daemons #1 and #3 that are dispatched by a single instance of #2: ------- ----------- flakd ------------- coxswaind ------- ----------- \ \ -------- ------- gunnyd ------ flakd -------- ------- \ \ ----------- ------------------ coxswaind ----------- 2.1 flakd The flakd daemon scans a given set of directories for music files and submits the metadata to the gunnyd daemon for indexing. It waits for requests for the contents of specific music files from the coxswaind daemon. 2.2 gunnyd The gunnyd daemon is the central hub responsible for cataloging music files from the flakd daemon, dispatching music search requests and pub/sub events from the coxswaind daemon (such as playback begin/pause/end). 5
gunny Documentation, Release 0.1.0 2.3 coxswaind The coxswaind daemon is the one most users will interact with the most. It is responsible for submitting search requests to the gunnyd daemon, submitting requests for file data to the flakd daemon and actually playing back music files to the local soundcard. It runs in the background, and the user submits commands to it via the coxswain CLI script. 6 Chapter 2. Design
CHAPTER 3 Installation 3.1 Dependencies This project relies on libsndfile (via PyAudio) to decode music files, and PortAudio (via PySoundCard) to play the decoded file. Both of these packages are available in most OS package repositories. For example, to install on OS X using MacPorts: $ sudo port install libsndfile portaudio To install on FreeBSD using ports: $ sudo portmaster audio/libsndfile audio/portaudio 3.2 Python Package At the command line: $ easy_install gunny Or, if you have virtualenvwrapper installed: $ mkvirtualenv gunny $ pip install gunny 7
gunny Documentation, Release 0.1.0 8 Chapter 3. Installation
CHAPTER 4 Usage The gunnyd daemon provides a central point to access your music collection: (gunny) dhmo% twistd -n --pidfile=gunnyd.pid gunnyd 2013-12-08 23:08:23-0500 [-] Log opened. 2013-12-08 23:08:23-0500 [-] twistd 13.2.0 (/Users/davidb/.virtualenvs/gunny/bin/python 2.7.5) starti 2013-12-08 23:08:23-0500 [-] reactor class: twisted.internet.selectreactor.selectreactor. 2013-12-08 23:08:23-0500 [-] Site starting on 9876 2013-12-08 23:08:23-0500 [-] Starting factory <twisted.web.server.site instance at 0x10d9f5b00> The flakd daemon catalogs your music collection and streams audio data to clients: (gunny) dhmo% twistd -n --pidfile=flakd.pid flakd 2013-12-08 23:08:23-0500 [-] Log opened. 2013-12-08 23:08:23-0500 [-] twistd 13.2.0 (/Users/davidb/.virtualenvs/gunny/bin/python 2.7.5) starti 2013-12-08 23:08:23-0500 [-] reactor class: twisted.internet.selectreactor.selectreactor. 2013-12-08 23:08:23-0500 [-] Site starting on 9875 2013-12-08 23:08:23-0500 [-] Starting factory <twisted.web.server.site instance at 0x10d9f5b00> The coxswaind daemon runs where you would like the music to play: (gunny) dhmo% twistd -n --pidfile=coxswaind.pid coxswaind 2013-12-29 15:48:33-0500 [-] Log opened. 2013-12-29 15:48:33-0500 [-] twistd 13.2.0 (/Users/davidb/.virtualenvs/gunny/bin/python 2.7.5) starti 2013-12-29 15:48:33-0500 [-] reactor class: twisted.internet.selectreactor.selectreactor. 2013-12-29 15:48:33-0500 [-] ReveilleCommandFactory starting on /tmp/rcp.sock 2013-12-29 15:48:33-0500 [-] Starting factory <gunny.reveille.client.reveillecommandfactory instance Submit commands to coxswaind via the coxswain script: (gunny) dhmo% coxswain shell Reveille command console. Type help for help. enqueue 01.flac play pause quit Goodbye. 9
gunny Documentation, Release 0.1.0 10 Chapter 4. Usage
CHAPTER 5 Contributing Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: 5.1 Types of Contributions 5.1.1 Report Bugs Report bugs at https://github.com/davidblewett/gunny/issues. If you are reporting a bug, please include: Your operating system name and version. Any details about your local setup that might be helpful in troubleshooting. Detailed steps to reproduce the bug. 5.1.2 Fix Bugs Look through the GitHub issues for bugs. Anything tagged with bug is open to whoever wants to implement it. 5.1.3 Implement Features Look through the GitHub issues for features. Anything tagged with feature is open to whoever wants to implement it. 5.1.4 Write Documentation gunny could always use more documentation, whether as part of the official gunny docs, in docstrings, or even on the web in blog posts, articles, and such. 11
gunny Documentation, Release 0.1.0 5.1.5 Submit Feedback The best way to send feedback is to file an issue at https://github.com/davidblewett/gunny/issues. If you are proposing a feature: Explain in detail how it would work. Keep the scope as narrow as possible, to make it easier to implement. Remember that this is a volunteer-driven project, and that contributions are welcome :) 5.2 Get Started! Ready to contribute? Here s how to set up gunny for local development. 1. Fork the gunny repo on GitHub. 2. Clone your fork locally: $ git clone git@github.com:your_name_here/gunny.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development: $ mkvirtualenv gunny $ cd gunny/ $ python setup.py develop 4. Create a branch for local development: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox: $ flake8 gunny tests $ python setup.py test $ tox To get flake8 and tox, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub: $ git add. $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. 5.3 Pull Request Guidelines Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 12 Chapter 5. Contributing
gunny Documentation, Release 0.1.0 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for Python 2.6, 2.7, and 3.3, and for PyPy. Check https://travisci.org/davidblewett/gunny/pull_requests and make sure that the tests pass for all supported Python versions. 5.4 Tips To run a subset of tests: $ python -m unittest tests.test_gunny 5.4. Tips 13
gunny Documentation, Release 0.1.0 14 Chapter 5. Contributing
CHAPTER 6 Credits 6.1 Development Lead David Blewett <david@dawninglight.net> 6.2 Contributors None yet. Why not be the first? 15
gunny Documentation, Release 0.1.0 16 Chapter 6. Credits
CHAPTER 7 History 7.1 0.1.0 (2013-12-08) First release on PyPI. 17
gunny Documentation, Release 0.1.0 18 Chapter 7. History
CHAPTER 8 Indices and tables genindex modindex search 19