adamjakab / BeetsPluginDescribe

A beets plugin for obsessive-compulsive music geeks to describe what's in their library.
MIT License
17 stars 2 forks source link

unknown fields cause error #2

Open adamjakab opened 4 years ago

adamjakab commented 4 years ago

when using an unknown attribute the plugin exits with backtrace:

(beetsdevel) jakabimac:BeetsPluginDescribe jackisback$ beet describe xyz
TYPE(xyz): <class 'beets.dbcore.types.String'>
┌────────────────┬───────────────────────────┐
│ Name           │                     Value │
╞════════════════╪═══════════════════════════╡
│ Field name     │                       xyz │
├────────────────┼───────────────────────────┤
│ Field type     │                      None │
├────────────────┼───────────────────────────┤
│ Auto type      │ beets.dbcore.types.String │
├────────────────┼───────────────────────────┤
│ Count          │                     21426 │
├────────────────┼───────────────────────────┤
│ Unique         │                         1 │
├────────────────┼───────────────────────────┤
│ Most frequent  │                   (21426) │
├────────────────┼───────────────────────────┤
│ Least frequent │                   (21426) │
├────────────────┼───────────────────────────┤
│ Empty          │                     21426 │
└────────────────┴───────────────────────────┘
describe: Unique element histogram
Traceback (most recent call last):
  File "/Users/jackisback/opt/miniconda3/envs/beetsdevel/bin/beet", line 8, in <module>
    sys.exit(main())
  File "/Users/jackisback/opt/miniconda3/envs/beetsdevel/lib/python3.7/site-packages/beets/ui/__init__.py", line 1266, in main
    _raw_main(args)
  File "/Users/jackisback/opt/miniconda3/envs/beetsdevel/lib/python3.7/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/Users/jackisback/Documents/Projects/Python/BeetsPluginDescribe/beetsplug/describe/command.py", line 64, in func
    self.handle_display()
  File "/Users/jackisback/Documents/Projects/Python/BeetsPluginDescribe/beetsplug/describe/command.py", line 78, in handle_display
    self.plot_field_data(data_desc)
  File "/Users/jackisback/Documents/Projects/Python/BeetsPluginDescribe/beetsplug/describe/command.py", line 130, in plot_field_data
    fig.barh(values, keys, force_ascii=False)
  File "/Users/jackisback/opt/miniconda3/envs/beetsdevel/lib/python3.7/site-packages/termplotlib/figure.py", line 60, in barh
    self._content.append(barh(*args, **kwargs))
  File "/Users/jackisback/opt/miniconda3/envs/beetsdevel/lib/python3.7/site-packages/termplotlib/barh.py", line 50, in barh
    out.append(fmt.format(*data))
ValueError: '=' alignment not allowed in string format specifier
adamjakab commented 4 years ago

there is no field name check whatsoever

adamjakab commented 3 months ago

Come on, this is just a sanity check against the beets fields... nobody up for a PR? ;)