Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
JonnyWong16 / plexAPIPerformanceTest.py
Last active August 23, 2021 05:35
Test Plex API performance
from plexapi.server import PlexServer
import time
SERVER_URL = 'http://localhost:32400'
SERVER_TOKEN = 'xxxxxxxxxxxxxxxxxxxx'
LIBRARY_NAME = 'Movies'
plex = PlexServer(SERVER_URL, token=SERVER_TOKEN)
movies = plex.library.section(LIBRARY_NAME)
totalItems = movies.totalSize
@JonnyWong16
JonnyWong16 / mass_plex_accounts.py
Last active July 5, 2021 00:46
Generate Plex accounts
import random
import requests
import string
import sys
import time
import uuid
try:
NUMBER_OF_ACCOUNTS = int(sys.argv[1])
except (IndexError, ValueError):
@JonnyWong16
JonnyWong16 / rename_seasons_masterclass.py
Last active October 12, 2023 21:37
Rename Masterclass seasons in Plex with summary.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Rename season title for TV shows on Plex.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.server import PlexServer
@JonnyWong16
JonnyWong16 / get_plex_token.py
Created June 17, 2021 16:51
Create a new Plex.tv token for your app.
import uuid
from plexapi.utils import getMyPlexAccount, createMyPlexDevice
account = getMyPlexAccount()
product = input("App name: ")
headers = {
'X-Plex-Platform': '',
'X-Plex-Platform-Version': '',
'X-Plex-Provides': '',
'X-Plex-Version': '',
@JonnyWong16
JonnyWong16 / openPlexMetadataXML.user.js
Last active January 31, 2024 19:33
Open the Plex metadata XML info for any media page with Ctrl+I
// ==UserScript==
// @name Open Plex Metadata XML
// @namespace https://app.plex.tv
// @version 1.3
// @description Open the Plex metadata XML info for any media page with Ctrl+I.
// @author JonnyWong16
// @homepage https://gist.github.com/JonnyWong16/ec660094e4cd7233f1dd96b4b4d62e21
// @downloadURL https://gist.github.com/JonnyWong16/ec660094e4cd7233f1dd96b4b4d62e21/raw/openPlexMetadataXML.user.js
// @updateURL https://gist.github.com/JonnyWong16/ec660094e4cd7233f1dd96b4b4d62e21/raw/openPlexMetadataXML.user.js
// @match https://app.plex.tv/*
@JonnyWong16
JonnyWong16 / README.md
Created July 12, 2020 15:33 — forked from MarMed/README.md
Routing plex traffic through an SSH tunnel

Routing plex traffic through an SSH tunnel

This guide creates a reverse SSH tunnel to route all Plex server traffic through it.

Step 2 is done on the tunnel, all other steps are done on the plex server.

1. Setup SSH keys (if you already have key based authenthication setup skip to step 2)

On plex server:

@JonnyWong16
JonnyWong16 / canyouseemeorg_check.py
Last active May 15, 2020 18:55
Check Plex remote access using CanYouSeeMe.org and send a notification
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Check Plex remote access using CanYouSeeMe.org and send a notification
# Author: /u/SwiftPanda16
# Tautulli script trigger:
# * Plex Remote Access Down
# Tautulli script conditions:
# * None
# Tautulli script arguments:
@JonnyWong16
JonnyWong16 / recently_added_collection.py
Last active May 15, 2019 21:06
Automatically add a movie to a collection based on release date.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Automatically add a movie to a collection based on release date.
# Author: /u/SwiftPanda16
# Requires: plexapi
# Tautulli script trigger:
# * Notify on recently added
# Tautulli script conditions:
# * Filter which media to add to collection.
@JonnyWong16
JonnyWong16 / hide_episode_spoilers.py
Last active November 26, 2021 09:15
Automatically change episode artwork in Plex to hide spoilers.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Automatically change episode artwork in Plex to hide spoilers.
# Author: /u/SwiftPanda16
# Requires: plexapi, requests
# Tautulli script trigger:
# * Notify on recently added
# * Notify on watched (optional - to remove the artwork after being watched)
# Tautulli script conditions:
@JonnyWong16
JonnyWong16 / mark_multiepisode_watched.py
Last active May 7, 2019 20:04
Automatically mark a multi-episode file as watched in Plex.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Automatically mark a multi-episode file as watched in Plex.
# Author: /u/SwiftPanda16
# Requires: plexapi
# Tautulli script trigger:
# * Notify on watched
# Tautulli script conditions:
# * Condition {1}: