You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ beet ls -a -f '$album_id $album'
$album_id foobar
1 foobar
And beets raises a ValueError when I try beet ls -a -p:
$ beet ls -a -p
/home/odoublewen/mp3/foobar/foobar
Traceback (most recent call last):
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/util/functemplate.py", line 557, in substitute
res = self.compiled(values, functions)
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/util/functemplate.py", line 581, in wrapper_func
args[VARIABLE_PREFIX + varname] = values[varname]
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/dbcore/db.py", line 108, in __getitem__
return self._get_formatted(self.model, key)
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/dbcore/db.py", line 131, in _get_formatted
value = model._type(key).format(model.get(key))
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/dbcore/db.py", line 456, in _get
return getters[key](self)
File "/home/odoublewen/beets2/lib/python3.9/site-packages/beets/library.py", line 1409, in item_dir
raise ValueError("empty album for album id %d" % self.id)
ValueError: empty album for album id 2
Examine beets database
Notice that beets created an album with id=2, but set the album_id attribute to 1. Maybe this is problematic because the album with album_id=2 is "orphaned" -- it has no items in it. I had hoped, or assumed, that using --set to set the album_id to an existing album would cause beet to not create a new album_id.
$ sqlite3 .config/beets/library.db
SQLite version 3.34.1 2021-01-20 14:10:07
Enter ".help" for usage hints.
sqlite> .headers on
sqlite> select id, album from albums;
id|album
1|foobar
2|foobar
sqlite> select * from album_attributes;
id|entity_id|key|value
1|2|album_id|1
But I also notice that beets did assign the bar.mp3 file to album_id=1 -- so that part seems good.
Using the
beet import --set
option to setalbum_id
results in corrupted beets db due to "orphaned" album record.Cross references:
Problem
Here is a reproducible toy example:
Create two dummy mp3 files and add minimal id3 tags
Start from a fresh, minimal beet 2.1.0 config:
Import the dummy mp3 files
--set
to assign the album_id of the second mp3 file.As shown in the
beet ls
command, it seemed to do the right thing:But look at the weird results from
beet ls -a
:And beets raises a
ValueError
when I trybeet ls -a -p
:Examine beets database
Notice that beets created an album with id=2, but set the album_id attribute to 1. Maybe this is problematic because the album with album_id=2 is "orphaned" -- it has no items in it. I had hoped, or assumed, that using
--set
to set the album_id to an existing album would cause beet to not create a new album_id.But I also notice that beets did assign the
bar.mp3
file to album_id=1 -- so that part seems good.Setup
My configuration (output of
beet config
) is:The text was updated successfully, but these errors were encountered: