Skip to content

Instantly share code, notes, and snippets.

@JonnyWong16
JonnyWong16 / remove_movie_collections.py
Last active October 20, 2023 22:34
Removes ALL collections from ALL movies.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Removes ALL collections from ALL movies.
# Author: /u/SwiftPanda16
# Requires: plexapi
from plexapi.server import PlexServer
### EDIT SETTINGS ###
@tarnecki
tarnecki / sync_playlists_to_users.py
Created May 12, 2017 18:23 — forked from JonnyWong16/sync_playlists_to_users.py
Sync Plex playlists to shared users.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi, requests, xmltodict
import requests
import xmltodict
@zentralwerkstatt
zentralwerkstatt / instructions.md
Last active February 2, 2025 22:29
Install Syncthing on Linux
  • Install the necessary packages:
sudo apt-get install apt-transport-https ca-certificates
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing
sudo apt-get install git
  • Start syncthing once:
@blacktwin
blacktwin / grab_gdrive_media.py
Created April 10, 2017 14:29
Grab media (videos, pictures) from Google Drive. All videos and pictures were automatically synced from Google Photos to Google Drive. Puts media into MEDIA_TYPE/YEAR/MONTH-DAY/FILE.ext directory structure.
# -*- encoding: UTF-8 -*-
import os
import httplib2
# pip install --upgrade google-api-python-client
from oauth2client.file import Storage
from googleapiclient.discovery import build
from oauth2client.client import OAuth2WebServerFlow
@blacktwin
blacktwin / create_wait_kill_all.py
Last active June 11, 2018 16:43
Receive session_key from PlexPy when paused. Use session_id to create sub-script to wait for X time then check if still paused. If paused kill.
'''
fetch function from https://gist.github.com/Hellowlol/ee47b6534410b1880e19
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on pause
PlexPy > Settings > Notification Agents > Scripts > Gear icon:
Playback Pause: create_wait_kill_all.py
PlexPy > Settings > Notifications > Script > Script Arguments:
{session_key}
@blacktwin
blacktwin / notify_fav_tv_all_movie.py
Last active December 19, 2017 22:38
Notify users of recently added episode to show that they have watched at least LIMIT times via email. Also notify users of new movies.
"""
Notify users of recently added episode to show that they have watched at least LIMIT times via email.
Also notify users of new movies.
Block users with IGNORE_LST.
Arguments passed from PlexPy
-sn {show_name} -ena {episode_name} -ssn {season_num00} -enu {episode_num00} -srv {server_name} -med {media_type}
-pos {poster_url} -tt {title} -sum {summary} -lbn {library_name} -grk {grandparent_rating_key}
You can add more arguments if you want more details in the email body
@blacktwin
blacktwin / kill_more_than.py
Last active July 15, 2023 19:05
If user has 2* or more concurrent streams and the IP of the 2nd stream differs from 1st kill 2nd. If 2nd stream IP is the same as 1st stream don't kill.
"""
If user has 2* or more concurrent streams and the IP of the 2nd stream differs from 1st kill 2nd.
If 2nd stream IP is the same as 1st stream don't kill.
*PlexPy > Settings > Notification> User Concurrent Stream Threshold
The number of concurrent streams by a single user for PlexPy to trigger a notification. Minimum 2.
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on user concurrent streams
@blacktwin
blacktwin / aired_today_playlist.py
Created February 26, 2017 22:25
Create a Plex Playlist with what was aired on this today's month-day, sort by oldest first, using PlexAPI
"""
Create a Plex Playlist with what was aired on this today's month-day, sort by oldest first.
If Playlist from yesterday exists delete and create today's.
If today's Playlist exists exit.
"""
import operator, time
from plexapi.server import PlexServer
import requests
@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.
@austinheap
austinheap / bars.txt
Created October 25, 2016 16:33
Rainbow Pi-hole with screensaver for LCD screens
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████
████████████████████████████████████████████████