Remove image server

This commit is contained in:
burkasaurusrex 2020-09-28 02:55:39 -06:00
parent 4fe7a53d77
commit 3779119823
4 changed files with 250 additions and 334 deletions

View file

@ -1,20 +1,11 @@
# -*- coding: UTF-8 -*-
import os
import yaml
import requests
import socket
import urllib
from plexapi.server import PlexServer
from plexapi.video import Movie
from plexapi.video import Show
from plexapi.library import MovieSection
from plexapi.library import ShowSection
from plexapi.library import Collections
from plex_tools import get_actor_rkey
from plex_tools import add_to_collection
from plex_tools import get_collection
from radarr_tools import add_to_radarr
from imdb_tools import tmdb_get_summary
from trakt import Trakt
import trakt_helpers
@ -115,228 +106,52 @@ class TraktClient:
class ImageServer:
def __init__(self, config_path, mode="server"):
def __init__(self, config_path):
config = Config(config_path).image_server
# Best defaults for "host" are 0.0.0.0 for server and 127.0.0.1 for client
# Set respective defaults in server and client
if 'host' in config:
self.host = config['host']
print("Attempting to find posters directory")
if 'poster-directory' in config:
self.posterdirectory = config['poster-directory']
else:
if mode == "server":
self.host = "0.0.0.0"
else:
self.host = "127.0.0.1"
# Set default port
if 'port' in config:
self.port = config['port']
else:
self.port = 5000
# Test and set default folder path
if mode == "server":
print("Attempting to find posters directory")
if 'poster-directory' in config:
self.posterdirectory = config['poster-directory']
else:
app_dir = os.path.dirname(os.path.realpath(__file__))
app_dir = os.path.dirname(os.path.realpath(__file__))
# Test separate config directory with nested 'posters' directory
if os.path.exists(os.path.join(app_dir, "..", "config", "posters")):
self.posterdirectory = os.path.join("..", "config", "posters")
# Test separate config folder with nested 'images' directory
elif os.path.exists(os.path.join(app_dir, "..", "config", "images")):
self.posterdirectory = os.path.join("..", "config", "images")
# Test nested posters directory
elif os.path.exists(os.path.join(app_dir, "posters")):
self.posterdirectory = "posters"
# Test nested images directory
elif os.path.exists(os.path.join(app_dir, "images")):
self.posterdirectory = "images"
else:
raise RuntimeError("Invalid poster-directory setting")
# Test separate config directory with nested 'posters' directory
if os.path.exists(os.path.join(app_dir, "..", "config", "posters")):
self.posterdirectory = os.path.abspath(os.path.join(app_dir, "..", "config", "posters"))
# Test separate config folder with nested 'images' directory
elif os.path.exists(os.path.join(app_dir, "..", "config", "images")):
self.posterdirectory = os.path.abspath(os.path.join(app_dir, "..", "config", "images"))
# Test nested posters directory
elif os.path.exists(os.path.join(app_dir, "posters")):
self.posterdirectory = os.path.abspath(os.path.join(app_dir, "posters"))
# Test nested images directory
elif os.path.exists(os.path.join(app_dir, "images")):
self.posterdirectory = os.path.abspath(os.path.join(app_dir, "images"))
else:
print("Invalid poster-directory setting")
if self.posterdirectory:
print("Using {} as poster directory".format(self.posterdirectory))
print("Attempting to find backgrounds directory")
if 'background-directory' in config:
self.backgrounddirectory = config['background-directory']
else:
app_dir = os.path.dirname(os.path.realpath(__file__))
def update_from_config(config_path, plex, headless=False):
config = Config(config_path)
collections = config.collections
if isinstance(plex.Library, MovieSection):
libtype = "movie"
elif isinstance(plex.Library, ShowSection):
libtype = "show"
for c in collections:
print("Updating collection: {}...".format(c))
methods = [m for m in collections[c] if m not in ("details", "subfilters")]
subfilters = []
if "subfilters" in collections[c]:
for sf in collections[c]["subfilters"]:
sf_string = sf, collections[c]["subfilters"][sf]
subfilters.append(sf_string)
for m in methods:
if isinstance(collections[c][m], list):
# Support multiple imdb/tmdb/trakt lists
values = collections[c][m]
# Test separate config directory with nested 'posters' directory
if os.path.exists(os.path.join(app_dir, "..", "config", "backgrounds")):
self.backgrounddirectory = os.path.abspath(os.path.join(app_dir, "..", "config", "backgrounds"))
# Test nested posters directory
elif os.path.exists(os.path.join(app_dir, "backgrounds")):
self.backgrounddirectory = os.path.abspath(os.path.join(app_dir, "backgrounds"))
else:
values = collections[c][m].split(", ")
for v in values:
if m[-1:] == "s":
m_print = m[:-1]
else:
m_print = m
print("Processing {}: {}".format(m_print, v))
if m == "actors" or m == "actor":
v = get_actor_rkey(plex, v)
try:
missing = add_to_collection(config_path, plex, m, v, c, subfilters)
except UnboundLocalError: # No sub-filters
missing = add_to_collection(config_path, plex, m, v, c)
except (KeyError, ValueError) as e:
print(e)
missing = False
if missing:
if libtype == "movie":
if "imdb" in m:
method_name = "IMDb"
elif "trakt" in m:
method_name = "Trakt"
else:
method_name = "TMDb"
print("{} missing movies from {} List: {}".format(len(missing), method_name, v))
if 'add_movie' in config.radarr:
if config.radarr['add_movie'] is True:
print("Adding missing movies to Radarr")
add_to_radarr(config_path, missing)
else:
if input("Add missing movies to Radarr? (y/n): ").upper() == "Y":
add_to_radarr(config_path, missing)
elif libtype == "show":
if "trakt" in m:
method_name = "Trakt"
else:
method_name = "TMDb"
print("{} missing shows from {} List: {}".format(len(missing), method_name, v))
# if not skip_sonarr:
# if input("Add missing shows to Sonarr? (y/n): ").upper() == "Y":
# add_to_radarr(missing_shows)
# Multiple collections of the same name
if "details" in collections[c]:
# # Check if there are multiple collections with the same name
# movie_collections = plex.MovieLibrary.search(title=c, libtype="collection")
# show_collections = plex.ShowLibrary.search(title=c, libtype="collection")
# if len(movie_collections + show_collections) > 1:
# print("Multiple collections named {}.\nUpdate of \"details\" is currently unsupported.".format(c))
# continue
if headless is True:
plex_collection = get_collection(plex, c, True)
elif headless is False:
plex_collection = get_collection(plex, c, False)
if not isinstance(plex_collection, Collections):
# No collections created with requested criteria
continue
item = plex.Server.fetchItem(plex_collection.ratingKey)
# Handle collection titleSort
if "sort_title" in collections[c]["details"]:
edits = {'titleSort.value': collections[c]["details"]["sort_title"], 'titleSort.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection contentRating
if "content_rating" in collections[c]["details"]:
edits = {'contentRating.value': collections[c]["details"]["content_rating"], 'contentRating.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection summary
summary = None
if "summary" in collections[c]["details"]:
summary = collections[c]["details"]["summary"]
elif "tmdb-summary" in collections[c]["details"]:
# Seems clunky ...
try:
summary = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-summary"], "overview")
except AttributeError:
summary = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-summary"], "biography")
if summary:
edits = {'summary.value': summary, 'summary.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection posters
poster = None
if "poster" in collections[c]["details"]:
poster = collections[c]["details"]["poster"]
elif "tmdb-poster" in collections[c]["details"]:
# Seems clunky ...
try:
slug = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-poster"], "poster_path")
except AttributeError:
slug = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-poster"], "profile_path")
poster = "https://image.tmdb.org/t/p/original/" + slug
else:
# Try to pull image from image_server.
# To do: this should skip if it's run without the image server
# To do: this only runs if 'details' key is set - might make sense to run regardless
# Setup connection to image_server
config_client = ImageServer(config_path, "client")
# Url encode collection name
c_name = urllib.parse.quote(c, safe='')
# Create local url to where image would be if exists
local_poster_url = "http://" + config_client.host + ":" + str(config_client.port) + "/images/" + c_name
# Test local url
response = requests.head(local_poster_url)
if response.status_code < 400:
poster = local_poster_url
if poster:
item.uploadPoster(url=poster)
# Handle collection backgrounds
background = None
if "background" in collections[c]["details"]:
background = collections[c]["details"]["background"]
else:
# Try to pull image from image_server.
# To do: this should skip if it's run without the image server
# To do: this only runs if 'details' key is set - might make sense to run regardless
# Setup connection to image_server
config_client = ImageServer(config_path, "client")
# Url encode collection name
c_name = urllib.parse.quote(c, safe='')
# Create local url to where image would be if exists
local_background_url = "http://" + config_client.host + ":" + str(config_client.port) + "/images/" + c_name + "-background"
# Test local url
response = requests.head(local_background_url)
if response.status_code < 400:
background = local_background_url
if background:
item.uploadArt(url=background)
# Handle collection collectionMode
if "collection_mode" in collections[c]["details"]:
collectionMode = collections[c]["details"]["collection_mode"]
if collectionMode in ('default', 'hide', 'hide_items', 'show_items'):
item.modeUpdate(mode=collectionMode)
else:
print("collectionMode Invalid\ndefault (Library default)\nhide (Hide Collection)\nhideItems (Hide Items in this Collection)\nshowItems (Show this Collection and its Items)\n")
# Handle collection collectionSort
if "collection_sort" in collections[c]["details"]:
collectionSort = collections[c]["details"]["collection_sort"]
if collectionSort in ('release_date', 'alphabetical'):
item.sortUpdate(sort=collectionSort)
else:
print("collectionSort Invalid\nrelease (Order Collection by release dates)\nalpha (Order Collection Alphabetically)\n")
print("Invalid background-directory setting")
if self.backgrounddirectory:
print("Using {} as background directory".format(self.backgrounddirectory))
def modify_config(config_path, c_name, m, value):

View file

@ -1,44 +0,0 @@
from flask import Flask
from flask import send_from_directory
from flask import abort
from config_tools import ImageServer
import requests
import logging
import os
import time
def check_running(config_path):
time.sleep(1)
config_client = ImageServer(config_path, "client")
try:
r = requests.get("http://" + config_client.host + ":" + str(config_client.port), verify=False, timeout=1)
return "IMAGE SERVER RUNNING ON http://{}:{}/images/".format(config_client.host, config_client.port)
except (requests.exceptions.ConnectTimeout, requests.exceptions.ConnectionError):
return "IMAGE SERVER NOT RUNNING"
def start_srv(config_path):
config_server = ImageServer(config_path, "server")
server = Flask(__name__)
server.upload_folder = config_server.posterdirectory
log = logging.getLogger("werkzeug")
os.environ['WERKZEUG_RUN_MAIN'] = 'true'
log.setLevel(logging.ERROR)
@server.route('/images/<path:c_name>')
def send_file(c_name):
app_dir = os.path.dirname(os.path.realpath(__file__))
poster_dir = os.path.join(app_dir, config_server.posterdirectory)
posters = os.listdir(poster_dir)
for img in posters:
if (c_name + ".") in img:
return send_from_directory(server.upload_folder, img)
return abort(404)
try:
server.run(host=config_server.host, port=config_server.port)
except (OSError, TypeError) as e:
print(e)
if __name__ == '__main__':
start_srv(config_path)

View file

@ -2,27 +2,184 @@ import os
import argparse
import sys
import threading
import glob
from plexapi.server import PlexServer
from plexapi.video import Movie
from plexapi.video import Show
import image_server
import plex_tools
from plexapi.library import MovieSection
from plexapi.library import ShowSection
from plexapi.library import Collections
from plex_tools import add_to_collection
from plex_tools import delete_collection
from plex_tools import get_actor_rkey
from plex_tools import get_collection
from plex_tools import get_movie
from imdb_tools import tmdb_get_summary
from config_tools import Config
from config_tools import Plex
from config_tools import ImageServer
from config_tools import modify_config
from config_tools import update_from_config
from radarr_tools import add_to_radarr
def update_from_config(config_path, plex, headless=False):
config = Config(config_path)
collections = config.collections
if isinstance(plex.Library, MovieSection):
libtype = "movie"
elif isinstance(plex.Library, ShowSection):
libtype = "show"
for c in collections:
print("Updating collection: {}...".format(c))
methods = [m for m in collections[c] if m not in ("details", "subfilters")]
subfilters = []
if "subfilters" in collections[c]:
for sf in collections[c]["subfilters"]:
sf_string = sf, collections[c]["subfilters"][sf]
subfilters.append(sf_string)
for m in methods:
if isinstance(collections[c][m], list):
# Support multiple imdb/tmdb/trakt lists
values = collections[c][m]
else:
values = collections[c][m].split(", ")
for v in values:
if m[-1:] == "s":
m_print = m[:-1]
else:
m_print = m
print("Processing {}: {}".format(m_print, v))
if m == "actors" or m == "actor":
v = get_actor_rkey(plex, v)
try:
missing = add_to_collection(config_path, plex, m, v, c, subfilters)
except UnboundLocalError: # No sub-filters
missing = add_to_collection(config_path, plex, m, v, c)
except (KeyError, ValueError) as e:
print(e)
missing = False
if missing:
if libtype == "movie":
if "imdb" in m:
method_name = "IMDb"
elif "trakt" in m:
method_name = "Trakt"
else:
method_name = "TMDb"
print("{} missing movies from {} List: {}".format(len(missing), method_name, v))
if 'add_movie' in config.radarr:
if config.radarr['add_movie'] is True:
print("Adding missing movies to Radarr")
add_to_radarr(config_path, missing)
else:
if input("Add missing movies to Radarr? (y/n): ").upper() == "Y":
add_to_radarr(config_path, missing)
elif libtype == "show":
if "trakt" in m:
method_name = "Trakt"
else:
method_name = "TMDb"
print("{} missing shows from {} List: {}".format(len(missing), method_name, v))
# if not skip_sonarr:
# if input("Add missing shows to Sonarr? (y/n): ").upper() == "Y":
# add_to_radarr(missing_shows)
# Multiple collections of the same name
if "details" in collections[c]:
# # Check if there are multiple collections with the same name
# movie_collections = plex.MovieLibrary.search(title=c, libtype="collection")
# show_collections = plex.ShowLibrary.search(title=c, libtype="collection")
# if len(movie_collections + show_collections) > 1:
# print("Multiple collections named {}.\nUpdate of \"details\" is currently unsupported.".format(c))
# continue
if headless is True:
plex_collection = get_collection(plex, c, True)
elif headless is False:
plex_collection = get_collection(plex, c, False)
if not isinstance(plex_collection, Collections):
# No collections created with requested criteria
continue
item = plex.Server.fetchItem(plex_collection.ratingKey)
# Handle collection titleSort
if "sort_title" in collections[c]["details"]:
edits = {'titleSort.value': collections[c]["details"]["sort_title"], 'titleSort.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection contentRating
if "content_rating" in collections[c]["details"]:
edits = {'contentRating.value': collections[c]["details"]["content_rating"], 'contentRating.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection summary
summary = None
if "summary" in collections[c]["details"]:
summary = collections[c]["details"]["summary"]
elif "tmdb-summary" in collections[c]["details"]:
# Seems clunky ...
try:
summary = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-summary"], "overview")
except AttributeError:
summary = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-summary"], "biography")
if summary:
edits = {'summary.value': summary, 'summary.locked': 1}
item.edit(**edits)
item.reload()
# Handle collection posters
if "poster" in collections[c]["details"]:
item.uploadPoster(url=collections[c]["details"]["poster"])
elif "tmdb-poster" in collections[c]["details"]:
# Seems clunky ...
try:
slug = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-poster"], "poster_path")
except AttributeError:
slug = tmdb_get_summary(config_path, collections[c]["details"]["tmdb-poster"], "profile_path")
item.uploadPoster(url="https://image.tmdb.org/t/p/original/{}".format(slug))
else:
search = os.path.join(ImageServer(config_path).posterdirectory, "{}.*".format(c))
matches = glob.glob(search)
if len(matches) == 1:
item.uploadPoster(filepath=matches[0])
# Handle collection backgrounds
if "background" in collections[c]["details"]:
item.uploadArt(url=collections[c]["details"]["background"])
else:
search = os.path.join(ImageServer(config_path).backgrounddirectory, "{}.*".format(c))
matches = glob.glob(search)
if len(matches) == 1:
item.uploadArt(filepath=matches[0])
# Handle collection collectionMode
if "collection_mode" in collections[c]["details"]:
collectionMode = collections[c]["details"]["collection_mode"]
if collectionMode in ('default', 'hide', 'hide_items', 'show_items'):
item.modeUpdate(mode=collectionMode)
else:
print("collectionMode Invalid\ndefault (Library default)\nhide (Hide Collection)\nhideItems (Hide Items in this Collection)\nshowItems (Show this Collection and its Items)\n")
# Handle collection collectionSort
if "collection_sort" in collections[c]["details"]:
collectionSort = collections[c]["details"]["collection_sort"]
if collectionSort in ('release_date', 'alphabetical'):
item.sortUpdate(sort=collectionSort)
else:
print("collectionSort Invalid\nrelease (Order Collection by release dates)\nalpha (Order Collection Alphabetically)\n")
def append_collection(config_path, config_update=None):
while True:
if config_update:
collection_name = config_update
selected_collection = plex_tools.get_collection(plex, collection_name, True)
selected_collection = get_collection(plex, collection_name, True)
else:
collection_name = input("Enter collection to add to: ")
selected_collection = plex_tools.get_collection(plex, collection_name)
selected_collection = get_collection(plex, collection_name)
try:
if not isinstance(selected_collection, str):
print("\"{}\" Selected.".format(selected_collection.title))
@ -39,12 +196,12 @@ def append_collection(config_path, config_update=None):
method = "movie"
value = input("Enter Movie (Name or Rating Key): ")
if value is int:
plex_movie = plex_tools.get_movie(int(value))
plex_movie = get_movie(plex, int(value))
print('+++ Adding %s to collection %s' % (
plex_movie.title, selected_collection.title))
plex_movie.addCollection(selected_collection.title)
else:
results = plex_tools.get_movie(plex, value)
results = get_movie(plex, value)
if len(results) > 1:
while True:
i = 1
@ -66,46 +223,46 @@ def append_collection(config_path, config_update=None):
else:
print("Movies in configuration file not yet supported")
elif method == "s":
if not config_update:
method = "show"
value = input("Enter Show (Name or Rating Key): ")
if value is int:
plex_show = plex_tools.get_show(int(value))
print('+++ Adding %s to collection %s' % (
plex_show.title, selected_collection.title))
plex_show.addCollection(selected_collection.title)
else:
results = plex_tools.get_show(plex, value)
if len(results) > 1:
while True:
i = 1
for result in results:
print("{POS}) {TITLE} - {RATINGKEY}".format(POS=i, TITLE=result.title,
RATINGKEY=result.ratingKey))
i += 1
s = input("Select show (N for None): ")
if int(s):
s = int(s)
if len(results) >= s > 0:
result = results[s - 1]
print('+++ Adding %s to collection %s' % (
result.title, selected_collection.title))
result.addCollection(selected_collection.title)
break
else:
break
else:
print("Shows in configuration file not yet supported")
# elif method == "s":
# if not config_update:
# method = "show"
# value = input("Enter Show (Name or Rating Key): ")
# if value is int:
# plex_show = get_show(int(value))
# print('+++ Adding %s to collection %s' % (
# plex_show.title, selected_collection.title))
# plex_show.addCollection(selected_collection.title)
# else:
# results = get_show(plex, value)
# if len(results) > 1:
# while True:
# i = 1
# for result in results:
# print("{POS}) {TITLE} - {RATINGKEY}".format(POS=i, TITLE=result.title,
# RATINGKEY=result.ratingKey))
# i += 1
# s = input("Select show (N for None): ")
# if int(s):
# s = int(s)
# if len(results) >= s > 0:
# result = results[s - 1]
# print('+++ Adding %s to collection %s' % (
# result.title, selected_collection.title))
# result.addCollection(selected_collection.title)
# break
# else:
# break
# else:
# print("Shows in configuration file not yet supported")
elif method == "a":
method = "actors"
value = input("Enter Actor Name: ")
a_rkey = plex_tools.get_actor_rkey(plex, value)
a_rkey = get_actor_rkey(plex, value)
if config_update:
modify_config(config_path, collection_name, method, value)
else:
plex_tools.add_to_collection(config_path, plex, method, a_rkey, selected_collection.title)
add_to_collection(config_path, plex, method, a_rkey, selected_collection.title)
elif method == "l":
l_type = input("Enter list type IMDb(i) TMDb(t) Trakt(k): ")
@ -125,14 +282,14 @@ def append_collection(config_path, config_update=None):
if config_update:
modify_config(config_path, collection_name, method, url)
else:
missing = plex_tools.add_to_collection(config_path, plex, method, url, selected_collection.title)
missing = add_to_collection(config_path, plex, method, url, selected_collection.title)
if missing:
if collection_type == 'movie':
print("{} missing movies from {} List: {}".format(len(missing), l_type, url))
if input("Add missing movies to Radarr? (y/n)").upper() == "Y":
add_to_radarr(config_path, missing)
elif collection_type == 'show':
print("{} missing shows from {} List: {}".format(len(missing_shows), l_type, url))
# elif collection_type == 'show':
# print("{} missing shows from {} List: {}".format(len(missing_shows), l_type, url))
# if input("Add missing shows to Sonarr? (y/n)").upper() == "Y":
# add_to_sonarr(missing_shows)
print("Bad {} List URL".format(l_type))
@ -156,7 +313,7 @@ def append_collection(config_path, config_update=None):
if config_update:
modify_config(config_path, collection_name, method, value)
else:
plex_tools.add_to_collection(config_path, plex, method, value, selected_collection.title)
add_to_collection(config_path, plex, method, value, selected_collection.title)
break
else:
print("Filter method did not match an attribute for plexapi.video.Movie")
@ -188,10 +345,6 @@ parser.add_argument("-c", "--config-path", "--config_path",
parser.add_argument("-u", "--update",
help="Update collections using config without user interaction",
action="store_true")
parser.add_argument("-ns", "--no-server", "--noserver",
dest="no_server",
help="Run without the image server",
action="store_true")
args = parser.parse_args()
@ -208,10 +361,10 @@ if args.config_path and os.path.exists(args.config_path):
config_path = args.config_path
# Set config_path from app_dir
elif os.path.exists(os.path.join(app_dir, "config.yml")):
config_path = os.path.join(app_dir, "config.yml")
config_path = os.path.abspath(os.path.join(app_dir, "config.yml"))
# Set config_path from config_dir
elif os.path.exists(os.path.join(app_dir, "..", "config", "config.yml")):
config_path = os.path.join(app_dir, "..", "config", "config.yml")
config_path = os.path.abspath(os.path.join(app_dir, "..", "config", "config.yml"))
else:
print("No config found, exiting")
sys.exit(1)
@ -220,13 +373,6 @@ print("Using {} as config".format(config_path))
plex = Plex(config_path)
if not args.no_server:
print("Attempting to start image server")
pid = threading.Thread(target=image_server.start_srv, args=(config_path,))
pid.daemon = True
pid.start()
print(image_server.check_running(config_path))
if args.update:
# sys.stdout = open("pac.log", "w")
update_from_config(config_path, plex, True)
@ -249,10 +395,10 @@ while not mode == "q":
elif mode == "a":
actor = input("Enter actor name: ")
a_rkey = plex_tools.get_actor_rkey(plex, actor)
a_rkey = get_actor_rkey(plex, actor)
if isinstance(a_rkey, int):
c_name = input("Enter collection name: ")
plex_tools.add_to_collection(config_path, plex, "actors", a_rkey, c_name)
add_to_collection(config_path, plex, "actors", a_rkey, c_name)
else:
print("Invalid actor")
print("\n")
@ -266,7 +412,7 @@ while not mode == "q":
c_name = input("Enter collection name: ")
print("Processing {} List: {}".format(l_type, url))
try:
missing = plex_tools.add_to_collection(config_path, plex, method, url, c_name)
missing = add_to_collection(config_path, plex, method, url, c_name)
if missing:
if isinstance(plex.Library, MovieSection):
print("{} missing items from {} List: {}".format(len(missing), l_type, url))
@ -303,16 +449,16 @@ while not mode == "q":
elif mode == "-":
data = input("Enter collection name to search for (blank for all): ")
collection = plex_tools.get_collection(plex, data)
collection = get_collection(plex, data)
if not isinstance(collection, str):
plex_tools.delete_collection(collection)
delete_collection(collection)
else:
print(collection)
print("\n")
elif mode == "s":
data = input("Enter collection name to search for (blank for all): ")
collection = plex_tools.get_collection(plex, data)
collection = get_collection(plex, data)
if not isinstance(collection, str):
print("Found {} collection {}".format(collection.subtype, collection.title))
items = collection.children

View file

@ -5,7 +5,6 @@ PlexAPI==4.1.1
tmdbv3api==1.6.2
trakt.py==4.2.0
# More common, flexible
flask
lxml
requests>=2.4.2
ruamel.yaml