How to list all hires FLACs in collection?

I’m trying to list all my hires FLACs in my collection. Since hires FLACs seem to always be 24bit I tried the following:

beet ls -af '$bitdepth/$my_samplerate $albumartist - $album' format:FLAC bitdepth:24

To get an easily readable output like this:

24/48 alt-J - An Awesome Wave

But it doesn’t work. What am I missing?
I use the following inline plugin settings in config:

# Inline plugin template
item_fields:
  multidisc: 1 if disctotal > 1 else 0
  my_samplerate: round(samplerate / 1000)
  is_flac: 1 if format == "FLAC" else 0
album_fields:  
  format: |
       formatList = []
       for item in items:
           formatList.append(item.format)
       return formatList
  av_bitrate: |
       total = 0
       for item in items:
           total += item.bitrate
       return round(total / len(items) / 1000)

Under Types (in my config) I’ve set

    av_bitrate: int
    my_samplerate: int
    bitdepth: int

Hi! One problem here is that you’re querying albums (-a), but $bitdepth is a track-level field (and not an album-level field). You could consider playing the same trick as with $format to get an album-level version.

Thanks for pointing me in the right direction @adrian.

The solution I found is as follows…
I added two album level fields in the inline plugin section of my config:
album_bitdepth and album_samplerate

# Inline plugin template
item_fields:
  multidisc: 1 if disctotal > 1 else 0
  my_samplerate: round(samplerate / 1000)
  is_flac: 1 if format == "FLAC" else 0
album_fields:  
  format: |
       formatList = []
       for item in items:
           formatList.append(item.format)
       return formatList
  av_bitrate: |
       total = 0
       for item in items:
           total += item.bitrate
       return round(total / len(items) / 1000)
  album_bitdepth:  |
       total = 0
       for item in items:
           total += item.bitdepth
       return round(total / len(items))
  album_samplerate:  |
       total = 0
       for item in items:
           total += item.samplerate
       return round(total / len(items) / 1000)

And my query as follows:

beet ls -af '$album_bitdepth/$album_samplerate $albumartist - $album ($original_year)' format:flac album_bitdepth:24..

This gives me a listing like this:

24/96  Frank Zappa & The Mothers of Invention - At Fillmore East (2011)
24/96  The Allman Brothers Band - At Fillmore East (2011)
24/96  alt-J - An Awesome Wave (2012)
24/44  alt-J - Relaxer (2017)
24/44  alt-J - This Is All Yours (2014)
24/44  Aphex Twin - Computer Controlled Acoustic Instruments, Part 2 (2015)
24/44  Fiona Apple - The Idler Wheel Is Wiser Than the Driver of the Screw and Whipping Cords Will Serve You More Than Ropes Will Ever Do (2012)
24/44  Ólafur Arnalds - For Now I Am Winter (2013)

:slight_smile:

1 Like