beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.57k stars 1.8k forks source link

Regression in 2.0.0: import UI is useless in ligth theme #5342

Open catap opened 2 days ago

catap commented 2 days ago

Problem

When someoen uses non dark theme, like me for last couple of weeks, it leads to almost not usefull UI.

See:

image

This is regression was introduced by https://github.com/beetbox/beets/pull/3721

You may reproduce it by using this xterm theme: https://github.com/janoamaral/Xresources-themes/blob/master/light/PaperColor.Xresources

Setup

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    sources: musixmatch genius tekstowo google
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    bing_client_secret: REDACTED
    bing_lang_to:
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    synced: no
    dist_thresh: 0.1
directory: /mnt/diskstation/music
asciify_paths: yes

import:
    move: yes
fetchart:
    sources: filesystem coverart itunes amazon albumart lastfm
    lastfm_key: REDACTED
    auto: yes
    minwidth: 0
    maxwidth: 0
    quality: 0
    max_filesize: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    store_source: no
    high_resolution: no
    deinterlace: no
    cover_format:
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
musicbrainz:
    user: catap
    pass: REDACTED
mbcollection:
    auto: yes
    remove: yes
    collection: 04540b29-ba5e-4e0e-82e8-161035854aa4
convert:
    copy_album_art: yes
    auto: no
    format: flac
    formats:
        copy_m4a:
            command: ffmpeg -i $source -y -vn -c:a copy $dest
            extension: m4a
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    dest:
    pretend: no
    link: no
    hardlink: no
    threads: 4
    id3v23: inherit
    max_bitrate:
    auto_keep: no
    tmpdir:
    quiet: no
    embed: yes
    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    album_art_maxwidth: 0
    delete_originals: no
    playlist:
paths:
    default: '%the{$albumartist}/$album%aunique{}/$track $title'
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$track $title

# --------------- Plugins ---------------

plugins: convert duplicates edit embedart fetchart fuzzy info lastgenre lyrics mbcollection mbsubmit mbsync missing the
duplicates:
    album: no
    checksum: ''
    copy: ''
    count: no
    delete: no
    format: ''
    full: no
    keys: []
    merge: no
    move: ''
    path: no
    tiebreak: {}
    strict: no
    tag: ''
embedart:
    maxwidth: 0
    auto: yes
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    quality: 0
edit:
    albumfields: album albumartist
    itemfields: track title artist album
    ignore_fields: id path
fuzzy:
    prefix: '~'
    threshold: 0.7
lastgenre:
    whitelist: yes
    min_weight: 10
    count: 1
    fallback:
    canonical: no
    source: album
    force: yes
    auto: yes
    separator: ', '
    prefer_specific: no
    title_case: yes
mbsubmit:
    format: $track. $title - $artist ($length)
    threshold: medium
    picard_path: picard
the:
    the: yes
    a: yes
    format: '{0}, {1}'
    strip: no
    patterns: []
missing:
    count: no
    total: no
    album: no
arsaboo commented 2 days ago

You can configure the colors: https://beets.readthedocs.io/en/stable/reference/config.html#colors

catap commented 2 days ago

@arsaboo yes, I can. But this bug can be reproduced with default setting of Xterm.

Serene-Arc commented 1 day ago

Do you have a suggested fix for this @catap? It seems relatively easy to change from a user's settings. Perhaps a change of the default colours for people who haven't set it specifically?

catap commented 1 day ago

I think that default settings should be useful for both dark and light themes, at least it was true before 2.0.0

catap commented 1 day ago

Just for records, here how it looks at default settings of xterm:

image

catap commented 1 day ago

The next step, I've tried to use lightgray instead of white as it state in docs. But I can't, it leads to:

Traceback (most recent call last):
  File "/usr/local/bin/beet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/beets/ui/__init__.py", line 1865, in main
    _raw_main(args)
  File "/usr/local/lib/python3.11/site-packages/beets/ui/__init__.py", line 1852, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/local/lib/python3.11/site-packages/beets/ui/commands.py", line 1395, in import_func
    import_files(lib, paths, query)
  File "/usr/local/lib/python3.11/site-packages/beets/ui/commands.py", line 1326, in import_files
    session.run()
  File "/usr/local/lib/python3.11/site-packages/beets/importer.py", line 360, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/local/lib/python3.11/site-packages/beets/util/pipeline.py", line 447, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/usr/local/lib/python3.11/site-packages/beets/util/pipeline.py", line 312, in run
    out = self.coro.send(msg)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/beets/util/pipeline.py", line 171, in coro
    task = func(*(args + (task,)))
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/beets/importer.py", line 1521, in user_query
    task.choose_match(session)
  File "/usr/local/lib/python3.11/site-packages/beets/importer.py", line 949, in choose_match
    choice = session.choose_match(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/beets/ui/commands.py", line 1040, in choose_match
    path_str = ui.colorize("import_path", path_str0)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/beets/ui/__init__.py", line 618, in colorize
    raise ValueError("no such ANSI code %s", code)
ValueError: ('no such ANSI code %s', 'lightgray')
catap commented 1 day ago

Probably a way to fix it. First, we need to move to 4-bit ansi colors as:

modified   beets/ui/__init__.py
@@ -533,6 +533,14 @@ ANSI_CODES = {
     "magenta": 35,
     "cyan": 36,
     "white": 37,
+    "bright_black": 90,
+    "bright_red": 91,
+    "bright_green": 92,
+    "bright_yellow": 93,
+    "bright_blue": 94,
+    "bright_magenta": 95,
+    "bright_cyan": 96,
+    "bright_white": 97,
     # Background colors.
     "bg_black": 40,
     "bg_red": 41,
@@ -542,6 +550,14 @@ ANSI_CODES = {
     "bg_magenta": 45,
     "bg_cyan": 46,
     "bg_white": 47,
+    "bg_bright_black": 100,
+    "bg_bright_red": 101,
+    "bg_bright_green": 102,
+    "bg_bright_yellow": 103,
+    "bg_bright_blue": 104,
+    "bg_bright_magenta": 105,
+    "bg_bright_cyan": 106,
+    "bg_bright_white": 107,
 }
 RESET_COLOR = COLOR_ESCAPE + "39;49;00m"

after that I may use bright colors as:

modified   beets/config_default.yaml
@@ -122,7 +122,7 @@ ui:
         text_warning: ['bold', 'yellow']
         text_error: ['bold', 'red']
         text_highlight: ['bold', 'red']
-        text_highlight_minor: ['white']
+        text_highlight_minor: ['bright_white']
         action_default: ['bold', 'cyan']
         action: ['bold', 'cyan']
         # New Colors
@@ -130,16 +130,16 @@ ui:
         text_faint: ['faint']
         import_path: ['bold', 'blue']
         import_path_items: ['bold', 'blue']
-        added:   ['green']
-        removed: ['red']
-        changed: ['yellow']
+        added:   ['bright_green']
+        removed: ['bright_red']
+        changed: ['bright_yellow']
         added_highlight:   ['bold', 'green']
         removed_highlight: ['bold', 'red']
         changed_highlight: ['bold', 'yellow']
         text_diff_added:   ['bold', 'red']
         text_diff_removed: ['bold', 'red']
         text_diff_changed: ['bold', 'red']
-        action_description: ['white']
+        action_description: ['bright_white']
     import:
         indentation:
             match_header: 2

which leads to UI like:

image