How to do a full library export in JSON?

Hello,

First of all thank you to all the developpers and contributors of this great music application.
I’ve finally finish my full mp3 import with beets after many hours of work, so my library is now complete with all the lyrics and metada.

My next plan is now to integrate the beets library API with Elasticsearch as a search engine
(If the final result of this project is good, I will share it with the community if someone ask me).

For now, I just want to do a full export of my library with all the metada in JSON.

So, what is the simpliest way to do full export with the beet query ?(https://beets.readthedocs.io/en/stable/reference/query.html)

I tried with “beet export -o full_export.json &” , with the “path beet export path:/my/beets_library -o full_export.json &” beet export “artist:[a-z][A-Z]*” -o full_export.json &" , " beet export “:[a-z][A-Z]” -o full_export.json &" but if failed.

Can someone help me for the regex in order to match my whole library during the export query ?

Thanks,

Florian

Hi! I’m glad you’re enjoying beets so far!!

Can you explain a little more about what exactly failed? What went wrong with your original attempt, beet export -o full_export.json, for example? That should export everything.

Hello Adrian,

Thanks for your answer.

When I’m doing export -o full_export.json , I only have an empty json with [] on it.

So I’m making the export with the --path option like this ‘beet export path:/volume2/NAS/BEET_test/’ but I had the following errors

export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/D/David Bowie/Sound + Vision [Cd 3]/00 - David Bowie -.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/G/GRP All-Star Big Band/GRP All-Star Big Band/00 - GRP All-Star Big Band -.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/A/Ansarimusic.net/Play The Game/10 - Ansarimusic.net - Gutt Nagani.1.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/01 - Bob Dylan - She Belongs To Me.10.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/01 - Bob Dylan - She Belongs to Me.1.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/02 - Bob Dylan - Fourth Time Around.14.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/03 - Bob Dylan - Visions Of Johanna.6.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/03 - Bob Dylan - Visions of Johanna.7.flac’
export: cannot read file: [Errno 2] No such file or directory: “/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/04 - Bob Dylan - It’s All Over Now, Baby Blue.14.flac”
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/05 - Bob Dylan - Desolation Row.9.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/05 - Bob Dylan - Desolation Row (Incomplete).2.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/06 - Bob Dylan - Just Like a Woman.3.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/06 - Bob Dylan - Just Like A Woman.4.flac’
export: cannot read file: [Errno 2] No such file or directory: “/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/06 - Bob Dylan - I Don’t Believe You (She Acts Like We Never Have Met).1.flac”
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/07 - Bob Dylan - Mr. Tambourine Man.12.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/07 - Bob Dylan - Baby, Let Me Follow You Down.1.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/08 - Bob Dylan - Tell Me, Momma.2.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/01 - Bob Dylan - Tell Me, Momma.11.flac’
export: cannot read file: [Errno 2] No such file or directory: “/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/02 - Bob Dylan - I Don’t Believe You (She Acts Like We Never Have Met).11.flac”
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/03 - Bob Dylan - Baby, Let Me Follow You Down.12.flac’
export: cannot read file: [Errno 2] No such file or directory: “/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/04 - Bob Dylan - Just Like Tom Thumb’s Blues.11.flac”
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/05 - Bob Dylan - Leopard-Skin Pill-Box Hat.11.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/06 - Bob Dylan - One Too Many Mornings.10.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/07 - Bob Dylan - Ballad Of A Thin Man.5.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/07 - Bob Dylan - Ballad of a Thin Man.3.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/08 - Bob Dylan - Like A Rolling Stone.5.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/B/Bob Dylan/1966-04-13 Sydney, Australia/08 - Bob Dylan - Like a Rolling Stone.2.flac’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/C/Cat Stevens/ [5142]/02 - Cat Stevens - Dust in the wind.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/D/Django Reinhardt/00 - Django Reinhardt -.3.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/Compilations/Absolute Animals 1964-1968/11 See See Rider.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/E/Esmeralda/Notre Dame de Paris (minus)/05 - Esmeralda - Bohemienne.2.mp3’
llexport: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/J/Jose Feliciano/10 - Jose Feliciano - Amor Gitano.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/J/Jose Feliciano/16 - Jose Feliciano - Light My Fire.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/Compilations/Divers/00 I Want You [Radio Edit].2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/P/Peter Gabriel/Passion/15 - Peter Gabriel - Passion.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/P/Prince and The NPG/Prince and The NPG/01 - Prince and The NPG - Intro.2.mp3’
export: cannot read file: [Errno 2] No such file or directory: ‘/volume2/NAS/BEET_test/S/Status Quo/Best Of Rock 7/16 - Status Quo - Whatever you want.2.wma’
uncaught Mutagen exception in open:
export: cannot read file: ‘/volume2/NAS/BEET_test/Compilations/Come Together_ A Reggae Tribute to the Beatles/05 We Can Work It Out.mp3’:
uncaught Mutagen exception in open:
export: cannot read file: ‘/volume2/NAS/BEET_test/Compilations/Sessions - mixed by Josh Wink sub-conscious/26 Dusk (Live).mp3’:
uncaught Mutagen exception in open:
export: cannot read file: ‘/volume2/NAS/BEET_test/Compilations/Late Night Sessions/27 You Own My Mind.mp3’:
uncaught Mutagen exception in open:
export: cannot read file: ‘/volume2/NAS/BEET_test/Compilations/Sessions - mixed by Josh Wink sub-conscious/04 Back four.mp3’:
export: cannot read file: ‘/volume2/NAS/BEET_test/T/Tiesto/In Search of Sunrise 5_ Los Angeles/24 - Tiesto - Second Turn.m4a’
export: cannot read file: ‘/volume2/NAS/BEET_test/T/Tiesto/In Search of Sunrise 6_ Ibiza/21 - Tiesto - Fall to Pieces.m4a’
uncaught Mutagen exception in open:
error reading /volume2/NAS/BEET_test/Compilations/Ministry Of Sound Clubbers Guide 2011 Mixed by Jean Elan (DIGI0804)/15 Rave N Roll.mp3: ‘/volume2/NAS/BEET_test/Compilations/Ministry Of Sound Clubbers Guide 2011 Mixed by Jean Elan (DIGI0804)/15 Rave N Roll.mp3’:

So I did an update (beet update), but the export has still the same error and seems to be very small (only 2 Mo for a very large mp3 database).

Aha! Can you use beet export -l instead to export from your library?

Hello,
Thank you for you fast answer
I managed to do that with

beet update

in order to remove deleted file, and then the

beet export -l path:/my/beets_library -o full_export.json

worked !