Music Track showing lastViewedAt in the future

Server Version#: 1.21.4.4079

I opened a thread awhile back music-track-history-shows-a-few-seconds-ago and since then have done a db repair (Repair a Corrupt Database), removed the music libraries and did another db repair and added the music back.

When I had this issue back in the Plex Premium Music days, a Plex dance would resolve it. That is no longer the case. Taking a look at the XML for the file I noticed the lastViewedAt is in the future, which explains why Plexamp keeps it at the top of the history as seen in the old thread. grandparentTitle="Felt" parentTitle="Felt: A Tribute to Christina Ricci" summary="" index="7" parentIndex="1" ratingCount="9" viewCount="7" lastViewedAt="1668748227" parentYear="2002" (human readable= GMT : Friday, November 18, 2022 5:10:27 AM).

How can I clear this? Playing the track does not update the field. Is it possible to delete this in the db without clearing watch statistics? Deleting it from Plex Dash does not work either.

Hmm, I think you’d need to edit the database, this would like be in the metadata_item_settings table, e.g.

select * from metadata_item_settings where last_viewed_at > '2021-03-27;'

and then (CHECK THIS AND BE CAREFUL):

update metadata_item_settings set last_viewed_at = '2021-02-27 00:00:00' where last_viewed_at > '2021-03-27';

This worked! Finally don’t see the track at the top of history in Plexamp!! Thanks @elan!!!

my pleasure! thanks for being the DB wizard :smiley:

@elan I should mention the first command gave these results:

15993|1|plex://track/5d07d128403c640290438daa|||8|2022-11-17 21:10:27|2019-08-05 20:53:23|2021-02-27 09:51:56|0||43948907||
7687|1|plex://track/5d07ce08403c640290fcdd92||180260|0|2025-05-31 22:43:30|2018-02-05 18:26:06|2019-10-02 08:46:33|0||29274936||
7265|1|com.plexapp.agents.plexmusic://gracenote/album/05F4C0DF0120CB0F/18926351-F4C0DF80164205FF1847C6358D0C7821?lang=en|||2|2025-06-09 09:31:30|2018-01-17 10:12:36|2018-02-05 18:26:08|0||7032379||
7689|1|com.plexapp.agents.plexmusic://gracenote/track/18926351-F4C0DF80164205FF1847C6358D0C7821/18926363-95AFAE8FA929E123338B9D3D3BD183D7?lang=en||440168|0|2025-06-09 09:31:30|2018-02-05 18:26:06|2018-02-05 18:26:08|0||7032378||
7338|1|com.plexapp.agents.plexmusic://gracenote/album/051C7AA7002E345E/3028062-1C7AA7208522EFF27F1E85FFFD45DF69?lang=en|||4|2025-06-18 18:54:36|2018-01-17 18:56:30|2018-02-05 18:26:06|0||7032373||
7339|1|com.plexapp.agents.plexmusic://gracenote/artist/0509C05A005349BC?lang=en|||4|2025-06-18 18:54:36|2018-01-17 18:56:30|2018-02-05 18:26:06|0||7032376||
7690|1|com.plexapp.agents.plexmusic://gracenote/track/3028062-1C7AA7208522EFF27F1E85FFFD45DF69/3028064-AE4281E006B49AA8A3355B1F851D45E3?lang=en||192353|0|2025-06-18 18:54:36|2018-02-05 18:26:06|2018-02-05 18:26:06|0||7032372||
14701|1|com.plexapp.agents.plexmusic://gracenote/album/05551CF90BB497AA/196384682-551CF9482F6FE579BE66AE10E80C4E13?lang=en|||15|2031-04-19 07:48:04|2019-06-20 08:49:42|2019-08-08 23:03:09|3|2019-06-21 19:57:02|28560763||
14702|1|com.plexapp.agents.plexmusic://gracenote/artist/05C743B930D2C4A0?lang=en|||23|2031-04-19 07:48:04|2019-06-20 08:49:42|2019-08-08 23:03:09|7|2019-07-24 15:57:31|28560765||
14721|1|com.plexapp.agents.plexmusic://gracenote/track/196384682-551CF9482F6FE579BE66AE10E80C4E13/196384691-A8E4459ABAF84D5DADEA48C4C8AA2DF8?lang=en||70831|1|2031-04-19 07:48:04|2019-06-20 13:18:03|2019-08-08 23:03:09|0||28560762||
7096|1|com.plexapp.agents.plexmusic://gracenote/track/2899176-A135FA594B5E35BAF0CF296F89D2C939/2899178-9062DF054E3EE130CB510BFA50476745?lang=en||162659|2|2031-04-21 08:51:16|2018-01-09 16:26:38|2019-08-08 23:03:09|1|2018-01-09 16:26:38|28560764||
7097|1|com.plexapp.agents.plexmusic://gracenote/album/05A135FA002C3CE8/2899176-A135FA594B5E35BAF0CF296F89D2C939?lang=en|||7|2031-04-21 08:51:16|2018-01-09 16:26:38|2019-08-08 23:03:09|1|2018-01-09 16:26:38|28560766||
7098|1|com.plexapp.agents.plexmusic://gracenote/artist/05A135FA002C3CE8?lang=en|||20|2031-04-21 08:51:16|2018-01-09 16:26:38|2019-08-08 23:03:09|1|2018-01-09 16:26:38|28560767||

I haven’t noticed any issues after running the second command. I noticed the first line is the track I’ve been trying to update, I am not sure what the second track is, but is the gracenote entries expected? Any issues that might come up by updating all the entries to yesterday?

the gracenote entries are from the old music system, you may want to follow the procedures @ Upgrading Music Libraries to the New Metadata System | Plex Support

@TeknoJunky I followed the process when the new metadata rolled out (did the same for Movies when the public build released). I have deleted and recreated the music library a dozen or so times trying to fix this track issue so I am guessing some stuff is lingering around.

In fact, I know old stuff is still lingering around when I observed my old HDHR shows up in the Console log when the Plex is starting:

DVR:Device: Error refreshing existing device device://tv.plex.grabbers.hdhomerun/xxxxxx, marking as dead.

I deleted the tuners early last year and then removed DVR since I switch from cable to YTTV.

I migrated from Windows to Synology a couple years ago and while trying to solve this problem, I found this article that recommends clearing out the cache for plug-ins after the transfer. So I am trying to clear out all the gremlins I can.

i wouldn’t worry too much about the gracenotes; rows in metadata_item_settings and metadata_item_views are allowed (and designed) to become disconnected from the actual media (and maybe reconnected in the future).

I figured it wasn’t a big deal. Thanks for confirming!

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