Author Topic: Embedded Album Art From Apple Lossless m4a Not Importing  (Read 1294 times)

Sillypsybin

  • New User

  • Offline
  • *
  • 8
Embedded Album Art From Apple Lossless m4a Not Importing
« on: March 25, 2020, 01:10:24 AM »
A lot of songs I have imported into RadioDJ do not have album art, even though the files have embedded artwork. In trying to narrow down what the problem is, I have noticed that all the songs without artwork are Apple Lossless m4a. I have thousands of Apple Lossless m4a files, too many to try to fix one song at a time. I can easily extract the Apple Lossless album art with Mp3tag (as folder.jpg) into individual album folders, but I don't know how to associate them with the songs in RadioDJ in bulk, if that's even possible. Is there an easy way to get the album art from my Apple Lossless files into RadioDJ? Looking for a solution. Thanks!

PROducer

  • Hero Member

  • Offline
  • *****
  • 587
  • Personal Text
    Long Time Radio Guy
    • The Rooster
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #1 on: March 28, 2020, 02:54:54 AM »
I can easily extract the Apple Lossless album art with Mp3tag (as folder.jpg) into individual album folders, but I don't know how to associate them with the songs in RadioDJ in bulk, if that's even possible.

MP3Tag V3 introduced the ability to create an action that converts the Album Art to a maximum size you set, plus convert the image type to a specific image type file (say .jpg) then exports Album Art where ever you wish, and name it using tags from the mp3.

I did this, then made a simple SQL Query to change the image's filename in the RDJ database to match the file in the artwork folder.

So, in mp3Tag, convert all your artwork to .jpg and export it somewhere.  Name the images using the %filename% tag.  Then have your SQL query rename the image field in the songs table to the path where the artwork is stored, plus the filename.

Here's the SQL I used to do this:
Code: [Select]
UPDATE songs
SET `image` = CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(songs.path, '.mp3', 1), "\\", -1),".jpg") WHERE songs.song_type = 0;

stevewa

  • Hero Member

  • Offline
  • *****
  • 1064
    • RadioDJ Remote Support Link to Pay for Help
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #2 on: March 29, 2020, 04:40:45 AM »
Radiodj has had this problem with mp4 & m4a extracting for a while.
RadioDJ Remote Support Link to Pay For Personal Help: https://www.paypal.com/donate/?hosted_button_id=8RMWTFAWCX7WS

Sillypsybin

  • New User

  • Offline
  • *
  • 8
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #3 on: April 09, 2020, 01:36:27 AM »
Thank you so much PROducer! So, in my case the files are not mp3 but rather m4a. I've exported the album art with Mp3tag as .jpgs into a folder and named them %_filename%. I'm a little confused and could use a little guidance as to how I should modify the query you wrote to get it to properly update the database. I presume that I should change 'mp3' to 'm4a'? Where/how do I enter the path? Thanks again.


Here's the SQL I used to do this:
Code: [Select]
UPDATE songs
SET `image` = CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(songs.path, '.mp3', 1), "\\", -1),".jpg") WHERE songs.song_type = 0;

Sillypsybin

  • New User

  • Offline
  • *
  • 8
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #4 on: April 09, 2020, 04:30:07 PM »
Ok, so I extracted the artwork from the m4a's using Mp3tag and I named them %_filename%, and put them all into one folder. So for instance the artwork for 'song x.m4a' is 'song x.jpg' and it's in D:\Album Art with all the other jpg's from the m4a's. Then I did some experimenting with the sql query in Heidi. I tried a few things that returned a syntax error, but finally I got this to run, for whatever it's worth (not much apparently):

UPDATE songs
SET `image` = CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(songs.path, '.m4a', 1), "D:\Album Art", -1),".jpg") WHERE songs.song_type = 0;

