beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.72k stars 1.81k forks source link

Queries that consist only of paths should be joined by Boolean "or" #2009

Open bartkl opened 8 years ago

bartkl commented 8 years ago

beet rm -d supports only removal of one album at the time when passing dirpaths

Running this command in verbose (-vv) mode:

$ cd /volume1/music/beets
$ beet -vv rm -d Bert\ Jansch/ Shirley\ Collins\ \&\ The\ Albion\ Band/

Led to this problem:

user configuration: /var/services/homes/bart/.config/beets/config.yaml
data directory: /var/services/homes/bart/.config/beets
plugin paths: 
Sending event: pluginload
library database: /var/services/homes/bart/.config/beets/library.blb
library directory: /volume1/music/beets
Sending event: library_opened
error: No matching items found.

Passing a single path argument works just fine:

NastyNAS> beet -vv rm -d Shirley\ Collins\ \&\ The\ Albion\ Band/

Result:

user configuration: /var/services/homes/bart/.config/beets/config.yaml
data directory: /var/services/homes/bart/.config/beets
plugin paths: 
Sending event: pluginload
library database: /var/services/homes/bart/.config/beets/library.blb
library directory: /volume1/music/beets
Sending event: library_opened

/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/01 - Claudy Banks.flac - Claudy Banks
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/02 - The Little Gypsy Girl.flac - The Little Gypsy Girl
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/03 - Banks of the Bann.flac - Banks of the Bann
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/04 - Murder of Maria Marten.flac - Murder of Maria Marten
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/05 - Van Dieman's Land.flac - Van Dieman's Land
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/06 - Just as the Tide Was A'Flowing.flac - Just as the Tide Was A'Flowing
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/07 - The White Hare.flac - The White Hare
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/08 - Hal-An-Tow.flac - Hal-An-Tow
/volume1/music/beets/Shirley Collins & The Albion Band/1971 - No Roses/09 - Poor Murdered Woman.flac - Poor Murdered Woman
Really DELETE 9 files (y/n)? 

Would come in handy if this got fixed, since sometimes good ol' bash globbing and TAB completion beats querying in terms of ease of use.

Thanks!

Setup

My configuration (output of beet config) is:

directory: /volume1/music/beets
library: ~/.config/beets/library.blb
original_date: yes
per_disc_numbering: no
art_filename: folder
va_name: 'Various Artists'

import:
    copy: yes
    write: true
    resume: true
    quiet_fallback: skip
    log: /var/log/beets/beets.log

match:
    strong_rec_thresh: 0.96

paths:
    default: $albumartist/$year - %title{$album %aunique{albumartist album year, albumtype label catalognum albumdisambig}}/$track - $title
    singleton: __Loose Songs__/$artist - $title
    comp: __Various Artists__/$year - %title{$album %aunique{album year, label catalognum albumdisambig}}/$track - $artist - $title
sampsyo commented 8 years ago

This is actually true of all beets queries -- it's not specific to the remove command. Here's what's going on: beets queries are joined by a boolean "AND" by default, so you can type stuff like this:

beet ls beatles white

to quickly get at the White Album. Then, as a convenience, beets will automatically detect path query components, so typing this:

beet ls /foo/bar

is equivalent to typing:

beet ls path:/foo/bar

but faster.

Put both of these together, and the query you ran finds albums that are located in path A and in path B, which is of course nothing.

I'm not exactly sure what the right resolution here. We could say, for example, that the idea behind the "automatic path query" deal is to emulate ordinary path-based CLIs. Then it would be logical to add a special rule that, if all of a query's components are paths, join them with boolean "or" instead by default. Would that make sense to you?

bartkl commented 8 years ago

Sounds like a perfect solution to me!

Thanks On May 24, 2016 7:20 PM, "Adrian Sampson" notifications@github.com wrote:

This is actually true of all beets queries -- it's not specific to the remove command. Here's what's going on: beets queries are joined by a boolean "AND" by default, so you can type stuff like this:

beet ls beatles white

to quickly get at the White Album. Then, as a convenience, beets will automatically detect path query components, so typing this:

beet ls /foo/bar

is equivalent to typing:

beet ls path:/foo/bar

but faster.

Put both of these together, and the query you ran finds albums that are located in path A and in path B, which is of course nothing.

I'm not exactly sure what the right resolution here. We could say, for example, that the idea behind the "automatic path query" deal is to emulate ordinary path-based CLIs. Then it would be logical to add a special rule that, if all of a query's components are paths, join them with boolean "or" instead by default. Would that make sense to you?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/beetbox/beets/issues/2009#issuecomment-221340484

sampsyo commented 8 years ago

Cool! Changed the title to reflect that intent.