troy_ 4 Posted January 9, 2023 Posted January 9, 2023 I tried to add a photo's library. When I clicked `Okay` - it just sat there... greyed out. After an hour or so of waiting - I refreshed. To find out that I have over sixty-thousand of the same library created. Please... there must be a way to bulk delete libraries. Deleing them one at a time is _not_ an option.
Luke 39653 Posted January 9, 2023 Posted January 9, 2023 Hi, that's bizarre. Yes I agree we need a multi-select on this screen.
Happy2Play 9355 Posted January 9, 2023 Posted January 9, 2023 (edited) Technically it can be turned on in the js file for the web client. But this issue really needs to be found as there are several topics on this and looks to be worse on Linux with a somewhat endless loop creating libraries. Edited January 9, 2023 by Happy2Play
Solution troy_ 4 Posted January 10, 2023 Author Solution Posted January 10, 2023 (edited) I wrote a nasty little script in python to delete them - but it was going to take several weeks, so I had to dump everything and start again. (token and device id are examples) import requests import json import logging import sys import urllib # Emby setup emby_client = urllib.parse.quote("Emby Web") emby_device_name = urllib.parse.quote("Google Chrome macOS") emby_device_id = urllib.parse.quote("81bd29e9-6fb9-4074-87ad-ea2185bea2de") emby_token = urllib.parse.quote("f463fb8786fa15808220b6964d8c6368") emby_host = "emby.example.com" # Logging setup logger = logging.getLogger() handler = logging.StreamHandler() formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) logger.setLevel(logging.DEBUG) # Load JSON data with open('response.json') as json_data: data = json.load(json_data) logger.info("JSON Loaded") # Iterate over Items for item in data["Items"]: # Check for locations that match for location in item["Locations"]: if location == "/data/photos": item_id = item["ItemId"] item_name = urllib.parse.quote(item["Name"]) logger.info(f"Found Match: {item_name} ({item_id})") # Send HTTP POST url = f"https://{emby_host}}/emby/Library/VirtualFolders/Delete?refreshLibrary=false&id={item_id}&name={item_name}&X-Emby-Client={emby_client}&X-Emby-Device-Name={emby_device_name}&X-Emby-Device-Id={emby_device_id}&X-Emby-Client-Version=4.7.11.0&X-Emby-Token={emby_token}&X-Emby-Language=en-gb" try: response = requests.post(url, timeout=(3.05, 5)) except requests.exceptions.Timeout:#any option that is similar? logger.info(f"Timed out: {item_name} ({item_id})") continue response.close() # Logging logger.info(response.url) logger.info(response.status_code) logger.info(response.text) else: logger.info("No Match: " + item["Name"]) Edited January 10, 2023 by troy_
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now