beets icon indicating copy to clipboard operation
beets copied to clipboard

[BUG] conflict between import set_fields configuration and convert plugin

Open J4gQBqqR opened this issue 1 year ago • 7 comments

When the convert plugin is set to "auto: yes" and the import configuration has set_fields activated, the program will report error:

Traceback (most recent call last):
  File "/usr/bin/beet", line 33, in <module>
    sys.exit(load_entry_point('beets==1.6.0', 'console_scripts', 'beet')())
  File "/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1285, in main
    _raw_main(args)
  File "/usr/lib/python3.10/site-packages/beets/ui/__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "/usr/lib/python3.10/site-packages/beets/ui/commands.py", line 943, in import_files
    session.run()
  File "/usr/lib/python3.10/site-packages/beets/importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "/usr/lib/python3.10/site-packages/beets/util/pipeline.py", line 193, in coro
    func(*(args + (task,)))
  File "/usr/lib/python3.10/site-packages/beets/importer.py", line 1500, in import_asis
    apply_choice(session, task)
  File "/usr/lib/python3.10/site-packages/beets/importer.py", line 1523, in apply_choice
    task.set_fields(session.lib)
  File "/usr/lib/python3.10/site-packages/beets/importer.py", line 593, in set_fields
    self.album.store()
  File "/usr/lib/python3.10/site-packages/beets/library.py", line 1335, in store
    super().store(fields)
  File "/usr/lib/python3.10/site-packages/beets/library.py", line 344, in store
    super().store(fields)
  File "/usr/lib/python3.10/site-packages/beets/dbcore/db.py", line 534, in store
    tx.mutate(
  File "/usr/lib/python3.10/site-packages/beets/dbcore/db.py", line 866, in mutate
    cursor = self.db._connection().execute(statement, subvals)
sqlite3.InterfaceError: Error binding parameter 2 - probably unsupported type.

Config file that generate this error:

convert:
  auto: yes
  quiet: yes
  threads: 5
  hardlink: true
  tmpdir: /home/media/tmp
  dest: /home/media/music/newage
  album_art_maxwidth: 3000
  no_convert:
    format: opus
  format: opus
  formats:
    opus:
      command: ffmpeg -i $source -y -vn -acodec libopus -ab 128k $dest
      extension: opus

import:
  write: yes
  copy: no
  move: yes
  hardlink: yes
  resume: ask
  incremental: no
  incremental_skip_later: no
  autotag: no
  default_action: apply
  quiet: yes
  quiet_fallback: asis
  none_rec_action: asis
  timid: no
  log: /home/media/config/beets/newage/beet.log
  bell: yes
  from_scratch: yes
  set_fields:
    albumtypes: {}
    comments: {}
    genre: 'New Age'

J4gQBqqR avatar Dec 16 '22 13:12 J4gQBqqR

Hi! Thanks for the report! This looks annoying. I notice that not all of the values in this mapping are strings:

  set_fields:
    albumtypes: {}
    comments: {}
    genre: 'New Age'

Can you try setting these all to strings to see if the problem goes away?

sampsyo avatar Dec 17 '22 02:12 sampsyo

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 21 '23 12:05 stale[bot]

I have seen this problem too and will try what @sampsyo commented.

JOJ0 avatar May 24 '23 07:05 JOJ0

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '23 01:08 stale[bot]

Oh I wanted to try this...

JOJ0 avatar Aug 12 '23 16:08 JOJ0

Hi, I can confirm that this is still not working. I am using Arch and installed the latest AUR beets-git version. BTW, I currently have only one string in my set_fields:

  set_fields:
    genre: 'New Age'

J4gQBqqR avatar Jan 14 '24 19:01 J4gQBqqR

@J4gQBqqR try setting that field to string using the types plugin as sampsyo suggested https://github.com/beetbox/beets/issues/4589#issuecomment-1355955912

https://beets.readthedocs.io/en/latest/plugins/types.html

not sure if that helps, I guess genre, since it is a fixed lib field, is string type already...

or is it not genre but a user defined aka flexible field?

JOJ0 avatar Jan 14 '24 21:01 JOJ0