getmusicbee.com

Support => Questions => Topic started by: theG on March 03, 2018, 04:44:50 PM

Title: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: theG on March 03, 2018, 04:44:50 PM
Hello!

I have a FLAC collection and a MP3 one which is just a mirror of the FLAC one, and I’m looking for a way to change the files base paths and extensions in my FLAC library so I won’t lose play counts and all that. I’d like to use my MP3 collection instead of the FLAC one since they’re both on a mapped drive and it will take less bandwidth.

Doing a find & replace in MusicBeeLibrary.mbl to point to the MP3 files would have been pretty easy, if the MusicBee library was in plain text, XML, or something like that, but it’s not. Is there an easy way around this? Or some text editor other than Notepad I could use to do the find & replace without messing everything up?
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: frankz on March 03, 2018, 05:09:09 PM
Unfortunately, no.  The library is not in editable format, and remapping would only look for the same files in the same format in a different location.

This brings up something I've been considering lately.

The way we think of our music libraries - each file being its own entity - is sadly still very much rooted in 1999, when there was one digital audio file type to choose from.  Later, when storage got cheaper and FLAC became a viable way to archive music digitally, auto-convert became the default way to make those archived files portable on players.  Then storage got even cheaper and a lot of us started keeping copies of each track in two or three formats for different situations, but the music library community never adapted to this new situation.

I've been working on a long-term "Wishlist" type request (really, more a concept request than a feature request) to switch to a "song" or "track" based library, where each track is its own entity that can point to multiple file versions, which can be selected based on situation.  This is the way Calibre handles an ebook library.  Each edition of a book is an entity that can hold multiple versions.  On certain devices I can have mobi.  On other devices I can have epub.  On other devices I can have pdf.  But the metadata and history of the book is the same across all of these files irrespective of where I look at it.

I'm fleshing it out, but it would solve a lot of problems like this and others that crop up here.  You'd be able to hit a setting on the player that says "play only lossy files from this playlist" or "play a hybrid of lossless and lossy only when lossless is not available" or "play only native lossless songs."

Basically we should have a library of songs, not a library of unconnected files.  The library should know that 01. A Hard Days Night (Mono).flac and 01. A Hard Days Night (Mono).mp3 are the same thing and play the one appropriate to the current situation as selected by the user's criteria.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: theG on March 03, 2018, 05:56:52 PM
I totally agree. There are many reasons why would want to be able to switch format in one click. One would one a specific format depending on the audio selected for instance. FLAC is a bit overkill for small PC desktop speakers so MP3 could be used there, while selecting a different output with high-end audio equipment connected to it could use the FLAC version of the files.

As for me, I’d choose FLAC if the folder was pointing to a USB drive, and MP3 if it’s a mapped drive. I’d probably get rid of many problems while listening to music depending on the network load because right now my FLAC files are on a NAS and I have to keep using that library because of all the library statistics that built up with the years. I don’t want to lose that just because I want to change format.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: frankz on March 04, 2018, 02:15:44 PM
Believe it or not, your situation crossed my mind this morning and I thought of a hack-like solution that might work for you (provided all of your FLAC files are truly mirrored with files in the mp3 library and all of them are organized the exact same way in both).  If things like embedded lyrics are important to you, you should probably make sure that tags of that nature in your mp3 files match any tags like this in your FLAC files.

0. Make sure you have the most recent MusicBee patches installed
1. Edit->Preferences->Library->Export the library as an iTunes formatted XML file
2. Close and open MusicBee to make sure the XML file is generated
3. Open the XML file in a good text editor (I use Notepad++ for this type of thing)
4. CTRL+H -> Find what: .FLAC / Replace with: .mp3  Make sure it's not case sensitive so that you'll catch .flac too.  Do the replacement, save, and close.
5. In MusicBee, File->Library->Create New Library.  Go through all the necessary steps.
6. In the new library, File->Library->Import->Import from iTunes
7. Handling -> Doesn't matter because you have no files in your library / destination -> probably "Add to Library" is easier but also doesn't really matter.  Click "Locate iTunes" and find your edited XML file. Click "Proceed"
8. Wait / Fret
9. If you did "Inbox" in 7, add the files to the library. Your library should now be a mirror of your old library with only the file extensions changed from .FLAC to .mp3.  Because nothing is this easy, continue.
10.Tools->Tagging Tools->Other 'Files to Edit' Filters->Show Dead Links.  Correct any you find.
11. Tools->Advanced->Rescan all files.  This will correct things that are now incorrect, like "Encoder" tags and the like.  This will also destroy any tags that were present in your FLACs but are not present in your mp3s, like embedded lyrics.  
12. Tools->Locate Missing Files... Just to be thorough
13. I'm not sure how MB handles external playlists.  If you have external playlists that don't get updated in MB, you may need to edit them individually outside MB in the same Notepad++ manner.
14. It's not lucky to end on 13, so listen and enjoy!

I think that's it.  You'll probably need to rescan all of them for volume correction if you need that. 

