From 26573bb4991e65d4767690f042ef92e4c930712e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 30 Jul 2015 04:32:11 -0700 Subject: [PATCH 1/6] Changelog for #1559 --- docs/changelog.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2be357e730..3a798c7f08 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,7 +4,10 @@ Changelog 1.3.15 (in development) ----------------------- -Changelog goes here! +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) From 323f79ecdbc961fb2e33ad8300910ba80527dc85 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 5 Aug 2015 21:59:39 -0400 Subject: [PATCH 2/6] colors: support standard terminal colors Fixes #1548. Signed-off-by: Ben Boeckel --- beets/ui/__init__.py | 33 +++++++++++++++++++++++++++------ docs/changelog.rst | 5 +++++ docs/reference/config.rst | 5 +++-- 3 files changed, 35 insertions(+), 8 deletions(-) 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/docs/changelog.rst b/docs/changelog.rst index 3a798c7f08..f91c0431e4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,11 @@ Changelog 1.3.15 (in development) ----------------------- +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 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 From d7af0f9b033b2f087711da9ce9f653d203ad8df5 Mon Sep 17 00:00:00 2001 From: quarksify Date: Fri, 7 Aug 2015 11:38:06 -0400 Subject: [PATCH 3/6] Update main.rst --- docs/guides/main.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/main.rst b/docs/guides/main.rst index 21a4e3e609..8c268974ce 100644 --- a/docs/guides/main.rst +++ b/docs/guides/main.rst @@ -51,7 +51,7 @@ 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 +.. _beets from AUR: https://aur4.archlinux.org/packages/beets-git/ .. _dev package: http://aur.archlinux.org/packages.php?ID=48617 .. _Debian details: http://packages.qa.debian.org/b/beets.html .. _Ubuntu details: https://launchpad.net/ubuntu/+source/beets From f1793b66533b777afee8016989e0d8558efd924a Mon Sep 17 00:00:00 2001 From: quarksify Date: Fri, 7 Aug 2015 11:41:01 -0400 Subject: [PATCH 4/6] Update main.rst --- docs/guides/main.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/main.rst b/docs/guides/main.rst index 8c268974ce..838fe8ebd0 100644 --- a/docs/guides/main.rst +++ b/docs/guides/main.rst @@ -52,7 +52,7 @@ dropped, and Python 3.x is not yet supported.) .. _SlackBuild: http://slackbuilds.org/repository/14.1/multimedia/beets/ .. _beets port: http://portsmon.freebsd.org/portoverview.py?category=audio&portname=beets .. _beets from AUR: https://aur4.archlinux.org/packages/beets-git/ -.. _dev package: http://aur.archlinux.org/packages.php?ID=48617 +.. _dev package: https://aur4.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/ From 7621ae4280c0eeadc6d441684ace427d2a99af81 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 7 Aug 2015 09:52:43 -0700 Subject: [PATCH 5/6] aur4 is now aur The transition is imminent (and the link already works): https://wiki.archlinux.org/index.php/Arch_User_Repository#AUR_4 --- docs/guides/main.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/main.rst b/docs/guides/main.rst index 838fe8ebd0..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: https://aur4.archlinux.org/packages/beets-git/ -.. _dev package: https://aur4.archlinux.org/packages/beets-git/ +.. _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/ From 4038f191da3d62f603aca8f12b5949d6e16c10ed Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 8 Aug 2015 11:23:55 -0700 Subject: [PATCH 6/6] Fix #1564 (regression from #1559) --- beetsplug/lastgenre/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index db2d8a517a..eab6ab4408 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -411,7 +411,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]