The playlist plugin is not returning any results
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
### Problem
I upgraded to 2.12.0 recently and the playlist plugin no longer will return any results in queries. It was previously working on 2.5.0 and earlier with the same playlists and settings.
Running this command in verbose (`-vv`) mode:
```sh
$ beet -vv ls playlist:test-playlist.relativelocations -f '$path'
```
Led to this problem:
```
user configuration: /home/user/.config/beets/config.yaml
data directory: /home/user/.config/beets
plugin paths: []
Loading plugins: playlist
Sending event: pluginload
library database: /home/user/.config/beets/library.db
library directory: /home/user/Music
Sending event: library_opened
Parsed query: AndQuery([PlaylistQuery('path', [b'/home/user/Music/Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3', b'/home/user/Music/Billy Joel/Greatest Hits Volume I _and_ Volume II (1985)/01-10 Only the Good Die Young.flac', b"/home/user/Music/Cyndi Lauper/She's So Unusual (1983)/03 When You Were Mine.m4a", b'/home/user/Music/Bob Seger _and_ the Silver Bullet Band/Greatest Hits (1994)/07 Old Time Rock and Roll.m4a', b'/home/user/Music/Compilations/A Goofy Movie (1995)/01 Tevin Campbell feat. Rosie Gaines - I 2 I.m4a'], fast=True)])
Parsed sort: NullSort()
```
Here's a link to the music files that trigger the bug (if relevant):
### Setup
* OS: Fedora 44
* Python version: 3.14.5
* beets version: 2.12.0
* Turning off plugins made problem go away (yes/no): no
I've also tested this on another machine with the same results:
* OS: Debian 12 (Bookworm)
* Python version: 3.11.2
* beets version: 2.11.0
* Turning off plugins made problem go away (yes/no): no
My configuration (output of `beet config`) is:
```yaml
directory: /home/user/Music/
# --------------- Search ---------------
format_item: $artist - %if{$album,$album,None} - $title
format_album: $albumartist - $album
# --------------- Tagging ---------------
per_disc_numbering: no
original_date: yes
sort_album: albumartist+ year+ month+ day+ album+
sort_item: albumartist+ release_year+ release_month+ release_day+ album+ disc+ track+
# --------------- Plugins ---------------
plugins: playlist
asciify_paths: yes
format_raw_length: yes
import:
copy: no
incremental_skip_later: no
move: no
resume: ask
duplicate_action: keep
write: yes
paths:
comp:1: '%asciify{Compilations/$album%aunique{}%ifdef{album_pathname, ($album_pathname)}%ifdef{original_year, ($original_year)}/%if{$multidisc,$disc-}$track $artist - $title}'
default: '%if{$firstalbumartist,%the{$firstalbumartist},%the{$artist}}/%if{$single,Singles/,}$album%ifdef{album_pathname, ($album_pathname)}$extraalbumartists%ifdef{original_year, ($original_year)}%aunique{}/%if{$multidisc,$disc-}$track $title'
permissions:
file: 644
dir: 755
playlist:
relative_to: /home/user/Music/Playlists/
playlist_dir: /home/user/Music/Playlists/
auto: no
forward_slash: no
disabled_plugins: []
```
This is the .m3u file playlist file I'm using for testing (the playlist files are all in '/home/user/Music/Playlists/' so they're all prefixed with ../).:
```
../Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3
../Billy Joel/Greatest Hits Volume I _and_ Volume II (1985)/01-10 Only the Good Die Young.flac
../Cyndi Lauper/She's So Unusual (1983)/03 When You Were Mine.m4a
../Bob Seger _and_ the Silver Bullet Band/Greatest Hits (1994)/07 Old Time Rock and Roll.m4a
../Compilations/A Goofy Movie (1995)/01 Tevin Campbell feat. Rosie Gaines - I 2 I.m4a
```
I've also tried making it with absolute locations, with the same results:
```
/home/user/Music/Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3
/home/user/Music/Billy Joel/Greatest Hits Volume I _and_ Volume II (1985)/01-10 Only the Good Die Young.flac
/home/user/Music/Cyndi Lauper/She's So Unusual (1983)/03 When You Were Mine.m4a
/home/user/Music/Bob Seger _and_ the Silver Bullet Band/Greatest Hits (1994)/07 Old Time Rock and Roll.m4a
/home/user/Music/Compilations/A Goofy Movie (1995)/01 Tevin Campbell feat. Rosie Gaines - I 2 I.m4a
```
I've also tried no prefix and putting the same file in the root of the music library (and moving the playlist settings in config as such)
I've also tested every .m3u playlist in my library and none returned a single result.
It seems to be somewhere between the playlist plugin and the query to the library. The verbose output shows it's correctly fixing the relative locations of the playlist to the library location (`Parsed query: AndQuery([PlaylistQuery('path', [b'/home/user/Music/Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3',[...]`).
Running `beet ls path:"/home/user/Music/Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3"` does return the 1 result correctly:
````
user configuration: /home/user/.config/beets/config.yaml
data directory: /home/user/.config/beets
plugin paths: []
Loading plugins: playlist
Sending event: pluginload
library database: /home/user/.config/beets/library.db
library directory: /home/user/Music
Sending event: library_opened
Parsed query: AndQuery([PathQuery('path', b'Drake/Take Care (Deluxe) (2011)/16 HYFR (Hell Ya Fucking Right) (feat. Lil Wayne).mp3', fast=True, case_sensitive=True)])
Parsed sort: NullSort()
Drake feat. Lil Wayne - Take Care - HYFR (Hell Ya Fucking Right)
Sending event: cli_exit
````
Contributor guide
Research direction
Start at the playlist plugin entry point used by `beet ls playlist:test-playlist.relativelocations` and trace `PlaylistQuery` against the working `PathQuery` shown in the verbose output. Reproduce the issue with the supplied `.m3u` paths and configuration; done means the playlist query returns all five matching library tracks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100