Reimporting singleton files to albums is not easily possible
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Already imported singleton files can't easily be retagged using the `import -L` option. A tedious second step via the imported file's path is required to achive that.
### Problem
If we look at these outputs:
```sh
$ beet ls crossfire firebolt
Crossfire - - 00 - Firebolt (0000/) [] f:MP3-192k a:04-02/Discogs |Heavy Metal, Rock, Drum And Bass, Speed Metal
Crossfire - Counterforce / Firebolt - 01 - Counterforce (2003/UK) [DSCI4 008] f:MP3-192kCBR a:04-02/Discogs |Heavy Metal, Rock, Drum And Bass, Speed Metal
$ beet ls crossfire firebolt singleton:true
Crossfire - - 00 - Firebolt (0000/) [] f:MP3-192k a:04-02/Discogs |Heavy Metal, Rock, Drum And Bass, Speed Metal
$ beet import -L crossfire firebolt singleton:true
$ beet import -L -t crossfire -s firebolt singleton:true
/remote/data/music-library/DrumnbassJungleDrumfunk/0-Album-Missing/Crossfire - Firebolt.mp3
Tagging track: Crossfire - Firebolt
(Similarity: 93.3%) (source) (Discogs)
[A]pply, More candidates, Skip, Use as-is, Enter search, enter Id, aBort,
plaY, eDit, edit Candidates?
```
We see the following problems if our goal is to reimport an already imported singleton item in album mode.
- The `-L` flag ignores the given query when the library items are singletons.
- If we provide the `-s` flag additionally we _do_ find the items in question, but a reimport jumps to the singleton import prompt right away. There is no way to switch back to album import mode at this point.
A tedious workaround is required to actually get the importer to show the regular album import mode on our singleton library items:
- `beet ls -p`
- Copy the path to the file
- and issue `beet import -t `
Of course commandline trickery in bash or zsh could be done to ease that tedious copying and pasting part but that turns out to be unsurprisingly different since we most probably have to deal with whitespace and escaping things in our file paths.
I'm wondering if `-L` ignoring singleton files is a bug or supposed to be a feature. Could this behaviour be changed or is there any technical reason why it is implemented that way?
### Setup
* OS: Manjaro current
* Python version: 3.10.8
* beets version: 1.6.1 git-master
* Turning off plugins made problem go away: no
My configuration (output of `beet config`) is:
```yaml
FIXME when required/requested
```
I reported about this behaviour in a longish thread a year ago already: https://github.com/beetbox/beets/discussions/4211
Contributor guide
Research direction
Reproduce the behavior with the reported `beet ls` and `beet import -L` commands, including the `-s` variant and the path-based workaround. Trace the importer entry points handling `-L`, singleton items, and album mode; done means an existing singleton can be selected by query and reimported through the regular album prompt without copying its path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100