Moode Forum

Full Version: Is there a way of editing the MPD database direct?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

For a long boring reason which I won't go into here I can't store my library in the traditional folder structure. I instead have it as a list of files in one folder. The format is Artist - Title.wav

I can see the few files that have embedded metadata are picked up fine  - for the same boring reason above I can't actually have embedded metadata either and am slowly removing the tracks that do, so that's not a route forwards for me either.

MPD scan doesn't parse the filename in absence of any other metadata, and I end up with a load of entries that have the title as the filename and artist field as "song file". 

Editing individual entries will be arduous, the library numbers 18,000 tracks, and I already have comprehensive metadata stored elsewhere.  So to avoid repeating all the work I've put in over the years I'd like to simply import this existing metadata into MPD's database directly via the usual methods, either direct writing, csv import or whatever.  

The issue here is the lack of information about MPD's database, what format it is, how to see and edit the database direct.  I realise the risks of this but as my metadata is securely stored and backed up by a pretty substantial metadata editing system I'm less worried about breaking the MPD side of things as I can delete and start from scratch.

Thanks in advance for any advice.

Simon
I don't know if the schema and format of the MPD database is published. You might want to ask the maintainer. https://github.com/MusicPlayerDaemon/MPD/issues

-Tim
(08-18-2019, 02:57 PM)shardwick Wrote: [ -> ].... the library numbers 18,000 tracks, and I already have comprehensive metadata stored elsewhere.  So to avoid repeating all the work I've put in over the years I'd like to simply import this existing metadata into MPD's database directly via the usual methods, either direct writing, csv import or whatever.  

The issue here is the lack of information about MPD's database, what format it is, how to see and edit the database direct.  I

You are missing the mpd's format on how it stores the metadata. But we also miss the way your metadata is stored. How is that done? I'm sure you can find some software that converts your metadata into some other format....
J
(08-18-2019, 10:41 PM)JST1963 Wrote: [ -> ]
(08-18-2019, 02:57 PM)shardwick Wrote: [ -> ].... the library numbers 18,000 tracks, and I already have comprehensive metadata stored elsewhere.  So to avoid repeating all the work I've put in over the years I'd like to simply import this existing metadata into MPD's database directly via the usual methods, either direct writing, csv import or whatever.  

The issue here is the lack of information about MPD's database, what format it is, how to see and edit the database direct.  I

You are missing the mpd's format on how it stores the metadata. But we also miss the way your metadata is stored. How is that done? I'm sure you can find some software that converts your metadata into some other format....
J

The software I use for library management is very specific to the radio industry. I need to keep it that way as that's what I do on a daily basis, programme music for radio stations. I can't change that as it would mean changing the way I work. I also can't change the file structure either for that reason.

I can get all manner of metadata, and export it as CSV. That's trivial. All fields I have stored are available for export. I could knock up a script that imports it too, I've done that for other software platforms and got a nice workflow going. The stumbling block is lack of info regarding MPD's format or how to get it there!

If anyone else has any suggestions they'd be gratefully received, in the meantime I'll follow Tim's suggestion to get in touch with the MPD developers.

This is just for home listening really so not an urgent thing and I'm not sitting in silence as I've managed write an import script for playlists which will play fine, albeit with no metadata.

My listening setup is Raspberry Pi Zero -> USB -> Emotiva PT100 Pre-amp -> Quad 240 Power Amp -> Tannoy Series 6 Speakers.  I control it using my iphone - the recent updates to improve responsiveness on pi zero are very much welcome!

Cheers all,

Simon
@shardwick

Wow, radio has come a long way in the half century since I was my college radio station's chief engineer---small Collins console flanked by heavy turntables, a storage room walled with shelves groaning under the 20 years accumulation of LPs, and a badly maintained set of 3x5 index cards. Oh, yeah, and a couple of luggable reel-to-reel tape recorders 'cuz we had the job of taping live performances at the college.

I've never been able to find a description of the MPD "database". The API index has a smattering of entries under data structures but this index is generated from the code and the code is sparsely commented.
 
You can reach out to the MPD maintainer, Max Kellerman, through forum.mpd.org. Candidly, I'm not sure his position has changed since 2015 when he wrote there in response to a database question, "The database for storing music metadata is custom. Do not read the file. Use the MPD protocol to query it." Perhaps if you lead with your radio work you'll get a more sympathetic response.

The source code for MPD is held on github with principal database routines under https://github.com/MusicPlayerDaemon/MPD...ter/src/db 
If you're a C++ boffin you might be able to deduce the database structure. I tried once but quickly backed away before my brain exploded Tongue

Good luck.

Regards,
Kent
(08-19-2019, 12:12 PM)TheOldPresbyope Wrote: [ -> ]@shardwick

Wow, radio has come a long way in the half century since I was my college radio station's chief engineer---small Collins console flanked by heavy turntables, a storage room walled with shelves groaning under the 20 years accumulation of LPs, and a badly maintained set of 3x5 index cards. Oh, yeah, and a couple of luggable reel-to-reel tape recorders 'cuz we had the job of taping live performances at the college.

Hi Kent, It certainly has.  I recognise the picture you paint but when I started my career in the mid 90s I literally just missed the last analogue editing methods, reel-to-reel tape and razor blades were just being retired. 

I learnt basic editing using a minidisc deck (divide and conquer method!) and very shortly computer based editing started to appear, Sadie, Pro-tools and Cool Edit Pro being the most common, which made the process a whole lot easier! I still have CD players and cart machines, once the bastion of the radio studio and once worth many thousands of pounds, now simply gathering dust in lofts and sheds of radio employees (myself included) who don't quite have the heart to throw them away!  Nowadays you can run an entire radio station on a raspberry pi (at a push!) but most professional outfits still use high end server PCs for reliability. Engineers need to be IT minded as everything is migrating to IP, even the consoles!


Quote:I've never been able to find a description of the MPD "database". The API index has a smattering of entries under data structures but this index is generated from the code and the code is sparsely commented.
 
You can reach out to the MPD maintainer, Max Kellerman, through forum.mpd.org. Candidly, I'm not sure his position has changed since 2015 when he wrote there in response to a database question, "The database for storing music metadata is custom. Do not read the file. Use the MPD protocol to query it." Perhaps if you lead with your radio work you'll get a more sympathetic response.

The source code for MPD is held on github with principal database routines under https://github.com/MusicPlayerDaemon/MPD...ter/src/db 
If you're a C++ boffin you might be able to deduce the database structure. I tried once but quickly backed away before my brain exploded Tongue 

Thanks for the info. Sadly I'm not a C++ boffin but I'll have a poke around the code you link to in case it makes sense.  I guess if the scanning code is there, something could be written to modify that to take the info from CSV rather than reading files in a folder.  If any C++ boffins are reading I'd be happy to throw some money at this so do get in touch!

Cheers

s
@shardwick

Ah, so you missed out on the thrill of discovering that your DIY demagnetizer had blown a fuse, the rapidly collapsing magnetic field had actually magnetized the razor blade you thought you were making sure was demagnetized, and the last splice you'd so lovingly made produced a ugly "pop" when you ran it across the tape deck's playback head. Argh...


MPD is an engine with many moving parts. The routines which deal with file container formats, codecs, and metadata are in src directories separate from src/db. Good hunting.

Regards,
Kent