Looking in Heidi in the data tab under songs, in the image column, I could see that there were now images corresponding to the m4a's, where there used to be something like 'no image.jpg' prior to my running the query. But looking closer, it seemed that at least some, if not all of the images corresponding to my mp3's had been appended with '.mp3' in the jpg file name. In other words, in the image column, where it once would have shown the image for 'song x.mp3' as 'song x.jpg', now it was showing the image as 'song x.mp3.jpg'. Something or other I had done previously seemed to completely break the album art display function in radiodj.

Now no album art images are displaying in radiodj.

I continued to try to peck away at this (like a lot of people right now I have nothing else better to do). I have no idea what I'm doing, but why not experiment? If worse comes to worse I can just delete the database and start again from scratch. It's better than getting COVID-19. Alas I have found no solution, and somewhere along the way a bunch of the m4a images now have '.m4a' appended to the jpg name listed in the image column in Heidi as well. So much for my career as a hacker.  :D

I moved my m4a album art to the folder nestled within the radiodj program folder (C:\radiodj\Album Art), so that folder now contains all of the jpg's for both the mp3's and m4a's, where the image file name for 'song x.mp3' is 'song x.jpg' and the file name for 'song y.m4a' is 'song.y.jpg'. Of course that didn't help the broken album art function, but at least all of the artwork is all in one place and is named similarly.  ::)

Clearly I need some help (people have been telling me this for years). What can I do to fix this fine mess I've made? Thanks for your assistance.

PROducer

  • Hero Member

  • Offline
  • *****
  • 587
  • Personal Text
    Long Time Radio Guy
    • The Rooster
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #5 on: April 09, 2020, 09:20:54 PM »
You're close.  Make sure In Options (Spanner/wrench icon) > Other Settings Tab that you have the correct Artwork Storage Path set and enabled.  RDJ will automatically look in that folder for Artwork.  So the image filename in Heidi does not need to start with the path to the Artwork Folder.

All my files are .mp3 format, so the query I gave you works for me.  Let's see if we can make it work for you.

I think you will need to do the query twice, once for .mp3 files and once for .m4a files.  If you have any other filetypes, you will need to add a new query for each type, changing the filetype in the query to match the files extension.

Code: [Select]
UPDATE songs
SET `image` = CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(songs.path, '.mp3', 1), "\\", -1),".jpg") WHERE RIGHT (songs.path,3) = 'mp3' AND songs.song_type = 0;
SET `image` = CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(songs.path, '.m4a', 1), "\\", -1),".jpg") WHERE RIGHT (songs.path,3) = 'm4a' AND songs.song_type = 0;

This should fix the damage the previous query did.  Essentially you want the 'image' field in your database to be populated with the song's filename, with .jpg instead of .mp3

Also, when you exported artwork from mp3Tag, in the action, did you first have an action convert the artwork to .jpg type?  This is to make sure all artwork is the same image format.


Sillypsybin

  • New User

  • Offline
  • *
  • 8
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #6 on: April 11, 2020, 03:43:37 AM »
Thank you so much for helping me out. I'm really enjoying trying to crack this.

I ran your new query and I got this error message: SQL Error (1193): Unknown system variable 'image'

I've got Artwork in Other Setting set to the correct path. And all of the art I exported from Mp3tag is .jpg.

Yes, getting close. I can smell it!  8)

PROducer

  • Hero Member

  • Offline
  • *****
  • 587
  • Personal Text
    Long Time Radio Guy
    • The Rooster
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #7 on: April 11, 2020, 04:18:30 AM »
I ran your new query and I got this error message: SQL Error (1193): Unknown system variable 'image'

