Giter Site home page Giter Site logo

psub's Introduction

          _________    ___.    
  ______ /   _____/__ _\_ |__  
  \____ \\_____  \|  |  \ __ \ 
  |  |_> >        \  |  / \_\ \
  |   __/_______  /____/|___  /
  |__|          \/          \/
   

CLI Subsonic Client

I was looking for a way to play music from my Subsonic server without needing a whole browser open and thought that a CLI tool might be fun. After a quick search I didn't find what I was after so I decided to build something.

pSub is intended to be very simple and focus just on playing music easily. Don't expect to be able to access advanced configuration of a Subsonic server or playlist management.

pSub is written in Python (written with 3.5 but 2.7 should work) using Click to build the CLI and Requests to handle the communication with the Subsonic API.
It should run on most operating systems too but this hasn't been tested.

Installation

Dependencies

pSub uses ffplay to handle the streaming of music so that needs to be installed and available as a command line executable before using pSub. (you'll be prompted to download ffplay if pSub can't launch it correctly)

Python3.8 and pipenv need to be installed

For compiling, some additional dependencies are required (install them with your system package manager; atpt, yum, pacman etc.): The package names vary by distribution:

  • Fedora, CentOS, RHEL, etc.: gobject-introspection-devel cairo-devel pkg-config python3-devel
  • Debian, Ubuntu, Mint, etc.: libgirepository1.0-dev libcairo2-dev pkg-config python3-dev
  • Arch: gobject-introspection cairo pkgconf

The dependencies are PyGObject and Pycairo. See their websites for more info if the instruction above are out of date.

Instructions
  • Clone this repo
    git clone github.com/inuitwallet/psub.git
  • Enter the pSub directory
    cd psub
  • Sync the dependencies
    pipenv sync
  • Copy the psub binary to /usr/bin to allow for running pSub from any other directory
    sudo cp $(pipenv --venv)/bin/pSub /usr/bin/psub
  • Run pSub
    psub

Usage

On first run you will be prompted to edit your config file. pSub will install a default config file and then open it for editing in your default text editor. You need to specify the url, username and password of your Subsonic server at a minimum.
There are also some settings for adjusting your playback options. The settings are all described in detail in the config file itself.
pSub will run a connection test once your config been saved to make sure it can communicate correctly with Subsonic.
You can edit your config or run the connection test at any time with the -c and -t command line flags.

Once pSub is properly configured, you can start playing music by running any of the commands shown below.

Usage: pSub [OPTIONS] COMMAND [ARGS]...  

Options:  
  -c, --config  Edit the config file  
  -t, --test    Test the server configuration
  -h, --help    Show this message and exit.

Commands:
  album     Play songs from chosen Album
  artist    Play songs from chosen Artist
  playlist  Play a chosen playlist
  radio     Play endless Radio based on a search
  random    Play random tracks

Here are some animations of the commands in action:
psub album (functions involving a search will accept * as a wildcard)

psub artist (the -r flag indicates that tracks should be played back in a random order)

psub playlist (playlist must exist on the Subsonic server first)

psub radio

psub random

psub's People

Contributors

inuitwallet avatar mj2p avatar ppgodel avatar sammoth-ovo avatar sammoth-ripjar avatar sammoth-wazoku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

psub's Issues

Python3.9

Gently requesting to upgrade dependencies to Python3.9.
3.8 was deprecated at least in Debian 11.

Doesn't work: "Command Failed!"

Hi there!
I've tried to set up psub as per README but I get this error trying to test (or play anything):

dell ➜  psub git:(master) ve/bin/pSub -t                
Testing Server Connection
https://my_username@my_host_address
Command Failed! 10: Required parameter 'p' is missing.

What could be wrong here?

Python 3.7.3 
Supysonic as backend

Feature request

I would like to use this project with mpv media player instead of ffplay. (I am on a device which does not support ffplay)

What modifications would you suggest?

pSub crashing on server connection

Testing Server Connection
https://USERNAME@SERVER  (No passwd in this URI)
Traceback (most recent call last):
  File "/home/david/.local/bin/pSub", line 8, in <module>
    sys.exit(cli())
  File "/home/david/.local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/david/.local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/david/.local/lib/python3.8/site-packages/click/core.py", line 1236, in invoke
    return Command.invoke(self, ctx)
  File "/home/david/.local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/david/.local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/david/.local/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/david/.local/lib/python3.8/site-packages/pSub.py", line 615, in cli
    test_ok = ctx.obj.test_config()
  File "/home/david/.local/lib/python3.8/site-packages/pSub.py", line 90, in test_config
    ping = self.make_request(url=self.create_url('ping'))
  File "/home/david/.local/lib/python3.8/site-packages/pSub.py", line 114, in create_url
    if version.parse(self.api) < version.parse("1.13.0"):
  File "/home/david/.local/lib/python3.8/site-packages/packaging/version.py", line 56, in parse
    return Version(version)
  File "/home/david/.local/lib/python3.8/site-packages/packaging/version.py", line 275, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
david@zeitgeist:[~/Build/psub]$ 

Same result with venv.

add support for wildcard when searching album

Not sure if the Subsonic API would allow that. Is that even possible?

❯ ve/bin/pSub album *      
Usage: pSub album [OPTIONS] SEARCH_TERM
Try "pSub album -h" for help.

Error: Got unexpected extra arguments (pSub.py README.md setup.py ve)

ampache + nginx user@domain error 404

What I can't figure out is: is this because ampache deviates from the subsonic spec, because I have fudged the nginx config, or becauase of something else.

The server works with native android subsonic clients and the user@domain gets to ampache when using plain curl, but with pSub it gets a 404.

API compatibility with ampache?

I think that it should work (downhill, with the following wind) if the str.ljust directives are changed to either detect the string or skip on error; I might give it a go next time I feel so inclined to fiddle.

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.