Can not change "Originally Available" date for a Movie: Part Deux; Now Stuck at "1900" (PMS 5762)

I just updated to PMS beta 1.26.1.5762 to address the recent issue of manually set Originally Available dates not saving. The dates now save properly on the Edit screen, but display as year “1900” in my Library. Anyone else seeing this?

Server Version#: 1.26.1.5762
Player Version#:

Unlock the the date and save
Then go back and set the desired data

It still seems wonky to me, @dane22.

It looks like a reasonable epoch time is written to the database, but then it’s displaying wrong.

Not sure I quite understand what’s going on.

1 Like

When you edit Originally Available, originally_available_at is now being set correctly.

However, metadata_items.year is set to 1900.

That’s what’s displayed in the Library view when browsing.

1 Like

I just found out via testing :wink:

And no idea if this is how it’s supposed to work or not, so simply wanted to provide a work around

I don’t think that workaround addresses the described issue?

Any manually saved Originally Available date results in 1900 being saved to metadata_items.year, AFAICT.

I think it’s only cosmetic, .year is never used for anything but display?

I’m not suggesting anybody should do this, because I haven’t really tested the edges very well.

UPDATE metadata_items SET year = 
STRFTIME('%Y',originally_available_at,'unixepoch') WHERE year <> 
STRFTIME('%Y',originally_available_at,'unixepoch') AND metadata_type IN (1); 

@dane22 I haven’t confirmed this myself, but it sure smells like a closely related issue -

I certainly use it for smart playlists for decades of music.

It’s sadly 00:43 here in Denmark, so off to bed :wink:

But on my plate for tomorrow to dig into

2 Likes

Yeah, uh, cosmetic … but also, used for Smart Playlists. :slight_smile:

It’s the same issue, and the same thing works for Albums/Tracks, but again I haven’t tested it much.

UPDATE metadata_items SET year = 
STRFTIME('%Y',originally_available_at,'unixepoch') WHERE year <> 
STRFTIME('%Y',originally_available_at,'unixepoch') AND metadata_type IN (9,10); 

I’ve logged this issue for the developers to look at.

4 Likes

Hey a new PMS! :slight_smile:

(Thank you @dane22 & @ridley)

2 Likes

I notice that this update didn’t fixup all pre-existing mismatches between year and originally_available_at. I was surprised by weird year values for a large number of TV episodes - things I haven’t updated recently.

It appears that Refresh Metadata doesn’t forcibly update all mismatches either. (It does when Originally Available At is modified.)

So I’m considering running this:

UPDATE metadata_items
SET year = STRFTIME('%Y',originally_available_at,'unixepoch')
WHERE
(
 originally_available_at IS NOT NULL
 AND
 (
  year IS NULL
  OR year <> STRFTIME('%Y',originally_available_at,'unixepoch')
 )
);

Edit: I made a backup and did it. I’ll let you know if anything explodes.
Edit a month later: Nothing explodes. I’ve used it again to fix more bad dates from the agents.

1 Like

@Plan-B I saw your comment in another thread. If you’re comfortable running a SQL update against your database, the above will shotgun-correct the year based on the saved originally_available_at.

@Volts Thanks for this. I’m very tempted to try it. I haven’t touched SQL in over a decade so I’m gonna give it a couple of PMS update cycles to see if they figure out a way to fix broken/mismatched years.

I was surprised this version didn’t update year already. It’s possible a future update will do so, or a future update will do so as part of the normal periodic optimization process.

If not, you don’t need to be an SQL expert. If you can find your Plex SQLite binary and your com.plexapp.plugins.library.db database file, the SQL statement can be copied & pasted.

LMK if you decide to do that and want a walkthrough.

@Volts I realized I had more media stuck at 1900 than I realized when I viewed all titles and sorted by year. So I tried the SQL update and couldn’t figure out how to get it to work.

I started by running:
.open "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/com.plexapp.plugins.library.db"

Then did a simple copy/paste of your update and got:
Error: no such table: metadata_items

I had to find a time when I was pretty sure no one was going to try and watch anything. So I might try again later and see if I can figure out what went wrong (probably didn’t open the DB file correctly).

Is that the database file location? I would guess here maybe:

ls "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"

Stop Plex and make a backup first.

1 Like

Oh wait. Duh. You’re right! I mis-copied the path. I just ran it again and everything seems to be properly aligned now. Thanks!