Run futurize --stage2
This commit is contained in:
parent
30dbccda77
commit
dc6507ffed
@ -99,6 +99,7 @@ optional arguments:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
@ -16,7 +16,10 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
|
from past.utils import old_div
|
||||||
import requests
|
import requests
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
import unicodedata
|
import unicodedata
|
||||||
@ -44,7 +47,7 @@ def kill_session(sess_key, message):
|
|||||||
# Check for users stream
|
# Check for users stream
|
||||||
username = session.usernames[0]
|
username = session.usernames[0]
|
||||||
if session.sessionKey == sess_key:
|
if session.sessionKey == sess_key:
|
||||||
title = unicode(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
title = str(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
||||||
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
||||||
session.stop(reason=message)
|
session.stop(reason=message)
|
||||||
print('Terminated {user}\'s stream of {title} to prioritize admin stream.'.format(user=username,
|
print('Terminated {user}\'s stream of {title} to prioritize admin stream.'.format(user=username,
|
||||||
@ -68,8 +71,8 @@ def main():
|
|||||||
if trans_dec == 'transcode' and username not in ADMIN_USER:
|
if trans_dec == 'transcode' and username not in ADMIN_USER:
|
||||||
sess_key = session.sessionKey
|
sess_key = session.sessionKey
|
||||||
percent_comp = int((float(session.viewOffset) / float(session.duration)) * 100)
|
percent_comp = int((float(session.viewOffset) / float(session.duration)) * 100)
|
||||||
time_to_comp = int(int(session.duration) - int(session.viewOffset)) / 1000 / 60
|
time_to_comp = old_div(old_div(int(int(session.duration) - int(session.viewOffset)), 1000), 60)
|
||||||
title = unicode(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
title = str(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
||||||
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
title = unicodedata.normalize('NFKD', title).encode('ascii', 'ignore').translate(None, "'")
|
||||||
add_to_dictlist(user_dict, username, [sess_key, percent_comp, title, username, time_to_comp])
|
add_to_dictlist(user_dict, username, [sess_key, percent_comp, title, username, time_to_comp])
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ Tautulli > Settings > Notification Agents > New Script > Script Arguments:
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
|
from builtins import str
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
@ -236,7 +238,7 @@ def basic_notify(notifier_id, session_id, username=None, message=None, stream=No
|
|||||||
notification.send(SUBJECT_TEXT, body)
|
notification.send(SUBJECT_TEXT, body)
|
||||||
|
|
||||||
|
|
||||||
class Tautulli:
|
class Tautulli(object):
|
||||||
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
@ -320,7 +322,7 @@ class Tautulli:
|
|||||||
return self._call_api('terminate_session', payload)
|
return self._call_api('terminate_session', payload)
|
||||||
|
|
||||||
|
|
||||||
class Stream:
|
class Stream(object):
|
||||||
def __init__(self, session_id=None, user_id=None, username=None, tautulli=None, session=None):
|
def __init__(self, session_id=None, user_id=None, username=None, tautulli=None, session=None):
|
||||||
self.state = None
|
self.state = None
|
||||||
self.ip_address = None
|
self.ip_address = None
|
||||||
@ -406,7 +408,7 @@ class Stream:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Notification:
|
class Notification(object):
|
||||||
def __init__(self, notifier_id, subject, body, tautulli, stream):
|
def __init__(self, notifier_id, subject, body, tautulli, stream):
|
||||||
self.notifier_id = notifier_id
|
self.notifier_id = notifier_id
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
|
@ -47,6 +47,7 @@ Taultulli > Settings > Notification Agents > New Script > Script Arguments:
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import range
|
||||||
import requests
|
import requests
|
||||||
import argparse
|
import argparse
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
@ -28,6 +28,10 @@ optional arguments:
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import zip
|
||||||
|
from builtins import str
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
@ -213,7 +217,7 @@ def get_geo_dict(length, users):
|
|||||||
|
|
||||||
def get_geojson_dict(user_locations):
|
def get_geojson_dict(user_locations):
|
||||||
locs = []
|
locs = []
|
||||||
for username, locations in user_locations.iteritems():
|
for username, locations in user_locations.items():
|
||||||
for location in locations:
|
for location in locations:
|
||||||
try:
|
try:
|
||||||
locs.append({
|
locs.append({
|
||||||
@ -349,9 +353,9 @@ def draw_map(map_type, geo_dict, filename, headless, leg_choice):
|
|||||||
0))
|
0))
|
||||||
labels = labels[idx:] + labels[:idx]
|
labels = labels[idx:] + labels[:idx]
|
||||||
handles = handles[idx:] + handles[:idx]
|
handles = handles[idx:] + handles[:idx]
|
||||||
by_label = OrderedDict(zip(labels, handles))
|
by_label = OrderedDict(list(zip(labels, handles)))
|
||||||
|
|
||||||
leg = plt.legend(by_label.values(), by_label.keys(), fancybox=True, fontsize='x-small',
|
leg = plt.legend(list(by_label.values()), list(by_label.keys()), fancybox=True, fontsize='x-small',
|
||||||
numpoints=1, title="Legend", labelspacing=1., borderpad=1.5, handletextpad=2.)
|
numpoints=1, title="Legend", labelspacing=1., borderpad=1.5, handletextpad=2.)
|
||||||
if leg:
|
if leg:
|
||||||
lleng = len(leg.legendHandles)
|
lleng = len(leg.legendHandles)
|
||||||
|
@ -8,6 +8,8 @@ TAUTULLI_URL + delete_media_info_cache?section_id={section_id}
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
|
from builtins import str
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -17,7 +17,9 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
|||||||
Tautulli Settings > Notification Agents > Scripts (Gear) > Script Timeout: 0 to disable or set to > 180
|
Tautulli Settings > Notification Agents > Scripts (Gear) > Script Timeout: 0 to disable or set to > 180
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
|
from past.utils import old_div
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
@ -67,7 +69,7 @@ def send_notification(subject_text, body_text):
|
|||||||
"""Format notification text."""
|
"""Format notification text."""
|
||||||
try:
|
try:
|
||||||
subject = subject_text.format(p=p, total=cc_total)
|
subject = subject_text.format(p=p, total=cc_total)
|
||||||
body = body_text.format(p=p, total=cc_total, time=TIMEOUT / 60)
|
body = body_text.format(p=p, total=cc_total, time=old_div(TIMEOUT, 60))
|
||||||
|
|
||||||
except LookupError as e:
|
except LookupError as e:
|
||||||
sys.stderr.write("Unable to substitute '{0}' in the notification subject or body".format(e))
|
sys.stderr.write("Unable to substitute '{0}' in the notification subject or body".format(e))
|
||||||
|
@ -19,6 +19,7 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
import email.utils
|
import email.utils
|
||||||
@ -244,7 +245,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
if p.media_type == 'movie':
|
if p.media_type == 'movie':
|
||||||
email_subject = MOVIE_SUBJECT.format(p=p)
|
email_subject = MOVIE_SUBJECT.format(p=p)
|
||||||
to = filter(None, [x['email'] for x in get_users() if x['user_id'] not in IGNORE_LST])
|
to = [_f for _f in [x['email'] for x in get_users() if x['user_id'] not in IGNORE_LST] if _f]
|
||||||
body_html = MOVIE_BODY.format(p=p)
|
body_html = MOVIE_BODY.format(p=p)
|
||||||
send_email(to, email_subject, body_html)
|
send_email(to, email_subject, body_html)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ Arguments passed from Tautulli
|
|||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from builtins import object
|
||||||
import argparse
|
import argparse
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
@ -18,6 +18,7 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
import email.utils
|
import email.utils
|
||||||
|
@ -10,6 +10,7 @@ Restart Tautulli.
|
|||||||
Place in Playback Start
|
Place in Playback Start
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import object
|
||||||
import argparse
|
import argparse
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
@ -9,6 +9,8 @@ Uncomment Exceptions if you run into problem and need to investigate.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
# {user} {title}
|
# {user} {title}
|
||||||
# Add to Playback Resume
|
# Add to Playback Resume
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ I corrupted a file to test.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ Usage:
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -28,6 +28,7 @@ If title is matched in both, Amazon is first then Netflix.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
import requests
|
import requests
|
||||||
import argparse
|
import argparse
|
||||||
from xmljson import badgerfish as bf
|
from xmljson import badgerfish as bf
|
||||||
|
@ -6,6 +6,7 @@ Use Tautulli to count how many plays per user occurred this week.
|
|||||||
Notify via Tautulli Notification
|
Notify via Tautulli Notification
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import object
|
||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
from plexapi.myplex import MyPlexAccount
|
from plexapi.myplex import MyPlexAccount
|
||||||
@ -40,7 +41,7 @@ VERIFY_SSL = False
|
|||||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
|
|
||||||
class Connection:
|
class Connection(object):
|
||||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
@ -75,7 +76,7 @@ class Library(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Tautulli:
|
class Tautulli(object):
|
||||||
def __init__(self, connection):
|
def __init__(self, connection):
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ class Tautulli:
|
|||||||
return self._call_api('get_libraries', payload)
|
return self._call_api('get_libraries', payload)
|
||||||
|
|
||||||
|
|
||||||
class Plex:
|
class Plex(object):
|
||||||
def __init__(self, token, url=None):
|
def __init__(self, token, url=None):
|
||||||
if token and not url:
|
if token and not url:
|
||||||
self.account = MyPlexAccount(token)
|
self.account = MyPlexAccount(token)
|
||||||
|
@ -12,6 +12,8 @@ Tautulli Settings > Extra Settings > Check - Calculate Total File Sizes [experi
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import range
|
||||||
|
from builtins import object
|
||||||
from plexapi.server import CONFIG
|
from plexapi.server import CONFIG
|
||||||
from datetime import datetime, timedelta, date
|
from datetime import datetime, timedelta, date
|
||||||
from requests import Session
|
from requests import Session
|
||||||
@ -220,7 +222,7 @@ def get_library_stats(libraries, tautulli, rich, notify=None):
|
|||||||
return sections_stats_lst
|
return sections_stats_lst
|
||||||
|
|
||||||
|
|
||||||
class Tautulli:
|
class Tautulli(object):
|
||||||
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
@ -317,7 +319,7 @@ class Tautulli:
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Notification:
|
class Notification(object):
|
||||||
def __init__(self, notifier_id, subject, body, tautulli, stats=None):
|
def __init__(self, notifier_id, subject, body, tautulli, stats=None):
|
||||||
self.notifier_id = notifier_id
|
self.notifier_id = notifier_id
|
||||||
self.subject = subject
|
self.subject = subject
|
||||||
|
@ -9,6 +9,7 @@ Add deletion via Plex.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -6,6 +6,9 @@ Find what was added TFRAME ago and not watched using Tautulli.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import input
|
||||||
|
from builtins import str
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@ -123,7 +126,7 @@ def get_libraries_table():
|
|||||||
|
|
||||||
|
|
||||||
def delete_files(tmp_lst):
|
def delete_files(tmp_lst):
|
||||||
del_file = raw_input('Delete all unwatched files? (yes/no)').lower()
|
del_file = input('Delete all unwatched files? (yes/no)').lower()
|
||||||
if del_file.startswith('y'):
|
if del_file.startswith('y'):
|
||||||
for x in tmp_lst:
|
for x in tmp_lst:
|
||||||
print("Removing {}".format(x))
|
print("Removing {}".format(x))
|
||||||
|
@ -7,6 +7,8 @@ Author: DirtyCajunRice
|
|||||||
Requires: requests, plexapi, python3.6+
|
Requires: requests, plexapi, python3.6+
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import division
|
||||||
|
from past.utils import old_div
|
||||||
from requests import Session
|
from requests import Session
|
||||||
from plexapi.server import CONFIG
|
from plexapi.server import CONFIG
|
||||||
from datetime import date, timedelta
|
from datetime import date, timedelta
|
||||||
@ -57,7 +59,7 @@ for play in HISTORY:
|
|||||||
PARAMS = {'cmd': 'get_user', 'user_id': 0}
|
PARAMS = {'cmd': 'get_user', 'user_id': 0}
|
||||||
for user, counts in USERS.items():
|
for user, counts in USERS.items():
|
||||||
TOTAL_PLAYS = counts['transcode'] + counts['direct play'] + counts['copy']
|
TOTAL_PLAYS = counts['transcode'] + counts['direct play'] + counts['copy']
|
||||||
TRANSCODE_PERCENT = round(counts['transcode'] * 100 / TOTAL_PLAYS, 2)
|
TRANSCODE_PERCENT = round(old_div(counts['transcode'] * 100, TOTAL_PLAYS), 2)
|
||||||
if TRANSCODE_PERCENT >= THRESHOLD_PERCENT:
|
if TRANSCODE_PERCENT >= THRESHOLD_PERCENT:
|
||||||
PARAMS['user_id'] = user
|
PARAMS['user_id'] = user
|
||||||
NAUGHTY = SESSION.get(FORMATTED_URL, params=PARAMS).json()['response']['data']
|
NAUGHTY = SESSION.get(FORMATTED_URL, params=PARAMS).json()['response']['data']
|
||||||
|
@ -6,6 +6,7 @@ https://gist.github.com/blacktwin/f435aa0ccd498b0840d2407d599bf31d
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import input
|
||||||
import os
|
import os
|
||||||
import httplib2
|
import httplib2
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ if credentials is None:
|
|||||||
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
|
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
|
||||||
authorize_url = flow.step1_get_authorize_url()
|
authorize_url = flow.step1_get_authorize_url()
|
||||||
print('Go to the following link in your browser: ' + authorize_url)
|
print('Go to the following link in your browser: ' + authorize_url)
|
||||||
code = raw_input('Enter verification code: ').strip()
|
code = input('Enter verification code: ').strip()
|
||||||
credentials = flow.step2_exchange(code)
|
credentials = flow.step2_exchange(code)
|
||||||
storage.put(credentials)
|
storage.put(credentials)
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
# --rating_key {rating_key} --filename {filename}
|
# --rating_key {rating_key} --filename {filename}
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import str
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
from plexapi.server import PlexServer
|
from plexapi.server import PlexServer
|
||||||
|
@ -24,6 +24,7 @@ Enabling Scripts in Tautulli:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import object
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
@ -71,7 +72,7 @@ OPTIMIZE_DEFAULT = {'targetTagID': 'Mobile',
|
|||||||
'policyUnwatched': 0,
|
'policyUnwatched': 0,
|
||||||
'videoQuality': None}
|
'videoQuality': None}
|
||||||
|
|
||||||
class Connection:
|
class Connection(object):
|
||||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
@ -160,7 +161,7 @@ class User(object):
|
|||||||
self.direct = {}
|
self.direct = {}
|
||||||
|
|
||||||
|
|
||||||
class Tautulli:
|
class Tautulli(object):
|
||||||
def __init__(self, connection):
|
def __init__(self, connection):
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ original.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import range
|
||||||
import requests
|
import requests
|
||||||
import argparse
|
import argparse
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -15,11 +15,13 @@ Requires: plexapi
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
from plexapi.server import PlexServer, CONFIG
|
from plexapi.server import PlexServer, CONFIG
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
|
|
||||||
library_name = ['Movies', 'TV Shows'] # Your library names
|
library_name = ['Movies', 'TV Shows'] # Your library names
|
||||||
|
|
||||||
@ -71,4 +73,4 @@ for library in library_name:
|
|||||||
print("ERROR, %s already exist" % image_path)
|
print("ERROR, %s already exist" % image_path)
|
||||||
else:
|
else:
|
||||||
# Save to directory
|
# Save to directory
|
||||||
urllib.urlretrieve(thumb_url, image_path)
|
urllib.request.urlretrieve(thumb_url, image_path)
|
||||||
|
@ -10,8 +10,11 @@ Skips download if showname.jpg exists or if show does not exist.
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +53,6 @@ for x in get_imgur():
|
|||||||
print("Poster for {} was already downloaded or filename already exists, skipping.".format(x.description))
|
print("Poster for {} was already downloaded or filename already exists, skipping.".format(x.description))
|
||||||
else:
|
else:
|
||||||
print("Downloading poster for {}.".format(x.description))
|
print("Downloading poster for {}.".format(x.description))
|
||||||
urllib.urlretrieve(x.link, '{}.jpg'.format((os.path.join(SHOW_PATH, x.description, x.description))))
|
urllib.request.urlretrieve(x.link, '{}.jpg'.format((os.path.join(SHOW_PATH, x.description, x.description))))
|
||||||
else:
|
else:
|
||||||
print("{} - {} did not match your library.".format(x.description, x.link))
|
print("{} - {} did not match your library.".format(x.description, x.link))
|
||||||
|
@ -9,11 +9,13 @@ Songs are saved in a 'Theme Songs' directory located in script's path.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from future import standard_library
|
||||||
|
standard_library.install_aliases()
|
||||||
from plexapi.server import PlexServer, CONFIG
|
from plexapi.server import PlexServer, CONFIG
|
||||||
# pip install plexapi
|
# pip install plexapi
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import urllib
|
import urllib.request, urllib.parse, urllib.error
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# ## Edit ##
|
# ## Edit ##
|
||||||
@ -56,4 +58,4 @@ for show in plex.library.section(TV_LIBRARY).all():
|
|||||||
# Get tvdb_if from first episode, no need to go through all episodes
|
# Get tvdb_if from first episode, no need to go through all episodes
|
||||||
tvdb_id = show.episodes()[0].guid.split('/')[2]
|
tvdb_id = show.episodes()[0].guid.split('/')[2]
|
||||||
# Download theme song to output path
|
# Download theme song to output path
|
||||||
urllib.urlretrieve(themes_url.format(tvdb_id), theme_path)
|
urllib.request.urlretrieve(themes_url.format(tvdb_id), theme_path)
|
||||||
|
@ -7,6 +7,8 @@ Deletion is prompted
|
|||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from builtins import input
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
@ -76,7 +78,7 @@ def get_history(user, start, length):
|
|||||||
|
|
||||||
|
|
||||||
def delete_files(tmp_lst):
|
def delete_files(tmp_lst):
|
||||||
del_file = raw_input('Delete all watched files? (yes/no)').lower()
|
del_file = input('Delete all watched files? (yes/no)').lower()
|
||||||
if del_file.startswith('y'):
|
if del_file.startswith('y'):
|
||||||
for x in tmp_lst:
|
for x in tmp_lst:
|
||||||
print("Removing {}".format(os.path.dirname(x)))
|
print("Removing {}".format(os.path.dirname(x)))
|
||||||
|
@ -52,6 +52,8 @@ Concurrent stream count is the trigger. Trigger can be anything you want.
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
|
||||||
|
from builtins import str
|
||||||
|
from builtins import object
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
@ -56,6 +56,7 @@ Taultulli > Settings > Notification Agents > New Script > Script Arguments:
|
|||||||
**Rating key must be a movie or episode. Shows and Seasons not support.... yet.
|
**Rating key must be a movie or episode. Shows and Seasons not support.... yet.
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from builtins import object
|
||||||
import argparse
|
import argparse
|
||||||
from plexapi.myplex import MyPlexAccount
|
from plexapi.myplex import MyPlexAccount
|
||||||
from plexapi.server import PlexServer
|
from plexapi.server import PlexServer
|
||||||
@ -79,7 +80,7 @@ if not TAUTULLI_APIKEY:
|
|||||||
VERIFY_SSL = False
|
VERIFY_SSL = False
|
||||||
|
|
||||||
|
|
||||||
class Connection:
|
class Connection(object):
|
||||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
@ -133,7 +134,7 @@ class Metadata(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Tautulli:
|
class Tautulli(object):
|
||||||
def __init__(self, connection):
|
def __init__(self, connection):
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
|
|
||||||
@ -190,7 +191,7 @@ class Tautulli:
|
|||||||
return self._call_api('get_libraries', payload)
|
return self._call_api('get_libraries', payload)
|
||||||
|
|
||||||
|
|
||||||
class Plex:
|
class Plex(object):
|
||||||
def __init__(self, token, url=None):
|
def __init__(self, token, url=None):
|
||||||
if token and not url:
|
if token and not url:
|
||||||
self.account = MyPlexAccount(token)
|
self.account = MyPlexAccount(token)
|
||||||
|
Loading…
Reference in New Issue
Block a user