iTunes "Date Added" info - update with "Date Created" information from .mp3 fie

Patch's Avatar


31 May, 2020 11:46 AM

Can this be done using a BeaTunes BeaTlet?

  1. Support Staff 1 Posted by hendrik on 01 Jun, 2020 10:11 AM

    hendrik's Avatar

    Yes, that can be done.

  2. 2 Posted by Patch on 01 Jun, 2020 12:38 PM

    Patch's Avatar

    Awesome! Thanks for the heads-up!

  3. Support Staff 3 Posted by hendrik on 01 Jun, 2020 02:19 PM

    hendrik's Avatar

    Hm... actually thinking about it, there is a caveat.

    You'd usually set properties for tracks via the AudioSong interface. But, as you might have seen already, it does not have a setDateAdded(Date) method, because the added date is typically not something a user wants to mess with. Doing it anyway, may cause other mechanisms to stop working properly, like, for example, detecting new tracks in the library.

    If you want to modify it anyway, you have to jump through some hoops. The interface that allows you to change it is Song. Here's a rough outline of how to do it (without imports etc.):

    // get the file creation date somehow
    Date creationDate = ...
    // get some song from the library or from somewhere else
    AudioSong audioSong = ... 
    // get the Song interface/implementation
    Song song = audioSong.getImplementation(Song.class);
    // set the creation date
    // then store the new value in the database
    getApplication().getMediaLibrary().store(song, "dateAdded");

    You are basically peeking behind the AudioSong facade, which is why some extra work is needed.

  4. 4 Posted by Patch on 01 Jun, 2020 08:47 PM

    Patch's Avatar

    Hmm... That's beyond my coding abilities, and sounds like it could potentially introduce undesirable and unexpected changes.

    This might have to be something that I leave out of my existing Beatlet. :-(

    As a bit of background, I wanted this because I sometimes re-build my library, by deleting all tracks from iTunes, and re-importing them. Unfortunately, doing this, resets all of the import dates/date added dates to "todays" date. I'd really like to have that date stay fixed, and basing it on the file created date would be perfect for my needs.

    It's really annoying, actually, because Date Added is available in iTunes, and can be used to define Smart Playlists, where File Create Date cannot.

    I do have a very inelegant work around. I'll use an action in MP3Tag to take the Date Created Date from the .mp3 file, and add it to the Date Modified Date tag, which is also available for Smart Playlisting in iTunes...

    Like I said - not very elegant - but it'll do almost what I need of it.

  5. Support Staff 5 Posted by hendrik on 03 Jun, 2020 06:42 AM

    hendrik's Avatar

    As a bit of background, I wanted this because I sometimes re-build my library, by deleting all tracks from iTunes, and re-importing them.

    I'm wondering why you do this. What's the idea behind it?

  6. 6 Posted by Patch on 03 Jun, 2020 08:02 PM

    Patch's Avatar

    One of the reasons is that I have an iTunes library that I use on 2 separate machines. One is downstairs, where I do all the work on my playlists (and especially Smart Playlists), and the other machine is upstairs where I do my DJ'ing and production.

    So, as I create new Smart Playlists on the downstairs machine, I have to copy the iTunes Library file, containing all of my Smart Playlist definitions, to the machine upstairs.

    To avoid any issues, before I copy that library file OFF my downstairs machine, I delete all music from the library, meaning my library file holds only the Smart Playlist definitions. So, when I copy that file to the upstairs machine, the library and ALL Smart Playlists (it's a LOT!) gets populated there and then, and any information that is not embedded in the file (like, Import Date), is not able to be used in any Smart Playlists.

    So, to maintain the "Import Date" (iTunes Date Added) which is an available condition in Smart Playlists, I want to be able to replace the "changeable" iTunes Import Date information (in the iTunes Library file), with the FIXED File Created Date information.

    I hope this makes sense. I'm not sure if I was clear.

    I don't know if it's clear from teh above, but I absolutely LOVE Smart Playlists!!! :-)

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac