diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 0754b8bc00..99b9d7f4be 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -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 @@ -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 diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index e680ea0982..0122bae86a 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -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] diff --git a/docs/changelog.rst b/docs/changelog.rst index 2be357e730..f91c0431e4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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) diff --git a/docs/guides/main.rst b/docs/guides/main.rst index 21a4e3e609..5f60f67993 100644 --- a/docs/guides/main.rst +++ b/docs/guides/main.rst @@ -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/ diff --git a/docs/reference/config.rst b/docs/reference/config.rst index 9000f070ab..64f2f446fe 100644 --- a/docs/reference/config.rst +++ b/docs/reference/config.rst @@ -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