mirror of
https://github.com/meisnate12/Plex-Meta-Manager
synced 2024-11-10 06:54:21 +00:00
commit
b740b85670
6 changed files with 40 additions and 8 deletions
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -7,6 +7,10 @@ assignees: 'meisnate12'
|
|||
|
||||
---
|
||||
|
||||
<!---
|
||||
Please make sure you submit all Pull Requests to the develop branch not the master branch.
|
||||
--->
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging, os, re
|
|||
from datetime import datetime, timedelta
|
||||
from modules import anidb, anilist, icheckmovies, imdb, letterboxd, mal, plex, radarr, sonarr, tautulli, tmdb, trakttv, tvdb, util
|
||||
from modules.util import Failed, ImageData
|
||||
from PIL import Image
|
||||
from PIL import Image, UnidentifiedImageError
|
||||
from plexapi.exceptions import BadRequest, NotFound
|
||||
from plexapi.video import Movie, Show
|
||||
from urllib.parse import quote
|
||||
|
@ -1664,6 +1664,7 @@ class CollectionBuilder:
|
|||
logger.info("")
|
||||
util.separator(f"Removed from {self.name} Collection", space=False, border=False)
|
||||
logger.info("")
|
||||
self.library.reload(item)
|
||||
logger.info(f"{self.name} Collection | - | {item.title}")
|
||||
if self.smart_label_collection:
|
||||
self.library.query_data(item.removeLabel, self.name)
|
||||
|
@ -1707,7 +1708,10 @@ class CollectionBuilder:
|
|||
if int(item.ratingKey) in rating_keys:
|
||||
rating_keys.remove(int(item.ratingKey))
|
||||
if self.details["item_assets"] or overlay is not None:
|
||||
self.library.update_item_from_assets(item, overlay=overlay)
|
||||
try:
|
||||
self.library.update_item_from_assets(item, overlay=overlay)
|
||||
except Failed as e:
|
||||
logger.error(e)
|
||||
self.library.edit_tags("label", item, add_tags=add_tags, remove_tags=remove_tags, sync_tags=sync_tags)
|
||||
if "item_radarr_tag" in self.item_details and item.ratingKey in self.library.movie_rating_key_map:
|
||||
tmdb_ids.append(self.library.movie_rating_key_map[item.ratingKey])
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import glob, logging, os, plexapi, requests, shutil
|
||||
import glob, logging, os, plexapi, requests, shutil, time
|
||||
from modules import builder, util
|
||||
from modules.meta import Metadata
|
||||
from modules.util import Failed, ImageData
|
||||
|
@ -459,10 +459,15 @@ class Plex:
|
|||
if self.config.Cache:
|
||||
image, _, image_overlay = self.config.Cache.query_image_map(item.ratingKey, self.original_mapping_name, "poster")
|
||||
if poster_uploaded or not image_overlay or image_overlay != overlay_name:
|
||||
og_image = requests.get(item.posterUrl).content
|
||||
response = requests.get(item.posterUrl)
|
||||
if response.status_code >= 400:
|
||||
raise Failed(f"Overlay Error: Overlay Failed for {item.title}")
|
||||
og_image = response.content
|
||||
with open(temp_image, "wb") as handler:
|
||||
handler.write(og_image)
|
||||
shutil.copyfile(temp_image, os.path.join(overlay_folder, f"{item.ratingKey}.png"))
|
||||
while util.is_locked(temp_image):
|
||||
time.sleep(1)
|
||||
new_poster = Image.open(temp_image)
|
||||
new_poster = new_poster.resize(overlay_image.size, Image.ANTIALIAS)
|
||||
new_poster.paste(overlay_image, (0, 0), overlay_image)
|
||||
|
@ -498,6 +503,8 @@ class Plex:
|
|||
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_failed)
|
||||
def get_search_choices(self, search_name, title=True):
|
||||
final_search = search_translation[search_name] if search_name in search_translation else search_name
|
||||
if final_search == "resolution" and self.is_show:
|
||||
final_search = "episode.resolution"
|
||||
try:
|
||||
choices = {}
|
||||
for choice in self.Plex.listFilterChoices(final_search):
|
||||
|
@ -814,7 +821,9 @@ class Plex:
|
|||
if len(matches) > 0:
|
||||
episode_poster = ImageData("asset_directory", os.path.abspath(matches[0]), prefix=f"{item.title} {episode.seasonEpisode.upper()}'s ", is_url=False)
|
||||
self.upload_images(episode, poster=episode_poster)
|
||||
if not found_one:
|
||||
if not found_one and overlay:
|
||||
self.upload_images(item, overlay=overlay)
|
||||
elif not found_one:
|
||||
logger.error(f"Asset Warning: No asset folder found called '{name}'")
|
||||
|
||||
def find_collection_assets(self, item, name=None):
|
||||
|
|
|
@ -71,7 +71,7 @@ class Radarr:
|
|||
logger.info("")
|
||||
logger.info(f"{apply_tags_translation[apply_tags].capitalize()} Radarr Tags: {tags}")
|
||||
|
||||
edited, not_exists = self.api.edit_multiple_movies(tmdb_ids, tags=tags, apply_tags=apply_tags)
|
||||
edited, not_exists = self.api.edit_multiple_movies(tmdb_ids, tags=tags, apply_tags=apply_tags_translation[apply_tags])
|
||||
|
||||
if len(edited) > 0:
|
||||
logger.info("")
|
||||
|
|
|
@ -84,12 +84,12 @@ class Sonarr:
|
|||
logger.info("")
|
||||
logger.info(f"{apply_tags_translation[apply_tags].capitalize()} Sonarr Tags: {tags}")
|
||||
|
||||
edited, not_exists = self.api.edit_multiple_series(tvdb_ids, tags=tags, apply_tags=apply_tags)
|
||||
edited, not_exists = self.api.edit_multiple_series(tvdb_ids, tags=tags, apply_tags=apply_tags_translation[apply_tags])
|
||||
|
||||
if len(edited) > 0:
|
||||
logger.info("")
|
||||
for series in edited:
|
||||
logger.info(f"Radarr Tags | {series.title:<25} | {series.tags}")
|
||||
logger.info(f"Sonarr Tags | {series.title:<25} | {series.tags}")
|
||||
logger.info(f"{len(edited)} Series edited in Sonarr")
|
||||
|
||||
if len(not_exists) > 0:
|
||||
|
|
|
@ -420,3 +420,18 @@ def validate_filename(filename):
|
|||
else:
|
||||
mapping_name = sanitize_filename(filename)
|
||||
return mapping_name, f"Log Folder Name: {filename} is invalid using {mapping_name}"
|
||||
|
||||
def is_locked(filepath):
|
||||
locked = None
|
||||
file_object = None
|
||||
if os.path.exists(filepath):
|
||||
try:
|
||||
file_object = open(filepath, 'a', 8)
|
||||
if file_object:
|
||||
locked = False
|
||||
except IOError as message:
|
||||
locked = True
|
||||
finally:
|
||||
if file_object:
|
||||
file_object.close()
|
||||
return locked
|
||||
|
|
Loading…
Reference in a new issue