Skip to content

barberc-byte/Media-Server-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Media Server Scripts πŸŽ¬πŸ“

This repository contains PowerShell scripts I've written to automate and maintain my personal media server. These help manage HEVC encoding, remove unwanted files, and organize content efficiently.

πŸ”§ Scripts

Script Name Description
SmartHEVCEncode_CPU.ps1 Re-encodes video files to H.265 (HEVC) using CPU.
Movies Folders.ps1 Cleans and standardizes movie folder structures.
Tv Shows unwanted files.ps1 Deletes sample files, nfo, extras, etc.
ChangingRecentlyAdded.py Python utility that updates Plex addedAt timestamps based on labels you apply.

🧠 Plex Metadata Tools (Python)

This section includes a Python script that automatically updates the addedAt timestamp for Plex items based on labels you apply. It helps reorganize β€œRecently Added,” repair metadata order, or intentionally surface items without modifying any files.

πŸ“„ Script: ChangingRecentlyAdded.py

πŸ” What This Script Does

  • Connects to Plex using a long-lived X-Plex-Token

  • Scans all movie and TV show libraries

  • Finds items with the labels:

    • HOTFOR48H
    • ADDED1MONTHAGO
  • Updates their addedAt timestamp to:

    • +48 hours (pushes item to the top of "Recently Added")
    • βˆ’30 days (pushes item down the list)
  • Removes the label after applying the change

  • Does not touch music or photos

This makes it a completely non-destructive way to re-sort Plex without modifying any media files.


πŸ›  Requirements

  • Python 3.8+
  • plexapi

Install with:

pip install plexapi

You’ll also need a long-lived Plex token, which you can find by inspecting any network call in the Plex Web UI (X-Plex-Token).


Add in your Plex IP and token to the script

πŸš€ Running the Script

python ChangingRecentlyAdded.py

You’ll see a clean log output showing:

  • which items were found
  • what their new timestamps are
  • which labels were removed
  • any errors (bad token, wrong URL, etc.)

🏷 Triggering Updates with Labels

To mark an item for update:

  1. Open the movie/episode in Plex

  2. Add the label:

    • HOTFOR48H β†’ sets addedAt 48 hours in the future
    • ADDED1MONTHAGO β†’ sets addedAt 30 days in the past

Run the script when you're ready, and it will process everything at once.


πŸ“Œ Useful For

  • Rebuilding Recently Added after migrating your libraries
  • Fixing items Plex added out of order
  • Pushing a show to the top without touching files
  • Making older episodes β€œdisappear” from the front page
  • Metadata cleanup during reorganizations

If you want, I can also create a standalone docs/update_addedAt.md with extended examples and token-finding instructions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published