[1] minor fixes

pull/811/head
meisnate12 3 years ago
parent 278a674bda
commit 2b16c7cc67

BIN
.github/pmm.png vendored

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -48,7 +48,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Develop Docker Build: **Success**"
title: "Docker develop build: **Success**"
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/develop/.github/docker.png
@ -58,7 +58,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Develop Docker Build: **Failure**"
title: "Docker develop build: **Failure**"
color: 0xe30c43
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/develop/.github/docker.png

@ -44,7 +44,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Latest Docker Build: **Success**"
title: "Docker latest build: **Success**"
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png
@ -54,7 +54,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Latest Docker Build: **Failure**"
title: "Docker latest build: **Failure**"
color: 0xe30c43
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png

@ -48,7 +48,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Nightly Docker Build: **Success**"
title: "Docker nightly build: **Success**"
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/nightly/.github/docker.png
@ -58,7 +58,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "Nightly Docker Build: **Failure**"
title: "Docker nightly build: **Failure**"
color: 0xe30c43
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/nightly/.github/docker.png

@ -50,7 +50,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "${{ steps.get_version.outputs.VERSION }} Docker Build: **Success**"
title: "Docker ${{ steps.get_version.outputs.VERSION }} build: **Success**"
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png
@ -60,7 +60,7 @@ jobs:
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
nodetail: true
title: "${{ steps.get_version.outputs.VERSION }} Docker Build: **Failure**"
title: "Docker ${{ steps.get_version.outputs.VERSION }} build: **Failure**"
color: 0xe30c43
username: Docker
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png

@ -1 +1 @@
1.16.2
1.16.2-develop1

@ -52,7 +52,7 @@ mass_rating_options = {
}
class ConfigFile:
def __init__(self, default_dir, attrs, read_only):
def __init__(self, default_dir, attrs):
logger.info("Locating config...")
config_file = attrs["config_file"]
if config_file and os.path.exists(config_file): self.config_path = os.path.abspath(config_file)
@ -62,7 +62,7 @@ class ConfigFile:
logger.info(f"Using {self.config_path} as config")
self.default_dir = default_dir
self.read_only = read_only
self.read_only = attrs["read_only"] if "read_only" in attrs else False
self.test_mode = attrs["test"] if "test" in attrs else False
self.trace_mode = attrs["trace"] if "trace" in attrs else False
self.delete_collections = attrs["delete"] if "delete" in attrs else False

@ -856,10 +856,11 @@ class Plex(Library):
return len(display) > 0
def find_assets(self, item, name=None, upload=True, overlay=None, folders=None, create=None):
if isinstance(item, Movie):
name = os.path.basename(os.path.dirname(str(item.locations[0])))
elif isinstance(item, (Artist, Show)):
name = os.path.basename(str(item.locations[0]))
if isinstance(item, (Movie, Artist, Show)):
path_test = str(item.locations[0])
if not os.path.dirname(path_test):
path_test = path_test.replace("\\", "/")
name = os.path.basename(os.path.dirname(path_test) if isinstance(item, Movie) else path_test)
elif isinstance(item, (Collection, Playlist)):
name = name if name else item.title
else:

@ -93,8 +93,8 @@ class TMDBObj:
self.vote_average = data["vote_average"] if isinstance(data, dict) else data.vote_average
self.language_iso = data["language_iso"] if isinstance(data, dict) else data.original_language.iso_639_1 if data.original_language else None
self.language_name = data["language_name"] if isinstance(data, dict) else data.original_language.english_name if data.original_language else None
self.genres = data["genres"].split("|") if isinstance(data, dict) else [g.name for g in data.genres]
self.keywords = data["keywords"].split("|") if isinstance(data, dict) else [g.name for g in data.keywords]
self.genres = data["genres"].split("|") if isinstance(data, dict) else [g.name for g in data.genres if g]
self.keywords = data["keywords"].split("|") if isinstance(data, dict) else [k.name for k in data.keywords if k]
class TMDbMovie(TMDBObj):
@ -136,9 +136,9 @@ class TMDbShow(TMDBObj):
self.type = data["type"] if isinstance(data, dict) else data.type
self.studio = data["studio"] if isinstance(data, dict) else data.networks[0].name if data.networks else None
self.tvdb_id = data["tvdb_id"] if isinstance(data, dict) else data.tvdb_id
loop = data["countries"].split("|") if isinstance(data, dict) else data.origin_countries
loop = data.origin_countries if not isinstance(data, dict) else data["countries"].split("|") if data["countries"] else []
self.countries = [TMDbCountry(c) for c in loop]
loop = data["seasons"].split("|") if isinstance(data, dict) else data.seasons
loop = data.seasons if not isinstance(data, dict) else data["seasons"].split("|") if data["seasons"] else []
self.seasons = [TMDbSeason(s) for s in loop]
if self._tmdb.config.Cache and not ignore_cache:

@ -92,10 +92,12 @@ class TVDbObj:
self.directors = parse_page("//strong[text()='Directors']/parent::li/span/a/text()[normalize-space()]", is_list=True)
self.writers = parse_page("//strong[text()='Writers']/parent::li/span/a/text()[normalize-space()]", is_list=True)
self.studios = parse_page("//strong[text()='Studio']/parent::li/span/a/text()[normalize-space()]", is_list=True)
self.released = datetime.strptime(parse_page("//strong[text()='Released']/parent::li/span/text()[normalize-space()]"), "%B %d, %Y")
released = parse_page("//strong[text()='Released']/parent::li/span/text()[normalize-space()]")
self.released = datetime.strptime(released, "%B %d, %Y") if released else released
else:
self.networks = parse_page("//strong[text()='Networks']/parent::li/span/a/text()[normalize-space()]", is_list=True)
self.released = datetime.strptime(parse_page("//strong[text()='First Aired']/parent::li/span/text()[normalize-space()]"), "%B %d, %Y")
released = parse_page("//strong[text()='First Aired']/parent::li/span/text()[normalize-space()]")
self.released = datetime.strptime(released, "%B %d, %Y") if released else released
self.genres = parse_page("//strong[text()='Genres']/parent::li/span/a/text()[normalize-space()]", is_list=True)
tmdb_id = None

@ -108,17 +108,21 @@ def my_except_hook(exctype, value, tb):
sys.excepthook = my_except_hook
version = "Unknown"
def get_versions(presplit_version):
split_version = presplit_version.split("-develop")
return presplit_version, split_version[0], int(split_version[1]) if len(split_version) > 1 else 0
version = ("Unknown", "Unknown", 0)
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")) as handle:
for line in handle.readlines():
line = line.strip()
if len(line) > 0:
version = line
version = get_versions(line)
break
is_develop = "develop" in version
version_url = f"https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/{'develop' if is_develop else 'master'}/VERSION"
newest_version = requests.get(version_url).content.decode().strip()
version_url = f"https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/{'develop' if version[1] else 'master'}/VERSION"
latest_version = get_versions(requests.get(version_url).content.decode().strip())
new_version = latest_version[0] if version[1] != latest_version[1] or (version[2] and version[2] < latest_version[2]) else None
plexapi.BASE_HEADERS['X-Plex-Client-Identifier'] = "Plex-Meta-Manager"
@ -132,9 +136,9 @@ def start(attrs):
logger.info_center("| __/| | __/> < | | | | __/ || (_| | | | | | (_| | | | | (_| | (_| | __/ | ")
logger.info_center("|_| |_|\\___/_/\\_\\ |_| |_|\\___|\\__\\__,_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_| ")
logger.info_center(" |___/ ")
logger.info(f" Version: {version}")
if version != newest_version and ((is_develop and int(version[version.index("develop") + 7:]) < int(newest_version[newest_version.index("develop") + 7:])) or not is_develop):
logger.info(f" Newest Version: {newest_version}")
logger.info(f" Version: {version[0]}")
if new_version:
logger.info(f" Newest Version: {new_version}")
if "time" in attrs and attrs["time"]: start_type = f"{attrs['time']} "
elif "test" in attrs and attrs["test"]: start_type = "Test "
elif "collections" in attrs and attrs["collections"]: start_type = "Collections "
@ -144,6 +148,7 @@ def start(attrs):
if "time" not in attrs:
attrs["time"] = start_time.strftime("%H:%M")
attrs["time_obj"] = start_time
attrs["read_only"] = read_only_config
logger.separator(debug=True)
logger.debug(f"--config (PMM_CONFIG): {config_file}")
logger.debug(f"--time (PMM_TIME): {times}")
@ -171,7 +176,7 @@ def start(attrs):
config = None
stats = {"created": 0, "modified": 0, "deleted": 0, "added": 0, "unchanged": 0, "removed": 0, "radarr": 0, "sonarr": 0}
try:
config = ConfigFile(default_dir, attrs, read_only_config)
config = ConfigFile(default_dir, attrs)
except Exception as e:
logger.stacktrace()
logger.critical(e)
@ -191,9 +196,9 @@ def start(attrs):
except Failed as e:
logger.stacktrace()
logger.error(f"Webhooks Error: {e}")
version_line = f"Version: {version}"
if version != newest_version and ((is_develop and int(version[version.index("develop") + 7:]) < int(newest_version[newest_version.index("develop") + 7:])) or not is_develop):
version_line = f"{version_line} Newest Version: {newest_version}"
version_line = f"Version: {version[0]}"
if new_version:
version_line = f"{version_line} Newest Version: {new_version}"
logger.separator(f"Finished {start_type}Run\n{version_line}\nFinished: {end_time.strftime('%H:%M:%S %Y-%m-%d')} Run Time: {run_time}")
logger.remove_main_handler()
@ -460,7 +465,7 @@ def library_operations(config, library):
reverse_anidb = {}
if library.mass_genre_update == "anidb":
for k, v in library.anidb_map.values():
for k, v in library.anidb_map.items():
reverse_anidb[v] = k
for i, item in enumerate(items, 1):

Loading…
Cancel
Save