Merge remote-tracking branch 'remotes/origin/python3'
This commit is contained in:
commit
41ed4199e1
@ -105,7 +105,9 @@ optional arguments:
|
||||
- Create Aired Today Playlist from every library by Movies for admin user
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import str
|
||||
import sys
|
||||
import os
|
||||
import random
|
||||
|
@ -4,6 +4,8 @@
|
||||
"""
|
||||
https://gist.github.com/blacktwin/4ccb79c7d01a95176b8e88bf4890cd2b
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from plexapi.server import PlexServer
|
||||
import random
|
||||
|
@ -15,7 +15,12 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
||||
Buffer Warnings: kill_else_if_buffering.py
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import division
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import str
|
||||
from past.utils import old_div
|
||||
import requests
|
||||
from operator import itemgetter
|
||||
import unicodedata
|
||||
@ -43,7 +48,7 @@ def kill_session(sess_key, message):
|
||||
# Check for users stream
|
||||
username = session.usernames[0]
|
||||
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, "'")
|
||||
session.stop(reason=message)
|
||||
print('Terminated {user}\'s stream of {title} to prioritize admin stream.'.format(user=username,
|
||||
@ -67,8 +72,8 @@ def main():
|
||||
if trans_dec == 'transcode' and username not in ADMIN_USER:
|
||||
sess_key = session.sessionKey
|
||||
percent_comp = int((float(session.viewOffset) / float(session.duration)) * 100)
|
||||
time_to_comp = int(int(session.duration) - int(session.viewOffset)) / 1000 / 60
|
||||
title = unicode(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
||||
time_to_comp = old_div(old_div(int(int(session.duration) - int(session.viewOffset)), 1000), 60)
|
||||
title = str(session.grandparentTitle + ' - ' if session.type == 'episode' else '') + session.title
|
||||
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])
|
||||
|
||||
|
@ -45,8 +45,12 @@ Tautulli > Settings > Notification Agents > New Script > Script Arguments:
|
||||
Save
|
||||
Close
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from builtins import object
|
||||
from builtins import str
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
@ -102,7 +106,10 @@ def hex_to_int(value):
|
||||
|
||||
def arg_decoding(arg):
|
||||
"""Decode args, encode UTF-8"""
|
||||
return arg.decode(TAUTULLI_ENCODING).encode('UTF-8')
|
||||
if sys.version_info[0] < 3:
|
||||
return arg.decode(TAUTULLI_ENCODING).encode('UTF-8')
|
||||
else:
|
||||
return arg
|
||||
|
||||
|
||||
def debug_dump_vars():
|
||||
@ -232,7 +239,7 @@ def basic_notify(notifier_id, session_id, username=None, message=None, stream=No
|
||||
notification.send(SUBJECT_TEXT, body)
|
||||
|
||||
|
||||
class Tautulli:
|
||||
class Tautulli(object):
|
||||
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
||||
self.url = url
|
||||
self.apikey = apikey
|
||||
@ -316,7 +323,7 @@ class Tautulli:
|
||||
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):
|
||||
self.state = None
|
||||
self.ip_address = None
|
||||
@ -402,7 +409,7 @@ class Stream:
|
||||
return False
|
||||
|
||||
|
||||
class Notification:
|
||||
class Notification(object):
|
||||
def __init__(self, notifier_id, subject, body, tautulli, stream):
|
||||
self.notifier_id = notifier_id
|
||||
self.subject = subject
|
||||
|
@ -45,7 +45,10 @@ Taultulli > Settings > Notification Agents > New Script > Script Arguments:
|
||||
Save
|
||||
Close
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import range
|
||||
import requests
|
||||
import argparse
|
||||
from datetime import datetime, timedelta
|
||||
|
@ -26,7 +26,13 @@ optional arguments:
|
||||
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import zip
|
||||
from builtins import str
|
||||
from builtins import range
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import json
|
||||
@ -212,7 +218,7 @@ def get_geo_dict(length, users):
|
||||
|
||||
def get_geojson_dict(user_locations):
|
||||
locs = []
|
||||
for username, locations in user_locations.iteritems():
|
||||
for username, locations in user_locations.items():
|
||||
for location in locations:
|
||||
try:
|
||||
locs.append({
|
||||
@ -348,9 +354,9 @@ def draw_map(map_type, geo_dict, filename, headless, leg_choice):
|
||||
0))
|
||||
labels = labels[idx:] + labels[: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.)
|
||||
if leg:
|
||||
lleng = len(leg.legendHandles)
|
||||
|
@ -6,7 +6,11 @@ Find what was added TFRAME ago and not watched and notify admin using Tautulli.
|
||||
|
||||
TAUTULLI_URL + delete_media_info_cache?section_id={section_id}
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
from builtins import str
|
||||
import requests
|
||||
import sys
|
||||
import time
|
||||
|
@ -16,7 +16,11 @@ Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
||||
|
||||
Tautulli Settings > Notification Agents > Scripts (Gear) > Script Timeout: 0 to disable or set to > 180
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import division
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from past.utils import old_div
|
||||
import requests
|
||||
import sys
|
||||
import argparse
|
||||
@ -66,7 +70,7 @@ def send_notification(subject_text, body_text):
|
||||
"""Format notification text."""
|
||||
try:
|
||||
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:
|
||||
sys.stderr.write("Unable to substitute '{0}' in the notification subject or body".format(e))
|
||||
|
@ -17,7 +17,10 @@ Tautulli > Settings > Notification Agents > Scripts > Bell icon:
|
||||
Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
||||
Recently Added: notify_fav_tv_all_movie.py
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
import requests
|
||||
from email.mime.text import MIMEText
|
||||
import email.utils
|
||||
@ -243,7 +246,7 @@ if __name__ == '__main__':
|
||||
|
||||
if p.media_type == 'movie':
|
||||
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)
|
||||
send_email(to, email_subject, body_html)
|
||||
|
||||
|
@ -17,6 +17,8 @@ Arguments passed from Tautulli
|
||||
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import argparse
|
||||
import requests
|
||||
import sys
|
||||
|
@ -43,6 +43,8 @@ Note:
|
||||
The notifier_id in the edit section will need to be this other notification agent you intend to use.
|
||||
It does not have to be an active notification agent, just setup.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
|
@ -16,7 +16,10 @@ Tautulli > Settings > Notification Agents > Scripts > Bell icon:
|
||||
Tautulli > Settings > Notification Agents > Scripts > Gear icon:
|
||||
Recently Added: notify_user_favorite.py
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
import requests
|
||||
from email.mime.text import MIMEText
|
||||
import email.utils
|
||||
|
@ -9,6 +9,9 @@ Set api_sql = 1 in the config file.
|
||||
Restart Tautulli.
|
||||
Place in Playback Start
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import argparse
|
||||
import requests
|
||||
import sys
|
||||
|
@ -47,6 +47,7 @@ Tautulli > Settings > Notification Agents > New Script > Script Arguments:
|
||||
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@ -16,6 +16,7 @@ Tautulli > Settings > Notifications > Script > Script Arguments:
|
||||
|
||||
https://gist.github.com/blacktwin/261c416dbed08291e6d12f6987d9bafa
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from twitter import Twitter, OAuth
|
||||
import argparse
|
||||
|
@ -7,7 +7,11 @@ Find when media was added between STARTFRAME and ENDFRAME to Plex through Tautul
|
||||
Some Exceptions have been commented out to supress what is printed.
|
||||
Uncomment Exceptions if you run into problem and need to investigate.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import time
|
||||
@ -164,10 +168,10 @@ for i in glt:
|
||||
# Find movie rating_key.
|
||||
show_lst += [int(x.rating_key)]
|
||||
except Exception as e:
|
||||
print("Rating_key failed: {e}").format(e=e)
|
||||
print(("Rating_key failed: {e}").format(e=e))
|
||||
|
||||
except Exception as e:
|
||||
print("Library media info failed: {e}").format(e=e)
|
||||
print(("Library media info failed: {e}").format(e=e))
|
||||
|
||||
# All rating_keys for episodes and movies.
|
||||
# Reserving order will put newest rating_keys first
|
||||
|
@ -7,6 +7,8 @@
|
||||
# {user} {title}
|
||||
# Add to Playback Resume
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
|
||||
|
@ -6,7 +6,10 @@ Run script by itself. Will look for WARN code followed by /library/metadata/ str
|
||||
This is find files that are corrupt or having playback issues.
|
||||
I corrupted a file to test.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import psutil
|
||||
import requests
|
||||
|
||||
|
@ -24,7 +24,10 @@ Usage:
|
||||
Plays: 56 : 754 : 2899
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import str
|
||||
import requests
|
||||
import sys
|
||||
import argparse
|
||||
|
@ -17,6 +17,8 @@ Usage:
|
||||
Movies - Plays: 379
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import requests
|
||||
import sys
|
||||
|
@ -26,7 +26,10 @@ optional arguments:
|
||||
|
||||
If title is matched in both, Amazon is first then Netflix.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import str
|
||||
import requests
|
||||
import argparse
|
||||
from xmljson import badgerfish as bf
|
||||
|
@ -17,6 +17,8 @@ Requires: requests, plexapi
|
||||
python find_diff_other_servers.py --server "My Plex Server" --server PlexServer2 --server "Steven Plex"
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
import requests
|
||||
|
@ -5,7 +5,9 @@
|
||||
Use Tautulli to count how many plays per user occurred this week.
|
||||
Notify via Tautulli Notification
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import time
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import time
|
||||
import argparse
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
@ -39,7 +42,7 @@ VERIFY_SSL = False
|
||||
timestr = time.strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
|
||||
class Connection:
|
||||
class Connection(object):
|
||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||
self.url = url
|
||||
self.apikey = apikey
|
||||
@ -74,7 +77,7 @@ class Library(object):
|
||||
pass
|
||||
|
||||
|
||||
class Tautulli:
|
||||
class Tautulli(object):
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
@ -127,7 +130,7 @@ class Tautulli:
|
||||
return self._call_api('get_libraries', payload)
|
||||
|
||||
|
||||
class Plex:
|
||||
class Plex(object):
|
||||
def __init__(self, token, url=None):
|
||||
if token and not url:
|
||||
self.account = MyPlexAccount(token)
|
||||
@ -292,7 +295,7 @@ if __name__ == '__main__':
|
||||
else:
|
||||
user_dict[user] = {library: section_watched_total}
|
||||
except Exception as e:
|
||||
print(user, e)
|
||||
print((user, e))
|
||||
if user_dict.get(user):
|
||||
user_dict[user].update({library: 0})
|
||||
else:
|
||||
@ -341,7 +344,7 @@ if __name__ == '__main__':
|
||||
start += count
|
||||
|
||||
except Exception as e:
|
||||
print(user, e)
|
||||
print((user, e))
|
||||
|
||||
section_watched_total = len(list(set(section_watched_lst)))
|
||||
percent_watched = 100 * (float(section_watched_total) / float(section_total))
|
||||
|
@ -11,6 +11,10 @@ User stats display username and hour, minutes, and seconds of view time
|
||||
Tautulli Settings > Extra Settings > Check - Calculate Total File Sizes [experimental] ...... wait
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import range
|
||||
from builtins import object
|
||||
from plexapi.server import CONFIG
|
||||
from datetime import datetime, timedelta, date
|
||||
from requests import Session
|
||||
@ -219,7 +223,7 @@ def get_library_stats(libraries, tautulli, rich, notify=None):
|
||||
return sections_stats_lst
|
||||
|
||||
|
||||
class Tautulli:
|
||||
class Tautulli(object):
|
||||
def __init__(self, url, apikey, verify_ssl=False, debug=None):
|
||||
self.url = url
|
||||
self.apikey = apikey
|
||||
@ -316,7 +320,7 @@ class Tautulli:
|
||||
return
|
||||
|
||||
|
||||
class Notification:
|
||||
class Notification(object):
|
||||
def __init__(self, notifier_id, subject, body, tautulli, stats=None):
|
||||
self.notifier_id = notifier_id
|
||||
self.subject = subject
|
||||
|
@ -17,6 +17,8 @@
|
||||
# * Recently Added:
|
||||
# --title {title} --section_id {section_id} --media_type {media_type} --rating_key {rating_key} --parent_rating_key {parent_rating_key} --grandparent_rating_key {grandparent_rating_key} --label "Label"
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import argparse
|
||||
import os
|
||||
import requests
|
||||
|
@ -16,6 +16,8 @@ optional arguments:
|
||||
|
||||
List of IP addresses is cleared before adding new IPs
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import requests
|
||||
import argparse
|
||||
|
@ -7,7 +7,10 @@ If all users in list have watched an episode of listed show, then delete episode
|
||||
|
||||
Add deletion via Plex.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import os
|
||||
|
@ -6,6 +6,8 @@
|
||||
Author: DirtyCajunRice
|
||||
Requires: requests, python3.6+
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from requests import Session
|
||||
from json.decoder import JSONDecodeError
|
||||
|
@ -10,6 +10,8 @@ or
|
||||
find_plex_meta.py -s adventure -m movie
|
||||
pulls all movie titles with adventure in the title
|
||||
'''
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
|
@ -4,7 +4,12 @@
|
||||
"""
|
||||
Find what was added TFRAME ago and not watched using Tautulli.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import input
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import time
|
||||
@ -122,7 +127,7 @@ def get_libraries_table():
|
||||
|
||||
|
||||
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'):
|
||||
for x in tmp_lst:
|
||||
print("Removing {}".format(x))
|
||||
@ -148,10 +153,10 @@ for i in glt:
|
||||
# Find movie rating_key.
|
||||
show_lst += [int(x.rating_key)]
|
||||
except Exception as e:
|
||||
print("Rating_key failed: {e}").format(e=e)
|
||||
print(("Rating_key failed: {e}").format(e=e))
|
||||
|
||||
except Exception as e:
|
||||
print("Library media info failed: {e}").format(e=e)
|
||||
print(("Library media info failed: {e}").format(e=e))
|
||||
|
||||
# Remove reverse sort if you want the oldest keys first.
|
||||
for i in sorted(show_lst, reverse=True):
|
||||
@ -169,7 +174,7 @@ for i in sorted(show_lst, reverse=True):
|
||||
path_lst += [x.file]
|
||||
|
||||
except Exception as e:
|
||||
print("Metadata failed. Likely end of range: {e}").format(e=e)
|
||||
print(("Metadata failed. Likely end of range: {e}").format(e=e))
|
||||
|
||||
|
||||
delete_files(path_lst)
|
||||
|
@ -6,6 +6,10 @@
|
||||
Author: DirtyCajunRice
|
||||
Requires: requests, plexapi, python3.6+
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import division
|
||||
from __future__ import unicode_literals
|
||||
from past.utils import old_div
|
||||
from requests import Session
|
||||
from plexapi.server import CONFIG
|
||||
from datetime import date, timedelta
|
||||
@ -56,7 +60,7 @@ for play in HISTORY:
|
||||
PARAMS = {'cmd': 'get_user', 'user_id': 0}
|
||||
for user, counts in USERS.items():
|
||||
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:
|
||||
PARAMS['user_id'] = user
|
||||
NAUGHTY = SESSION.get(FORMATTED_URL, params=PARAMS).json()['response']['data']
|
||||
|
@ -4,7 +4,10 @@
|
||||
"""
|
||||
https://gist.github.com/blacktwin/f435aa0ccd498b0840d2407d599bf31d
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import input
|
||||
import os
|
||||
import httplib2
|
||||
|
||||
@ -34,7 +37,7 @@ if credentials is None:
|
||||
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
|
||||
authorize_url = flow.step1_get_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)
|
||||
storage.put(credentials)
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
# * Watched (optional):
|
||||
# --rating_key {rating_key} --file {file} --remove
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import argparse
|
||||
import os
|
||||
import requests
|
||||
|
@ -15,6 +15,9 @@
|
||||
# * Watched:
|
||||
# --rating_key {rating_key} --filename {filename}
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import str
|
||||
import argparse
|
||||
import os
|
||||
from plexapi.server import PlexServer
|
||||
|
@ -23,6 +23,9 @@ Enabling Scripts in Tautulli:
|
||||
python media_manager.py --libraries "TV Shows" --select watched --users User1 User2
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import argparse
|
||||
import datetime
|
||||
import time
|
||||
@ -70,7 +73,7 @@ OPTIMIZE_DEFAULT = {'targetTagID': 'Mobile',
|
||||
'policyUnwatched': 0,
|
||||
'videoQuality': None}
|
||||
|
||||
class Connection:
|
||||
class Connection(object):
|
||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||
self.url = url
|
||||
self.apikey = apikey
|
||||
@ -159,7 +162,7 @@ class User(object):
|
||||
self.direct = {}
|
||||
|
||||
|
||||
class Tautulli:
|
||||
class Tautulli(object):
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
@ -594,7 +597,7 @@ if __name__ == '__main__':
|
||||
if opts.select == "watched":
|
||||
if libraries:
|
||||
for user in user_lst:
|
||||
print("Finding watched items from user: {}",format(user.name))
|
||||
print(("Finding watched items from user: {}",format(user.name)))
|
||||
for _library in libraries:
|
||||
print("Checking library: '{}' watch statuses...".format(_library.title))
|
||||
watched_work(user=user, sectionID=_library.key)
|
||||
|
@ -44,7 +44,10 @@ original.
|
||||
* For episodes of show not watched the view count will be set to 1.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import range
|
||||
import requests
|
||||
import argparse
|
||||
import datetime
|
||||
|
@ -36,6 +36,8 @@ Usage:
|
||||
- Share Movie library with USER but restrict them to only G and PG-13 titles.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
import argparse
|
||||
|
@ -36,6 +36,8 @@ Usage:
|
||||
- USER is still exists as a Friend or Home User
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import argparse
|
||||
|
@ -13,12 +13,16 @@ Requires: plexapi
|
||||
python plex_api_poster_pull.py
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
import requests
|
||||
import re
|
||||
import os
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
|
||||
library_name = ['Movies', 'TV Shows'] # Your library names
|
||||
|
||||
@ -70,4 +74,4 @@ for library in library_name:
|
||||
print("ERROR, %s already exist" % image_path)
|
||||
else:
|
||||
# Save to directory
|
||||
urllib.urlretrieve(thumb_url, image_path)
|
||||
urllib.request.urlretrieve(thumb_url, image_path)
|
||||
|
@ -98,6 +98,8 @@ Usage:
|
||||
- Shared [all libraries but Movies] with USER.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
import time
|
||||
|
@ -24,6 +24,8 @@ python plex_api_show_settings.py --libraries "TV Shows" --watched 7
|
||||
python plex_api_show_settings.py --libraries "TV Shows" --unwatched -7
|
||||
- Keep Episodesfrom the past 7 days
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import argparse
|
||||
import requests
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
|
@ -45,6 +45,8 @@ Script Dance moves
|
||||
Please use this script to update your Tautulli database with the new rating key
|
||||
https://gist.github.com/JonnyWong16/f554f407832076919dc6864a78432db2
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from plexapi.server import PlexServer
|
||||
from plexapi.server import CONFIG
|
||||
|
@ -8,9 +8,14 @@ Pull poster images from Imgur and places them inside Shows root folder.
|
||||
Skips download if showname.jpg exists or if show does not exist.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import object
|
||||
import requests
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import os
|
||||
|
||||
|
||||
@ -49,6 +54,6 @@ for x in get_imgur():
|
||||
print("Poster for {} was already downloaded or filename already exists, skipping.".format(x.description))
|
||||
else:
|
||||
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:
|
||||
print("{} - {} did not match your library.".format(x.description, x.link))
|
||||
|
@ -16,6 +16,8 @@ optional arguments:
|
||||
* LIBRARY_EXCLUDE are excluded from libraries choice.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import requests
|
||||
|
@ -7,13 +7,16 @@ 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 __future__ import unicode_literals
|
||||
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from plexapi.server import PlexServer, CONFIG
|
||||
# pip install plexapi
|
||||
import os
|
||||
import re
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import requests
|
||||
|
||||
# ## Edit ##
|
||||
@ -56,4 +59,4 @@ for show in plex.library.section(TV_LIBRARY).all():
|
||||
# Get tvdb_if from first episode, no need to go through all episodes
|
||||
tvdb_id = show.episodes()[0].guid.split('/')[2]
|
||||
# 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)
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
Author: DirtyCajunRice
|
||||
Requires: requests, plexapi, python3.6+
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from requests import Session
|
||||
from plexapi.server import CONFIG
|
||||
|
@ -14,6 +14,8 @@
|
||||
# * Recently Added:
|
||||
# --rating_key {rating_key} --collection "New Releases" --days 180
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
import argparse
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
|
@ -15,6 +15,8 @@ Check Tautulli's Watched Percent in Tautulli > Settings > General
|
||||
{show_name} {episode_num00} {season_num00}
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import requests
|
||||
import sys
|
||||
|
@ -7,6 +7,8 @@ Just run.
|
||||
|
||||
Comment out `remove_friend(username)` and `unshare(username)` to test.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from sys import exit
|
||||
from requests import Session
|
||||
from datetime import datetime
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Author: /u/SwiftPanda16
|
||||
# Requires: plexapi
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
### EDIT SETTINGS ###
|
||||
|
@ -5,7 +5,11 @@
|
||||
|
||||
Deletion is prompted
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import input
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
import os
|
||||
@ -75,7 +79,7 @@ def get_history(user, start, length):
|
||||
|
||||
|
||||
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'):
|
||||
for x in tmp_lst:
|
||||
print("Removing {}".format(os.path.dirname(x)))
|
||||
|
@ -5,6 +5,8 @@
|
||||
# Author: /u/SwiftPanda16
|
||||
# Requires: plexapi
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from plexapi.server import PlexServer
|
||||
|
||||
|
||||
|
@ -49,8 +49,12 @@ Clear user history for banned video to remove violation counts and run manually
|
||||
Concurrent stream count is the trigger. Trigger can be anything you want.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import requests
|
||||
import sys
|
||||
from xml.dom import minidom
|
||||
|
@ -55,6 +55,9 @@ Taultulli > Settings > Notification Agents > New Script > Script Arguments:
|
||||
on selected servers.
|
||||
**Rating key must be a movie or episode. Shows and Seasons not support.... yet.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from builtins import object
|
||||
import argparse
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
from plexapi.server import PlexServer
|
||||
@ -78,7 +81,7 @@ if not TAUTULLI_APIKEY:
|
||||
VERIFY_SSL = False
|
||||
|
||||
|
||||
class Connection:
|
||||
class Connection(object):
|
||||
def __init__(self, url=None, apikey=None, verify_ssl=False):
|
||||
self.url = url
|
||||
self.apikey = apikey
|
||||
@ -132,7 +135,7 @@ class Metadata(object):
|
||||
pass
|
||||
|
||||
|
||||
class Tautulli:
|
||||
class Tautulli(object):
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
@ -189,7 +192,7 @@ class Tautulli:
|
||||
return self._call_api('get_libraries', payload)
|
||||
|
||||
|
||||
class Plex:
|
||||
class Plex(object):
|
||||
def __init__(self, token, url=None):
|
||||
if token and not url:
|
||||
self.account = MyPlexAccount(token)
|
||||
|
@ -6,6 +6,8 @@
|
||||
Author: DirtyCajunRice
|
||||
Requires: requests, python3.6+
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
from requests import Session
|
||||
from plexapi.server import CONFIG
|
||||
from urllib3 import disable_warnings
|
||||
|
Loading…
Reference in New Issue
Block a user