The good thing is that it's not destructive. If you reopen your old library, it's all still there.  If something is screwed up, you can delete the new "mp3" version of the library, open the FLAC version, regenerate the XML file, and try again.

Let me know how this works. If someone sees an error above, let me know and I can correct it above and note the edit below for future reference.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: theG on March 04, 2018, 11:31:27 PM
Good idea.
My MP3 collection is indeed an exact copy of the FLAC one. I’m really OCD about it and I can’t stand having a single file different from the other collection, so no problem there.
It’s been importing files for about 6 hours now, with over 169,000 audio files it should still take some time. I should have edited the XML file to keep just a few to test before importing the whole thing but oh well.

I’m not worried for the playlist. The smart ones should work without any fiddling while the regular ones will only need some find & replace

I will report back once I’m done.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: theG on March 08, 2018, 01:09:03 AM
The first run didn’t work because Windows 10 thought it would be a good idea to do an update and reboot. That was after about 28 hours of scanning and there was literally only 7 to 10 minutes left when that happened.
I was scanning a network drive, that’s why it took so long. So for the second try I played with the shares and drive letters to scan my MP3 backup (External drive) instead of the network drive. It was a lot faster obviously.

ANYWAY, it worked, all the files are there with the correct play counts and whatnot.

For future reference I would add this extra step once all the above is done:
Select the Music node in the Navigator panel then go to menu, Tools -> Tagging Tools -> Show Files with Missing Tags. Right click on the Fields bar and "Set Display Fields.." Drag .Ext from "Other Fields" to "Selected Fields" and close the window. Click on the .Ext column to sort by extensions, select the FLAC ones (in my case), right click and "Delete". Delete from Library only, "Yes". Done.


All my MP3 files show in that section even tho they were scanned and added to the library. Maybe I’m missing something in the settings to have all of them showing there but it’s no biggie. I looked at my FLAC library and the sames happens: they all show as files with missing tags. Maybe there are some settings I haven’t seen where you define what tag is considered a missing one but I don’t recall seeing it anywhere.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: Shepherd Jim on April 11, 2018, 04:33:11 PM
.....Basically we should have a library of songs, not a library of unconnected files. The library should know that 01. A Hard Days Night (Mono).flac and 01. A Hard Days Night (Mono).mp3 are the same thing and play the one appropriate to the current situation as selected by the user's criteria.

Hey frankz, you are getting into the "philosophical aspects" of musical organization. Believe me, I am not raising any criticism. You've dug right down to the roots of "library definition"; how the different tables in a database will relate to one another based on the individual's needs and intents.

Most (all?) of music organization software (e.g. MB, iTunes) is based on the physical distribution model: albums, records. In most most people's minds the songs in their collection "go back" to how they acquired them.

Your model with "the song" being the basis would seem to best fit let's say a musician. The musician might look at his library for inspiration; wanting to quickly access a song as recorded by a number of artists — which album the song came from being of no interest.
Title: Re: Changing files paths and extensions in MusicBeeLibrary.mbl
Post by: frankz on April 11, 2018, 06:01:39 PM
Your model with "the song" being the basis would seem to best fit let's say a musician. The musician might look at his library for inspiration; wanting to quickly access a song as recorded by a number of artists — which album the song came from being of no interest.
No, that's not what I mean at all.  In place of "song" think "specific release, mastering, edit"

Take this example..

The Beatles Song "Come Together," original mix, from Abbey Road

Issued on LP in 1969
Issued on CD in 1987
Issued remastered on CD in 2009

Right Now I have
01 - Come Together [Abbey Rd 1969 Vinyl].flac
01 - Come Together [Abbey Rd 1969 Vinyl].mp3
01 - Come Together [1987 CD].flac
01 - Come Together [1987 CD].mp3
01 - Come Together [2009 Remastered].flac
01 - Come Together [2009 Remastered].mp3

all as separate entries in my (imaginary, because I don't use the flacs right now as its inconvenient) library.

It would be much more logical and useful to have
01 - Come Together [Abbey Rd 1969 Vinyl]
==.flac
==.mp3
01 - Come Together [1987 CD]
==.flac
==.mp3
01 - Come Together [2009 Remastered]
==.flac
==.mp3

And then, at the playlist or sync level, where this duplication recurs hundreds or thousands of times over and must be manually managed, I decide the 2009 version is the "go to" I want in my playlists, so I'd just have an entry for 01 - Come Together [2009 Remastered] and select the appropriate version (flac vs mp3, etc) at playback/sync for what I want to do with it.

Playlist setting:
Flac where available, mp3 where not


low space device Sync setting or DLNA setting
mp3 versions only, convert from flac where mp3 does not exist

or

mp3 only, skip those which don't exist in mp3 currently

high capacity device or wired DLNA network
Flac where available, mp3 where not


I know auto-converting is the current (i.e. circa 2005) "solution" for this (across the board, in all programs, this is not a MB specific issue), but that does no good when exporting playlists for use in other applications (sync to an ipod or for Kodi to read, etc).  We already spent the time making the duplicate files and have them tagged and arranged, we just want to use them where needed.