Can I restore the EngineDJ database from the Prime 4 to my laptop

Well, first try to put that copy back, replace your database2 folder with the one from your USB stick, and see where auto relocate brings you.

Secondly, if that doesn’t work, I would personally just copy the USB stick contents to the D drive, and forget the original folder structure. InMusics folder structure is the same as iTunes, and is a well thought through way of categorizing. Personally, I would even consider just using the USB stick as my main library. Of course you’ll have to back it up!

2 Likes

@DJSeppie Going back to your OP, did you always store your music at D:\Denon\Library or is that a backup of your music that was stored on C:? If your music was always on D:, then the /Engine Library/Database2.m.db would be on D: You can’t use the Prime 4 /Engine Library/Database2/m.db to reference the collection on D:, because, as you note, it is organized differently.

You can do what @Johan suggests. If you go with the Prime 4 version then you just copy the entire /Engine Library/ folder into the root of D: (or /Music/ of C:) and it should work. I tried that before and again now.

If you find a backup of m.db that references the relative arrangement of your music in D:\Denon\Library, then you can do a path replacement as @DJ-PowerG offers. Carefully look at the path (directory) as shown in Engine DJ vs where your files are stored.

1 Like

When I lost my database, but my files were still on drive D on Windows, I did the following:

I imported all tracks from drive D into Engine DJ Desktop (= ED).

Since most work is setting again all the hot cues and loops. Getting the hot cues back was the most important to me. I think recreating all the playlists is not the most amount of work.

If you want to do the same you can do the following:

– Download DB Browser for SQLite. Link: Downloads - DB Browser for SQLite

The following step is not necessary but to keep it clean and avoid mistakes.

– Create a work folder e.g. EngineTemp

– inside this folder create two sub folders “local” and “prime4

– copy the m.db file from your D drive Engine Dj folder to the local folder

– copy the m.db file from your Prime 4 to the prime folder

– Start DB Browser for SQLite

– In the file menu choose open database and open select the m.db from the local folder

– Go again to the file menu and choose attach database, but this time select m.db from the prime4 folder.

– You will get a pop up asking for a name under which you want to acces the attached database, you can give any name, but in this case use the following name “mprime4

Go to the tab “Database structure” here you you should now see both database structures m and mprime4

Now click on the tab “execute SQL

And paste the following script:

create table TrackP as select * from mprime4.Track

This will copy the track table from the prime database to the local ED database.

Than execute the following script to copy all the data like hot cues, loops etc to the local database for matching file names.

UPDATE Track
   SET (
           bpm,
           --bitrate,
           bpmAnalyzed,
           isAnalyzed,
           dateCreated,
           dateAdded,
           isBeatGridLocked,
           trackData,
           overviewWaveFormData,
           beatData,
           quickCues,
           loops,
           activeOnLoadLoops
       )
=      (
           SELECT bpm,
                  --bitrate,
                  bpmAnalyzed,
                  isAnalyzed,
                  dateCreated,
                  dateAdded,
                  isBeatGridLocked,
                  trackData,
                  overviewWaveFormData,
                  beatData,
                  quickCues,
                  loops,
                  activeOnLoadLoops
             FROM TrackP
            WHERE TrackP.filename = Track.filename
			AND TrackP.quickCues <> x'00000081789C636000030E86FD1F181080761C381BC6000010B010DF'
       )
 WHERE Track.filename IN (
           SELECT TP.filename
             FROM TrackP TP
            WHERE TP.isAnalyzed = 1 AND 
                  TP.quickCues  <> x'00000081789C636000030E86FD1F181080761C381BC6000010B010DF'
       )
AND 
		 Track.quickCues  = x'00000081789C636000030E86FD1F181080761C381BC6000010B010DF' 

Just to be sure that the database is not corrupt:

PRAGMA integrity_check;

Some other helpful script:

List files which will be updated by the query above:

SELECT T.filename,
       T.quickCues,
       hex(T.quickCues),
       TP2.ID,
       TP2.quickCues AS PrimeCue,
       hex(TP2.quickCues) AS PrimeCueHex,
       TP2.ID AS PrimeID
  FROM Track T
       INNER JOIN
       TrackP TP2 ON T.filename = TP2.filename
 WHERE TP2.isAnalyzed = 1 AND 
       TP2.quickCues <> X'00000081789c636000030e86fd1f181080761c381bc6000010b010df' AND 
       T.quickCues = X'00000081789c636000030e86fd1f181080761c381bc6000010b010df';

Copy the local database m.db back to Engine Dj folder on drive D.

If you need a script to relocate a lot of files to another folder let me know.

I hope that this helps…

2 Likes

Really great post, however the most important stuff for me are the cue points and the playlists (I use them as categories). So I need to relocate my file references in the database only.

I really appreciate the effort you took to help me!

Ok I managed to get from the 13000 tracks 12300 back using a script a friend of mine made! So the remaining changes need to be done by hand. It will take some time but it is doable.

One strange thing we found out, I created a new database by renaming the folder C:\Users\USERNAME\Music\Engine Library Backup\Database2 but when I started EngineDJ, some tracks were still visible. It turned out that there is a second database folder located on the D-drive: D:\Engine Library\Database2

This raises alot of questions: When I make a database backup from EngineDJ, will this contain also the database files from the D-drive (I think not because when I make backup, the database file m.db in the backup folder is only 2MB in size. How can we properly create a backup of the whole database? This needs documentation!

1 Like

Yup. This is known by a lot of people.

I don’t think two is a lot. :wink:

As you observed, no. it only copies the root database (in you user profile directory).

There is no programmatic way with Engine Desktop. I use an external SSD for my music and manually compress each time i make changes to the DB.

I do the same thing for my root database.

It indeed wont, as @djliquidice pointed out. Also note that most third party backup solutions will skip extra/external drives by default. Thats the main reason I continued using my internal drive as a main library: it would automatically be backup up by time machine….

But there are people running their entire database on a single road-ready USB drive. You will need a thorough backup plan in case of loss/damage… For example, using a Synology, you can backup an external drive by inserting it into the USB plug. Or have an rsync cron script running which backups your D drive to a NAD…

1 Like

Hey, incredible! And did you finnaly get back your whole entire database with playlists, cue points, beatgrid, date added,… with this method ?

I’m struggling since a month with the same problem, spent tons of hours with chat gpt, powershell, python and db browser :exploding_head: and I only got back almost 3/5 of my database.. I had ennoying gigs because of it..

I’ll try what you explained when I’ll be home, I have 3 new gigs booked and I really need my database clean

Thanks for helping us in this mess🙏

I have seen a post before that copying the entire engine library folder of the performance drive to the laptop default Music drive works.

Obviously music folder structure will not be the same but if it works, it’s better than nothing.

Yes I managed to restore my database. I’m sure some files are in the directory structure and not in my database but I think Inmusic will fix that in the future (some better cleanup script). I had about 600 mp3-files I had replaced on my laptop with a flac file which were not yet on tht Prime available. Those files had to be relocated by hand in the Engine desktop software. That was a lot of clicking but doable.

I deleted the database and music files on the prime 4 and also the stems folder. Then I did the sync from the laptop d-partition to the Prime 4. All the files I tested worked fine. I only had a crash of the whole machine, perhaps this could be caused by the latest update 4.3.1 ? I haven’t checked for posts on this issue yet.