Giter Site home page Giter Site logo

pycmus's Introduction

pycmus

A python library for sending commands to the cmus music player:

https://cmus.github.io/

It uses the same socket interface as the cmus-remote command.

Complete documentation is here: http://pycmus.readthedocs.io/en/latest/

Usage

Using pycmus is pretty straightforward you just need to init a PyCmus object and then issue commands to it. For example:

from pycmus import remote

cmus = remote.PyCmus()
print(cmus.status())

will connect to a running cmus instance (with the socket file in the default location) and print the player status.

For a complete API documentation see: pycmus_api.

pycmus's People

Contributors

mtreinish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

cntrbtr aorestr

pycmus's Issues

Attribute 'self.socket_path' doesn't exist

I was reading the code in order to use for my own project and then my IDE noticed a problem with the program.
In:

def _get_cmus_conf_dir(self)

you use self.socket_path, which it's not possible since there is no such attribute in the class.
A fine solution might be just adding a new parameter called socket_path on the method. So, basically the method that calls the function I'm talking about and that one will be something like:

def _get_socket_path(self, socket_path=None):
        if "CMUS_SOCKET" in os.environ:
            return os.environ["CMUS_SOCKET"]
        else:
            if "XDG_RUNTIME_DIR" in os.environ:
                return os.path.join(os.environ["XDG_RUNTIME_DIR"],
                                    "cmus-socket")
            else:
                conf_dir = self._get_cmus_conf_dir(socket_path)
                return os.path.join(conf_dir, 'socket')

def _get_cmus_conf_dir(self, socket_path=None):
        if socket_path:
            return socket_path

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.