Skip to content

Instantly share code, notes, and snippets.

@blacktwin
blacktwin / find_plex_meta.py
Last active July 19, 2023 15:53
Find location of Plex metadata.
'''
Find location of Plex metadata.
find_plex_meta.py -s adventure
pulls all titles with adventure in the title
or
find_plex_meta.py -s adventure -m movie
pulls all movie titles with adventure in the title
'''
@blacktwin
blacktwin / plex_theme_songs.py
Last active April 16, 2024 02:47
Download theme songs from Plex TV Shows.
'''
Download theme songs from Plex TV Shows. Theme songs are mp3 and named by shows as displayed by Plex.
Songs are saved in a 'Theme Songs' directory located in script's path.
'''
from plexapi.server import PlexServer
# pip install plexapi
import os
@blacktwin
blacktwin / plex_imgur_dl.py
Last active March 27, 2018 05:23
Pull poster images from Imgur and places them inside Shows root folder.
'''
Pull poster images from Imgur and places them inside Shows root folder.
/path/to/show/Show.jpg
Skips download if showname.jpg exists or if show does not exist.
'''
import requests
import urllib
@blacktwin
blacktwin / new_kill_trans_pause.py
Last active October 17, 2019 04:13
Kill Plex paused video transcoding streams using PlexPy.
"""
Kill Plex paused video transcoding streams.
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on playback pause
PlexPy > Settings > Notification Agents > Scripts > Gear icon:
Playback Pause: new_kill_trans_pause.py
"""
@blacktwin
blacktwin / plex_api_poster_pull.py
Last active March 17, 2024 19:30
Pull Movie and TV Show poster images from Plex.
'''
Pull Movie and TV Show poster images from Plex.
Save to Movie and TV Show directories in scripts working directory.
'''
from plexapi.server import PlexServer
# pip install plexapi
import re
@blacktwin
blacktwin / kill_else_if_buffering.py
Created May 19, 2017 18:22
Kill concurrent transcode streams of other users if Admin user is experiencing buffering warnings from PlexPy.
'''
If server admin stream is experiencing buffering and there are concurrent transcode streams from
another user, kill concurrent transcode stream that has the lowest percent complete. Message in
kill stream will list why it was killed ('Server Admin's stream take priority and this user has X
concurrent streams'). Message will also include an approximation of when the other concurrent stream
will finish, stream that is closest to finish will be used.
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on buffer warning
@blacktwin
blacktwin / kill_trans_exp_audio.py
Last active December 13, 2023 02:56
Kill Plex video transcoding streams only. All audio streams are left alone. Kill message based on platform.
"""
Kill Plex video transcoding streams only. All audio streams are left alone.
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on playback start
PlexPy > Settings > Notification Agents > Scripts > Gear icon:
Playback Start: kill_trans_exp_audio.py
"""
@blacktwin
blacktwin / twitter_notify.py
Last active May 4, 2017 19:25
Post to Twitter when TV/Movie is added to Plex. Include custom message and embed poster image. Option to tweet to TWITTER_USER if title is inside TITLE_FIND.
"""
1. Install the requests module for python.
pip install requests
pip install twitter
PlexPy > Settings > Notification Agents > Scripts > Bell icon:
[X] Notify on Recently Added
PlexPy > Settings > Notification Agents > Scripts > Gear icon:
Playback Recently Added: twitter_notify.py
PlexPy > Settings > Notifications > Script > Script Arguments:
@blacktwin
blacktwin / plexapi_haiku.py
Created May 1, 2017 15:43
Randomly create haiku based on Plex libraries content.
from plexapi.server import PlexServer
import random
import re
baseurl = 'http://localhost:32400'
token = 'XXXXXXXXXX'
plex = PlexServer(baseurl, token)
@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