Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
JonnyWong16 / rating_keys.txt
Last active December 17, 2018 00:25
Simulates shuffling of a Plex playlist to a CSV file
747
748
749
750
751
752
753
754
755
756
@JonnyWong16
JonnyWong16 / notify_ifttt_by_user.py
Last active January 19, 2019 17:00
Send an IFTTT notification for a specific username
### WARNING: This script has not been tested! ###
# 1. Install the requests module for python.
# pip install requests
# 2. Add script arguments in PlexPy.
# {user} {action}
import requests
import sys
user = sys.argv[1]
@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}:
@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 / notify_geodata.py
Last active February 25, 2020 08:26
Send a PlexPy notification with geolocation data
# 1. Install the requests module for python.
# pip install requests
# 2. Add script arguments in PlexPy. The following script arguments are available by default. More can be added below.
# -ip {ip_address} -u {user} -mt {media_type} -t {title} -pf {platform} -pl {player} -da {datestamp} -ti {timestamp}
import argparse
import requests
import sys
@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 / collection_from_rating_keys.py
Created March 5, 2017 23:09
Create a Plex collection from a text file list of rating keys.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Create a Plex collection from a text file list of rating keys.
# Author: /u/SwiftPanda16
# Requires: plexapi, requests
import requests
from plexapi.server import PlexServer
@JonnyWong16
JonnyWong16 / exec_command_no_sessions.py
Created March 5, 2017 20:02
Execute a command when no Plex sessions are active.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Execute a command when no Plex sessions are active.
# Author: /u/SwiftPanda16
# Requires: plexapi
import shlex
import subprocess
from plexapi.server import PlexServer
@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 / 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': '',