Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
JonnyWong16 / notify_on_show.py
Last active October 2, 2017 09:52
Send an Email notification when a specific show is added to Plex
from email.mime.text import MIMEText
import email.utils
import smtplib
import sys
# Arguments passed from PlexPy
# {show_name} {episode_name} {season_num} {episode_num}
show_name = sys.argv[1]
# You can add more arguments if you want more details in the email body
# episode_name = sys.argv[2]
@JonnyWong16
JonnyWong16 / delete_old_plexpy_history.py
Last active June 11, 2023 14:46
Delete Tautulli history older than "X" days
### WARNING: This script has not been tested! ###
# 1. Set api_sql = 1 in the config.ini file.
# 2. Install the requests module for python.
# pip install requests
# 3. Use some method to run the script on a schedule.
import requests
## EDIT THESE SETTINGS ##
@JonnyWong16
JonnyWong16 / notify_disk_usage.py
Last active January 7, 2022 20:16
Send a Tautulli notification when disk usage exceeds a threshold.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description: Send a Tautulli notification when disk usage exceeds a threshold.
Author: /u/SwiftPanda16
Requires: psutil, requests
Tautulli script trigger:
* Notify on recently added
@JonnyWong16
JonnyWong16 / notify_transcoding_telegram.py
Last active June 30, 2016 18:18
Get notified on Telegram when a user is transcoding
# Written by pmow/Hellowlol
# Upload to Gist by JonnyWong16
# For this video transcode alert script, you should select the script for action types where it would be useful:
# Playback Start and Playback Resume, for example.
# Under Settings > Notifications > Scripts, set the parameters that should get passed to the script.
import sys
import requests
@JonnyWong16
JonnyWong16 / notify_transcoding_telegram.sh
Last active June 30, 2016 18:18
Get notified on Telegram when a user is transcoding
#!/bin/sh
# Written by pmow
# Upload to Gist by JonnyWong16
# For this video transcode alert script, you should select the script for action types where it would be useful:
# Playback Start and Playback Resume, for example.
# Under Settings > Notifications > Scripts, set the parameters that should get passed to the script.
## Telegram notification basic script
### Based on Matriphe's at https://gist.github.com/matriphe/9a51169508f266d97313
@JonnyWong16
JonnyWong16 / create_plex_library.py
Last active June 8, 2017 14:04
Create a Plex movies library using the API
import platform
import requests
from uuid import getnode
'''
Available options to create a movie library:
agent: com.plexapp.agents.imdb # Freebase
com.plexapp.agents.themoviedb # The Movie Database
com.plexapp.agents.none # Personal Media
@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 / 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 / share_unshare_libraries.py
Last active December 7, 2023 11:06
Automatically share and unshare libraries for Plex users
# Run this script using "share" or "unshare" as arguments:
# To share the Plex libraries:
# python share_unshare_libraries.py share
# To unshare the Plex libraries:
# python share_unshare_libraries.py unshare
import requests
import sys
from xml.dom import minidom
@JonnyWong16
JonnyWong16 / python_ssh.py
Last active February 12, 2024 21:09
Run a SSH command using Python
# 1. Install the paramikio module for python.
# pip install paramiko
# 2. Edit the SSH details below.
import paramiko
import sys
## EDIT SSH DETAILS ##
SSH_ADDRESS = "192.168.0.1"