beetbox / beets

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

list Exact Matches #4371

Open antonellocaroli opened 2 years ago

antonellocaroli commented 2 years ago

Problem

I'm trying to figure out how to use "exact matches" I only want the path to be displayed for the exact album name

ex. beet ls -f '$path' album:"Record"

/media/musica/Lossless4/Amon Tobin/Solid Steel Presents Amon Tobin_ Recorded Live/11. Interlude_ You's a Jaco Pastorius Looking Motherfucker.flac
/media/musica/Lossless4/John Abercrombie/Rarum XIV Selected Recordings/01 Timeless.flac
/media/musica/Lossless4/John Abercrombie/Rarum XIV Selected Recordings/02 Sorcery I.flac
/media/musica/Lossless4/John Abercrombie/Rarum XIV Selected Recordings/03 Avenue.flac
/media/musica/Lossless4/John Abercrombie/Rarum XIV Selected Recordings/04 Memoir.flac
.......
/media/musica/Lossless4/Zero 7/Record/1. Futures.flac
/media/musica/Lossless4/Zero 7/Record/2. I Have Seen.flac
/media/musica/Lossless4/Zero 7/Record/3. You’re My Flame.flac
/media/musica/Lossless4/Zero 7/Record/4. Destiny.flac

......

I am only interested in obtaining the Zero7 'Record' paths

So i try:

beet ls -f '$path' album:=Record

But this gives no results

beet -vv ls -f '$path' album:="Record"
user configuration: /home/filippo/.config/beets/config.yaml
data directory: /home/filippo/.config/beets
plugin paths: 
lastgenre: Loading canonicalization tree ~/.config/beets/genres/genres-tree.yaml
Sending event: pluginload
library database: /home/filippo/.config/beets/library.db
library directory: /home/filippo/Musica
Sending event: library_opened
Sending event: cli_exit

Record is the right name for the album:

beet info -l 'You’re My Flame' | awk '{$1=$1};1' | grep -E "^album:"
album: Record

Setup

My configuration (output of beet config) is:

plugins: play info acousticbrainz chroma lastgenre missing types
directory: /home/filippo/Musica/

import:
    copy: no
    write: no
    log: /home/filippo/.config/beets/import.log
    default_action: apply
    languages: en de it
play:
    command: gst-play-1.0 --gapless --audiosink='alsasink device=hw:CARD=DirettaAlsa,DEV=0'
    raw: yes
    use_folders: no
    relative_to:
    warning_threshold: 100
    bom: no
acoustid:
    apikey: REDACTED
chroma:
    auto: yes
acousticbrainz:
    auto: yes
    force: yes
    tags: []
lastgenre:
    auto: yes
    canonical: ~/.config/beets/genres/genres-tree.yaml
    whitelist: ~/.config/beets/genres/genres.txt
    count: 5
    fallback: Pop/Rock
    separator: '; '
    force: no
    min_weight: 10
    prefer_specific: no
    source: track
    title_case: yes
verbose: no

ui:
    color: yes
    colors:
        text_success: green
        text_warning: blue
        text_error: red
        text_highlight: blue
        text_highlight_minor: lightgray
        action_default: darkblue
        action: purple
hook:
    hooks:
    -   event: album_imported
        command: echo "\"{album}\""
    -   event: import
        command: echo "imported from {paths}"
    -   event: art_set
        command: echo "Coverart saved"
    -   event: import_begin
        command: echo "GP import started..."
    -   event: import_task_apply
        command: echo "Metadata applied"
    -   event: item_copied
        command: echo "\"{item}\" copied from \"{source}\" to \"{destination}\""
    -   event: item_moved
        command: echo "Moved \"{item}\""
    -   event: write
        command: echo "Writing to {path}"
    -   event: cli_exit
        command: echo "All tasks finished!"
missing:
    count: no
    total: no
    album: no
arsaboo commented 2 years ago

beet ls -f '$path' album:"Zero 7" should work.

album:"Record" will return all tracks with Record in album name.

antonellocaroli commented 2 years ago

But I need the paths to the album Record, Zero 7 is the artist...

Exact Matches should do this...

beet ls -f '$path' album:="Record"

It should give me the ifle patches belonging to the 'Record' album and only those

https://beets.readthedocs.io/en/latest/reference/query.html#exact-matches

arsaboo commented 2 years ago

You can add another field:

beet ls -f '$path' artist:"Zero 7" album:"Record"

arsaboo commented 2 years ago

also, try :~ instead of :=. I had some issues with :=

antonellocaroli commented 2 years ago

clearly beet ls -f '$path' artist:"Zero 7" album:"Record" gives me the result I am looking for.

But it is not the function I am interested in, but I am interested in getting that result with the album name only

I also tried :~ but does not give the result as :=

So the question is whether exact-matches works or not, or in which cases does it not work?

Galicarnax commented 7 months ago

I also have issues with exact queries (field:=term). They never return anything. I found that such queries are mentioned in the docs for latest, but absent for stable (though, using Arch Linux, I would expect that my version is latest, but I am not sure). beets version 1.6.0.