This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
urllib2 | |
from uuid import getnode | |
import platform | |
import json | |
ip = '' | |
port = '' | |
plextoken = '' | |
url = 'http://%s:%s/' % (ip, port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM Add this script to Plex down and/or Plex remote down to restart plex if | |
REM server is unreachable. | |
TASKKILL /f /im "Plex Media Server.exe" | |
TASKKILL /f /im "PlexScriptHost.exe" | |
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
from collections import Counter | |
from functools import wraps | |
import arrow | |
def timeme(func): | |
@wraps(func) | |
def inner(*args, **kwargs): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
import platform | |
import subprocess | |
import urllib2 | |
import logging | |
""" Are we windoze or linux """ | |
is_windows = any(platform.win32_ver()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import json | |
def get_media_info(path, format='dict'): | |
""" Note this is media info cli """ | |
cmd = 'mediainfo "%s"' % (path) | |
process = subprocess.Popen(cmd, | |
shell=False, | |
stdin=subprocess.PIPE, | |
stdout=subprocess.PIPE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def convert_size(size, ): | |
if (size == 0): | |
return '0B' | |
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") | |
i = int(math.floor(math.log(size,1024))) | |
p = math.pow(1024,i) | |
s = round(size/p,2) | |
return '%s %s' % (s,size_name[i]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
from multiprocessing.dummy import Pool as ThreadPool | |
import urllib3 | |
try: | |
from ujson import dumps | |
except ImportError: | |
try: | |
from simplejson import dumps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip instaal pyqrcode | |
# pip install pypng | |
import pyqrcode | |
url = pyqrcode.create('http://plexpy.rocks') | |
loads_of_info = pyqrcode.create('I::LIKE::BIG::BUTTS::AND::I::CANT::LIE') | |
url.png('url.png') | |
loads_of_info.png('info.png') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assertme(m, monsterassert=True): | |
with open('asserted.txt', 'w') as f: | |
todo = [] | |
def inner(m=None, override_name=''): | |
keys = sorted([k for k in m.__dict__.keys() if not k.startswith('_')]) | |
tags = ['genres', 'roles', 'writers', 'directors', 'writers'] | |
l_type_to_inspect = ['videoStreams', 'part', 'subtitleStreams', | |
'media', 'audioStreams', 'parts', 'streams', 'video'] | |
for k in keys: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. | |
""" | |
# Untested requires plexapi 3.0.0. | |
from plexapi.server import PlexServer | |
import requests |