It's not a single quote (apostrophe) around the field name. It's a character that looks similar, but is angled to the left ( ` ) and on my keyboard it is on the key beside the number 1 under the escape key.

Did you copy & paste the code or type it?  You probably should copy & paste it to get all the characters correct!


Sillypsybin

  • New User

  • Offline
  • *
  • 8
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #8 on: April 11, 2020, 04:55:16 AM »
Yes I copied and pasted. I just tried copying and pasting again and I got the same error. Not sure it means anything, but the error message uses the single quote ('image') rather than the character you use in the query.

However, it looks like I got the artwork for the mp3's back, so even though I got the error message the query did fix one problem, so that's a step in the right direction.

But looking in the image column Heidi I'm still seeing the appended image filenames for the m4a's. For example, for the song Life Begins At The Hop.m4a I see Life Begins At The Hop.m4a.jpg in the image column. However, on double checking the artwork for that song in the Album-Art folder I see it is Life Begins At The Hop.jpg (no .m4a in there). There is no path indicated for any of the .jpg files in the image column, so that appears to be as it should.

I think it's just the appended '.m4a' in the file names that's hanging it up. I suppose as a workaround I could just append the .jpg files in question to include the '.m4a' in the filename using Bulk Rename Utility.

UPDATE: I did rename the .jpg's in question to  *.m4a.jpg with Bulk Rename Utility and that got the album art to work in radiodj. Still curious as to why the query didn't fully work. But thanks PROducer! I did get it to work, and that's the important thing. Yay!
 

PROducer

  • Hero Member

  • Offline
  • *****
  • 587
  • Personal Text
    Long Time Radio Guy
    • The Rooster
Re: Embedded Album Art From Apple Lossless m4a Not Importing
« Reply #9 on: April 12, 2020, 07:55:44 AM »
Yes I copied and pasted. I just tried copying and pasting again and I got the same error. Not sure it means anything, but the error message uses the single quote ('image') rather than the character you use in the query.

However, it looks like I got the artwork for the mp3's back, so even though I got the error message the query did fix one problem, so that's a step in the right direction.

But looking in the image column Heidi I'm still seeing the appended image filenames for the m4a's. For example, for the song Life Begins At The Hop.m4a I see Life Begins At The Hop.m4a.jpg in the image column. However, on double checking the artwork for that song in the Album-Art folder I see it is Life Begins At The Hop.jpg (no .m4a in there). There is no path indicated for any of the .jpg files in the image column, so that appears to be as it should.
Interesting that the .m4a is in the image filenames for that filetype.  The query builds the image filename from the audio file's filename, dropping the .m4a at the end and replacing it with .jpg
Quote
I think it's just the appended '.m4a' in the file names that's hanging it up. I suppose as a workaround I could just append the .jpg files in question to include the '.m4a' in the filename using Bulk Rename Utility.

UPDATE: I did rename the .jpg's in question to  *.m4a.jpg with Bulk Rename Utility and that got the album art to work in radiodj. Still curious as to why the query didn't fully work. But thanks PROducer! I did get it to work, and that's the important thing. Yay!
You're welcome.  Not sure why it worked for .mp3 files, but not .m4a

Sillypsybin

  • New User

  • Offline
  • *
  • 8
Mystery Problem Re: m4a Album Art Query
« Reply #10 on: April 16, 2020, 04:17:53 AM »
So, I just added some new m4a's, and none of the queries are working to link the artwork. In Heidi, under the image column it shows "no_cover_image.jpg" for the new adds. Nothing changed after running the new query or the first one. I think something I did when I was trying to hack the first query must have added the *.m4a.jpg filenames in Heidi. Danged if I know what that was. That seems like the only reasonable explanation. Neither the first query suggested in this thread nor the last one produced the *.m4a.jpg result. Although it returned an error message, the last query did however clear up the broken mp3 image links that occurred from one of my amateur query hacks. Still need some help getting the query to function properly. I know there must be a way to get this to work. Thanks!

UPDATE: Well, I messed around with the variables again in the first query, and lord knows what I did, but somehow I managed to break the links for all the artwork again, so I ran the new query yet again, error and all, and lo and behold, radiodj found the artwork for all the files again including the new m4a's. Hooray! No doubt my being stoopid is a contributing factor in all this weirdness. At least I'm getting it to work in my own convoluted way. Now if I can just figure out how to do it right. Gives me something to work on, anyway.