Does anyone know how the Engine DJ/Engine OS database’s m.db
albumArt.hash
gets generated?
I know it’s SHA-1 with some sort of wonkiness to it (taking the PNG data from the other column, and SHA-1 doesn’t generate a matching hash).
Asking because I would love to help out with another DJ software project to add better support for exporting to Engine DJ/Engine OS.
@djliquidice will be your fountain of knowledge here.
2 Likes
Thank you for the tag @MrWilks <3. This is something i’ve honestly been meaning to look into.
Short answer
I don’t know how they calculate the SHA1 and I can verify your findings. A simple sha1sum <image.png|jpg|whatever>
doesn’t produce the same value as what’s in AlbumArt.hash
.
Long Answer
- Images are all stored in raw PNG format in
AlbumArt.albumArt
- All album art are all scaled to (max) 256x256 pixels
- Images may be salted or the SHA1 may be calculated somewhere in the pipeline from extracting the source image from the audio metadata before it’s stored in the DB
Using exiftool
and ffmpeg
, one can extract images from files:
ffmpeg -hide_banner -loglevel error -y -i INPUT_FILE_HERE -an -vcodec copy OUTPUT_FILE_HERE
or
exiftool -Picture INPUT_FILE_HERE -b > OUTPUT_FILE_HERE
Running sha1
against both tools nets the same result, telling me that the extract works well. I also added the extract of a target album art image directly from the database blob
and even tried to use ffmpeg
to resize the image to a png file and got different results. (i’m not sure what PNG settings are used to resize fwiw).
user@CommanderKeen:x$ sha1sum from*
439d586667e14887f730cd34b2cd7fde6cdc2189 from-db.png
319454523f3d77b2aebf4d9ba543c64ee0fa9c0a from-exiftool.jpg
319454523f3d77b2aebf4d9ba543c64ee0fa9c0a from-ffmpeg.jpg
96aef873f12e55447650d700f65437b37bdd34de from-ffmpeg.png
@DeathCamel57 , one thing to think about is that Engine OS
likely does not care about the how the SHA1 is calculated, but Engine DJ
does, because it’s responsible for importing data. So… your tool likely can do what it wants to do and just use the raw SHA1 value from the extracted image of a song and put that in the table. Worse case scenario, a database has a some duplicate image records. Doesn’t seem to be a huge deal for most users with small collections.
If you do come up with the answer, please share =)
1 Like