Skip to content

Commit

Permalink
Merge branch 'master' into feature/track_rejected_tags
Browse files Browse the repository at this point in the history
* master:
  Fix beetbox#1564 (regression from beetbox#1559)
  aur4 is now aur
  Update main.rst
  Update main.rst
  colors: support standard terminal colors
  Changelog for beetbox#1559
  • Loading branch information
Sven Oos committed Feb 23, 2017
2 parents 6a02cde + 4038f19 commit c3c0750
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 12 deletions.
33 changes: 27 additions & 6 deletions beets/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,31 @@ def human_seconds_short(interval):
# http://dev.pocoo.org/hg/pygments-main/file/b2deea5b5030/pygments/console.py
# (pygments is by Tim Hatch, Armin Ronacher, et al.)
COLOR_ESCAPE = "\x1b["
DARK_COLORS = ["black", "darkred", "darkgreen", "brown", "darkblue",
"purple", "teal", "lightgray"]
LIGHT_COLORS = ["darkgray", "red", "green", "yellow", "blue",
"fuchsia", "turquoise", "white"]
DARK_COLORS = {
"black": 0,
"darkred": 1,
"darkgreen": 2,
"brown": 3,
"darkyellow": 3,
"darkblue": 4,
"purple": 5,
"darkmagenta": 5,
"teal": 6,
"darkcyan": 6,
"lightgray": 7
}
LIGHT_COLORS = {
"darkgray": 0,
"red": 1,
"green": 2,
"yellow": 3,
"blue": 4,
"fuchsia": 5,
"magenta": 5,
"turquoise": 6,
"cyan": 6,
"white": 7
}
RESET_COLOR = COLOR_ESCAPE + "39;49;00m"

# These abstract COLOR_NAMES are lazily mapped on to the actual color in COLORS
Expand All @@ -395,9 +416,9 @@ def _colorize(color, text):
in DARK_COLORS or LIGHT_COLORS.
"""
if color in DARK_COLORS:
escape = COLOR_ESCAPE + "%im" % (DARK_COLORS.index(color) + 30)
escape = COLOR_ESCAPE + "%im" % (DARK_COLORS[color] + 30)
elif color in LIGHT_COLORS:
escape = COLOR_ESCAPE + "%i;01m" % (LIGHT_COLORS.index(color) + 30)
escape = COLOR_ESCAPE + "%i;01m" % (LIGHT_COLORS[color] + 30)
else:
raise ValueError('no such color %s', color)
return escape + text + RESET_COLOR
Expand Down
2 changes: 1 addition & 1 deletion beetsplug/lastgenre/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def _tags_for(self, obj, min_weight=None):

# Filter by weight (optionally).
if min_weight:
res = [el for el in res if (int(el.weight) or 0) >= min_weight]
res = [el for el in res if (int(el.weight or 0)) >= min_weight]

# Get strings from tags.
res = [el.item.get_name().lower() for el in res]
Expand Down
10 changes: 9 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ Changelog
1.3.15 (in development)
-----------------------

Changelog goes here!
The new features:

* Add new color aliases for standard terminal color names (e.g., cyan and
magenta). Thanks to :user:`mathstuf`. :bug:`1548`

Fixes:

* :doc:`/plugins/lastgenre`: Fix a bug that prevented tag popularity from
being considered. Thanks to :user:`svoos`. :bug:`1559`


1.3.14 (August 2, 2015)
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ dropped, and Python 3.x is not yet supported.)
.. _dnf: http://fedoraproject.org/wiki/Features/DNF
.. _SlackBuild: http://slackbuilds.org/repository/14.1/multimedia/beets/
.. _beets port: http://portsmon.freebsd.org/portoverview.py?category=audio&portname=beets
.. _beets from AUR: http://aur.archlinux.org/packages.php?ID=39577
.. _dev package: http://aur.archlinux.org/packages.php?ID=48617
.. _beets from AUR: https://aur.archlinux.org/packages/beets-git/
.. _dev package: https://aur.archlinux.org/packages/beets-git/
.. _Debian details: http://packages.qa.debian.org/b/beets.html
.. _Ubuntu details: https://launchpad.net/ubuntu/+source/beets
.. _beets is in [community]: https://www.archlinux.org/packages/community/any/beets/
Expand Down
5 changes: 3 additions & 2 deletions docs/reference/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ in your configuration file that looks like this::
action_default: turquoise
action: blue

Available colors: black, darkred, darkgreen, brown, darkblue, purple, teal,
lightgray, darkgray, red, green, yellow, blue, fuchsia, turquoise, white
Available colors: black, darkred, darkgreen, brown (darkyellow), darkblue,
purple (darkmagenta), teal (darkcyan), lightgray, darkgray, red, green,
yellow, blue, fuchsia (magenta), turquoise (cyan), white


Importer Options
Expand Down

0 comments on commit c3c0750

Please sign in to comment.