Change "Date added to library"

Hi community,

I‘m using plex for movies and TV shows and now also want to move my music (from iTunes) to it.

I searched a lot but unfortunately Plex does not have an importing function (would make it a soooo much easier decision).
Well, I will try to push meta information to ID3 Tags and then import the files…
BUT if I do so, all songs will be shown as added on the same day.

I know that this has to be changed directly in the Database via sqliteBrowser, but which tables/fields do I have to change?
I would like to set the date-added to the date the file was created in the file system.

Stephan

That’s interesting!

You’re looking at metadata_items.added_at.

You will have to do some additional joins to get from the imported files/paths, which are in media_parts.file, back up to the correct metadata_items row.

filename -> media_parts.file
media_parts.media_item_id -> media_items.id
media_items.metadata_item_id -> metadata_items.id
metadata_items.added_at

I think. You’ll want to validate that, for sure!

How are you thinking to approach this?

For each file, pull the date from the filesystem
Look in the database for the matching file
Update added_at if it isn’t already correct

?

You won’t be able to do this with basic SQL commands. Sqlite doesn’t have a way to identify the filesystem date of your files.

Actually I don‘t really know how to do this yet.

I hoped to get some hints hear and achieve it with some basic SQL-Knowledge. What I can read from your answers it seems a lot more difficult then I thought before.

I haf a brief look at some fields of the library.
For some test songs, I put to my plex server, it seems that media_items.updated_at Is the same like the Date_modify in the file system.

Am I right with this?

There are 2 scenarios you need to be aware of. When creating a new library, Plex will use the file/folder dates for the added_at date. This way you won’t have everything appear as new. However, adding additional content to the library will always use the current date for added_at. The update_at is similar, but that’s not really used for anything so it’s not as important.

I’ve done this for Windows, but not for QNAP. Basically I used a scripting program that can ready the file/folder dates then called individual SQL commands to update each entry in the database.

1 Like

Oh that’s interesting. If updated_at already contains the date that you want, it would be quite easy to update available_at to that date.

Do you want to do this to all of your music?

I wasn’t aware of the special handling for “new” libraries. That’s probably your best bet if you can swing it that way.

@anon18523487:
By “file/folder dates” you mean the creation date or the update date?
I tried to move my whole music, located on a windows PC, to my NAS with Plex running on it. This didn‘t work cause the creation date is set to the date I copied th files…
I just copied everything, maybe it is better to put everything to a zip-file before?!

I also tried to build a new library with my iTunes xml. In this case a new database called iTunes.db was created beside my library.db
In this I found a Field containing the dates I added the files to iTunes. This would be exactly what want to have for an “importing-from-iTunes” function but I couldn’t find a date-added-to-Plex-field I this DB.
Where is this date stored?

I believe it’s the creation date but I’d have to double check.

I don’t remember this database. I think that’s a temp database. Either way, Plex doesn’t import everything and I don’t believe the import date is one of those fields used. You could use this for this project, which does make it easier.

Could you please check this. From what i tried so far i think its not the creatione date (birth date) cause when i import my music to plex, some files older files at the beginning. Maybe i recently changed the ID3 tags at this files. so it seems plex uses Date changed/modified.

In this case i would try to export the itunes import dates and set the dates on files system befor a build the new library.
Would you share our windows script?

When i look at the timestamps, the itunes.db is not only a temporary db during library setup. In my case the last access was a few days ago but the lib setup was in June.

if i want to go with the database and manipulating the timstamps after the songs were importet in plex: Which are the right filds? is it only metadata_items.added_at or is it stored somewhere else?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.