pyza
pyza
is a command-line (or terminal, or console, or whatever you want to call it) Songza player, originally based on MixZaTape. It can use VLC to play audio in a subprocess in the background, or send tracks to an MPD server to play. It runs best on Linux, but you can probably run it on OS X, and you might be able to get it working on Windows.
Requirements
- Python 2.7+ (it might work on 2.6…)
- BeautifulSoup4, packaged for Debian/Ubuntu as
python-bs4
. - VLC or MPD
- MPD support requires
python-mpd
>= version 0.5.4. This is from the forked version known aspython-mpd2
, which may not be packaged in your distro yet. You can install it withpip
.
Note: MPD versions older than 0.19 don’t have the addtags
command, which means that track info won’t appear in the playlist.
Usage
It’s pretty self-explanatory:
usage: pyza [-h] [-l [{activities,genres,decades,moods} [{activities,genres,decades,moods} ...]]] [-e [term [term ...]]] [-i [term [term ...]]] [-f] [-d] [-n] [-m [host[:port]]] [-r] [-R] [--sort {name,songs,id}] [-v] [STATION|QUERY [STATION|QUERY ...]] A terminal-based Songza client. Plays with VLC by default, or with MPD. positional arguments: STATION|QUERY A station ID number, station name, partial station name, or category query like activity:driving, decade:1960s, genre:jazz, or mood:happy. You may abbreviate the category type like g:jazz, and you may use multiple queries which will be ORed together. optional arguments: -h, --help show this help message and exit -l [{activities,genres,decades,moods} [{activities,genres,decades,moods} ...]] List available categories -e [term [term ...]], --exclude [term [term ...]] Exclude stations whose names or descriptions match any term -i [term [term ...]], --include [term [term ...]] Include only stations whose names or descriptions match at least one term -f, --find List stations matching queries -d, --descriptions Show station descriptions -n, --names-only Only search station names, not station descriptions or other data -m [host[:port]], --mpd [host[:port]] Play with MPD server. Default: localhost:6600 -r, --random Play one random station from stations matching queries -R, --random-stations Play one song each from random stations matching queries --sort {name,songs,id} Sort station list (default: number of songs) -v, --verbose Be verbose, up to -vv examples: pyza -f movies pyza -r mood:happy pyza -R g:jazz g:classical -e christmas pyza -R a:sleeping -i classical jazz -e sing
Examples
pyza -f movies
lists stations containing movies in their names or descriptions.
pyza -r mood:happy
plays a random station that fits a happy mood.
pyza -R g:jazz g:classical
plays one track at a time from random stations in the jazz or classical genres.
pyza -R piano jazz -e christmas
plays one track at a time from random stations containing jazz or piano in their names or descriptions, but not stations containing Christmas.
pyza -R a:sleeping -i classical jazz -e sing
plays one track at a time from random stations suitable for sleeping, but only if they contain classical or jazz in their names or descriptions, and only if they do not contain sing in their names or descriptions. Because falling asleep to someone singing ain’t always easy.
pyza -f d:1960s
finds and lists stations from the 1960s.
pyza 1744730
plays station #1744730.
pyza -n under\ the\ boardwalk
plays the station named Under the Boardwalk. If you left off -n
, it would instead list multiple stations, because it would also search on station descriptions. (You can–and should–quote strings instead of escaping the spaces, but due to a problem in the parser for this readme file, quotes don’t work within code strings. Doh…)
TODOs
- Use gmusicapi to support new Google Now stuff.
- Use signals or something to allow skipping tracks and voting.
- Somehow provide access to the Songza concierge service?
Allow searching by activity, genre, or mood.
Credits
- Thanks to TannerBaldus for writing most of the code for querying activities, genres, and moods.
- Thanks to robu3 for creating MixZaTape, which inspired
pyza
.
License
GPLv2