Stylize Plugin for Beets
Project description
Stylize Plugin for Beets
The stylize
plugin adds three template functions for use in beets track and album listings. It is intended for use with the format_item and format_album configuration options. Using these functions will allow you to add style and color to the list command and other commands that need to print out items.
stylize
: Add color and formatting to your formatted items and albums.nocolor
: Show the supplied text only when color is disabled. This is useful to add separators between fields when color is unavailable.link
: Create clickable links in the terminal. This has no effect on an unsupported terminal. This lets you play a track or navigate to an album folder with a click.
Installation
As the beets documentation describes in Other plugins, to use an external plugin like this one, there are two options for installation:
- Make sure it’s in the Python path (known as
sys.path
to developers). This just means the plugin has to be installed on your system (e.g., with a setup.py script or a command like pip or easy_install). For example,pip install beets-stylize
. - Set the pluginpath config variable to point to the directory containing the plugin. (See Configuring) This would require cloning or otherwise downloading this repository before adding to the pluginpath.
Configuring
First, enable the stylize
plugin (see Using Plugins). Colors for use with the stylize
function may be defined using the colors option under UI Options in your beets configuration. For example:
ui:
colors:
artist: ["bold", "green"]
Using
The stylize
function accepts a named color as the first argument, the text to be stylized as the second, and an optional third argument for the text to be used if color is disabled.
Example usage in your beets configuration, based on the default format_item
and format_album
configuration options:
ui:
color: true
colors:
# Field colors for use in the item and album formats.
album: ["blue", "bold"]
albumartist: ["yellow"]
artist: ["bold", "yellow"]
title: ["normal"]
format_item: "%stylize{artist,$artist} %nocolor{- }%stylize{album,$album} %nocolor{- }%stylize{title,$title}"
format_album: "%stylize{albumartist,$albumartist} %nocolor{- }%stylize{album,$album}"
With this configured, we see listings like this:
And this:
If no color is available, such as due to redirection, or setting the NO_COLOR
environment variable, we see a listing like this due to the use of %nocolor
to add the separator:
As an example of how to use %link
, this would make the entire line a clickable link to the file path:
format_item: "%link{file://$path,$artist - $album - $title}"
As we see here, in the Visual Studio Code terminal:
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, Stylize Plugin for Beets is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for beets_stylize-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6d958126794577beba405098192ebe5fce572adb7ce5a3fa0cafae75dd6c149 |
|
MD5 | fa0dcace9f2babd2d354a3e09e78bc2e |
|
BLAKE2b-256 | 47f04bcb114aad2bc45a0475443a3ecd4b9aea04dd4ffadeda9d3dbb4c6e395e |