Skip to content

Instantly share code, notes, and snippets.

@blacktwin
blacktwin / stream_limiter_ban_email.py
Last active October 27, 2020 21:33
This is indented to restrict a user to the LIMIT amount of concurrent streams. User will be warned, punished, and banned completely if violations continue.
"""
Share functions from https://gist.github.com/JonnyWong16/f8139216e2748cb367558070c1448636
Once user stream count hits LIMIT they are unshared from libraries expect for banned library.
Once user stream count is below LIMIT and banned library video is watched their shares are restored.
Once violation count have been reached ban permanently.
Caveats:
Unsharing doesn't pause the stream.
After unsharing user can pause but not skip ahead or skip back.
@blacktwin
blacktwin / find_unwatched.py
Last active December 11, 2018 03:40
Find what was added TFRAME ago and not watched using PlexPy.
"""
Find what was added TFRAME ago and not watched using PlexPy.
"""
import requests
import sys
import time
@blacktwin
blacktwin / find_unwatched_notify.py
Last active December 11, 2018 03:23
Find what was added TFRAME ago and not watched and notify admin using PlexPy.
"""
Find what was added TFRAME ago and not watched and notify admin using PlexPy.
"""
import requests
import sys
import time
@blacktwin
blacktwin / plexpy_sql_month.py
Last active January 31, 2017 19:35
Find when media was added between STARTFRAME and ENDFRAME to Plex through PlexPy.
"""
Find when media was added between STARTFRAME and ENDFRAME to Plex through PlexPy.
This will only show for what has been wached.
api_sql must be manually enabled in the config file.
"""
import requests
@blacktwin
blacktwin / added_to_plex.py
Last active February 16, 2017 12:50
Find when media was added between STARTFRAME and ENDFRAME to Plex through PlexPy.
"""
Find when media was added between STARTFRAME and ENDFRAME to Plex through PlexPy.
Some Exceptions have been commented out to supress what is printed.
Uncomment Exceptions if you run into problem and need to investigate.
"""
import requests
import sys
import time
@blacktwin
blacktwin / plexapi_delete_playlists.py
Created February 3, 2017 20:02
Delete all playlists from Plex using PlexAPI
"""
Delete all playlists from Plex using PlexAPI
https://github.com/mjs7231/python-plexapi
"""
from plexapi.server import PlexServer
import requests
baseurl = 'http://localhost:32400'
@blacktwin
blacktwin / notify_added_lastweek.py
Last active December 18, 2018 16:06
Send an email with what was added to Plex in the past week using PlexPy.
"""
Send an email with what was added to Plex in the past week using PlexPy.
Email includes title (TV: Show Name: Episode Name; Movie: Movie Title), time added, image, and summary.
"""
import requests
import sys
import time
import os
from email.mime.text import MIMEText
@blacktwin
blacktwin / userplays_weekly_reporting.py
Created February 9, 2017 18:48
Use PlexPy to count how many plays per user occurred this week and send email via PlexPy.
"""
Use PlexPy to count how many plays per user occurred this week.
Notify via PlexPy Notification
"""
import requests
import sys
import time
TODAY = int(time.time())
@blacktwin
blacktwin / added_lastweek_FB.py
Created February 14, 2017 14:18
Notify FaceBook on what was added to Plex last week.
import requests
import sys
import time
TODAY = int(time.time())
LASTWEEK = int(TODAY - 7 * 24 * 60 * 60)
## EDIT THESE SETTINGS ##
PLEXPY_APIKEY = 'XXXXXX' # Your PlexPy API key
@blacktwin
blacktwin / IFTTT_notify.py
Created February 14, 2017 18:54
Send IFTTT notification. Ignore any titles that are listed.
# 1. Install the requests module for python.
# pip install requests
# 2. Add script arguments in PlexPy.
# {server_name} {user} {title} {player} {platform}
import requests
import sys
server_name = sys.argv[1]
user = sys.argv[2]