Item objects are missing flexible attributes on reimports via file path
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
While working on PR https://github.com/beetbox/beets/pull/4474#-, I realised that an item on a reimport does not look the same when
- imported via file path
- imported via a beets query
Very rudimentary investigation revealed that the initialization of an Item object on a reimport via an already imported media file using its file path takes place here: https://github.com/beetbox/beets/blob/master/beets/library.py#L601-L608
No loading of flexible attributes from the database is done at this point and it's obvious that the Item will be missing some information that it actually already has saved in the beets library.
Should we consider this as a bug?
With above mentioned PR's new feature it is a problem, it is refered to in this post as "problem number 1": https://github.com/beetbox/beets/pull/4474#discussion_r1006443079
and somewhere earlier when it first came up as the second of the two bulletpoints at the bottom of this post: https://github.com/beetbox/beets/pull/4474#discussion_r1002661226
On a side note and as described in the subsequent post in the mentioned PR's conversation, an item that has such an attribute appplied to it's file tag _as well_ as to a flexible or fixed attribute, it will be initialized containing this field during a reimport, which kind of works around the problem. https://github.com/beetbox/beets/pull/4474#discussion_r1002915811
Contributor guide
Research direction
Start at the Item initialization code in beets/library.py around lines 601-608 and compare reimports by file path with reimports triggered by a beets query. Review the linked PR 4474 discussion for the flexible-attribute behavior; done means both reimport paths preserve the same attributes already stored in the beets library.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100