Spotlight MDQueryMBS for all audio files

If I use the Spotlight examples in MBSPlugins, I can search for these types:

q = new MyQuery("kMDItemKind == 'Microsoft Excel Workbook (.xlsx)'")
q = new MyQuery("kMDItemKind == 'Microsoft Word*")
q = new MyQuery("kMDItemKind == 'Microsoft* (.docx)")
q = new MyQuery("kMDItemKind == 'Microsoft Word*")
q = new MyQuery("kMDItemKind == 'Kindl*'")

What is the parameter to find all audio files or file of these examples?

In Spotlight I can use this:
kind:audio (art:audio in German language)
kind:csv
kind:sql
kind:rtf
kind:rtf document with attachment
kind:powerpoint
kind:ebook
art:hörbuch
kind:sqlite database

I don’t want to search by file extension.

You may look for given attributes of a specific file via

mdls /PATH/TO/FILE

I called it for an .m4a file and got a kMDItemContentTypeTree with several entries for that file:

kMDItemContentTypeTree = (
    "com.apple.m4a-audio",
    "public.mpeg-4-audio",
    "public.audio",
    "public.audiovisual-content",
    "public.data",
    "public.item",
    "public.content"
)

Now I called in shell

mdfind " kMDItemContentTypeTree == public.audio" -onlyin ~

and got a list of all audio files in my HomeDir.

1 Like

q=new MyQuery("kMDItemContentTypeTree==""public.audio""")

and

q=New MyQuery("kMDItemKind==""MP3-Audio""")

both work for me.