beetbox / beets

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

The computed `albumtotal` field should have numeric type #2693

Open Sjlver opened 6 years ago

Sjlver commented 6 years ago

Problem

When using albumtotal in a query, numeric ranges are not supported:

$ beet list -a -f '$album: $albumtotal' albumtotal:26 Petra
The Praise Collection: 26

$ beet list -a -f '$album: $albumtotal' albumtotal:23..28 Petra
(no output)

I would expect these two commands to give the same result.

Setup

beets version 1.4.5 Python version 3.6.2 plugins: discogs, duplicates, embedart, fetchart, lastgenre, lyrics, missing, web

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    sources: [google, lyricwiki, musixmatch]
directory: ~/Music/beet
library: ~/Music/beet.db

plugins:
- discogs
- duplicates
- embedart
- fetchart
- lastgenre
- lyrics
- missing
- web
web:
    host: 127.0.0.1
    port: 8337
    cors: ''
    reverse_proxy: no
    include_paths: no
duplicates:
    album: no
    checksum: ''
    copy: ''
    count: no
    delete: no
    format: ''
    full: no
    keys: []
    merge: no
    move: ''
    path: no
    tiebreak: {}
    strict: no
    tag: ''
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
missing:
    count: no
    total: no
    album: no
fetchart:
    auto: yes
    minwidth: 0
    maxwidth: 0
    enforce_ratio: no
    cautious: no
    cover_names:
    - cover
    - front
    - art
    - album
    - folder
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    store_source: no
embedart:
    maxwidth: 0
    auto: yes
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
lastgenre:
    whitelist: yes
    min_weight: 10
    count: 1
    fallback:
    canonical: no
    source: album
    force: yes
    auto: yes
    separator: ', '
    prefer_specific: no
sampsyo commented 6 years ago

Thanks! Indeed; even though it's a built-in computed field, we don't declare a type for it yet to enable numeric queries.

In the mean time, you can use the types plugin to tell beets to treat that field as a number.

Sjlver commented 6 years ago

Just tried it with the types plugin. Works! Thanks... I've rarely had such a timely and excellent response from a developer :)

Kraymer commented 6 years ago

I've rarely had such a timely and excellent response from a developer :)

Well ... a whopping 5 minutes timeframe did elapse between the question and his answer. You bet he had time to write a thorough answer! Nah more seriously @Sjlver you better get used to it, it's pretty much the norm with @sampsyo :medal_military: