Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nickstarkloff/0b1a4b9615fa5e6d510c62eea2f38429 to your computer and use it in GitHub Desktop.
Save nickstarkloff/0b1a4b9615fa5e6d510c62eea2f38429 to your computer and use it in GitHub Desktop.
Fix incorrect recently added items in Plex

Fix incorrect recently added items in Plex

Sometimes Plex saves a addedAt date in the future, in which case the item will always be stuck in the first position.

With this method you don't have to edit the database directly or shut down the server. You can fix it directly in the browser.

Fix the wrong date value

  1. Open your browser's developer tools
  2. Navigate to the console tab
  3. Adjust the following command and paste it into the console
var plexHost = "https://plex.domain.com"
var plexToken = "XXXXXXXXXXX"

var sectionId = "1"
var itemId = "12345"
// 1 for movie, 4 for episode
var typeId = "4"
// unix timestamp
var addedAtValue = "1672527600"

fetch(
  `${plexHost}/library/sections/${sectionId}/all?type=${typeId}&id=${itemId}&addedAt.value=${addedAtValue}&X-Plex-Token=${plexToken}`,
  {"method": "PUT"}
)

Get Plex token / Get item metadata

Unix timestamp conversion

@rjsears
Copy link

rjsears commented Jul 20, 2024

I tried this, but I am getting an error that says:

"Refused to connect to https://x.x.x.x/library...... because it violates the document's security policy."

Any idea how to get around this?

Also, what is the actual itemID out of the XML?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment