[22] check for configs version

pull/961/head
meisnate12 2 years ago
parent 1397f88f6a
commit 368b22fd03

@ -14,6 +14,12 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Previous tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Login to Docker Hub
uses: docker/login-action@v2
@ -70,3 +76,16 @@ jobs:
avatar_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/pmm.png
author: Docker
author_icon_url: https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager/master/.github/docker.png
- name: Checkout Configs Repo
uses: actions/checkout@v3
with:
repository: meisnate12/Plex-Meta-Manager-Configs
token: ${{ secrets.PAT }}
path: pmmconfigs
- name: Create & Push Tag
working-directory: ./pmmconfigs
run: |
git tag ${{ steps.previoustag.outputs.tag }}
git push origin ${{ steps.previoustag.outputs.tag }}

@ -1 +1 @@
1.17.1-develop21
1.17.1-develop22

@ -1,14 +1,15 @@
import re
from modules import util
from modules.util import Failed
logger = util.logger
base_url = "https://api.github.com/repos/meisnate12/Plex-Meta-Manager"
configs_raw_url = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs"
class GitHub:
def __init__(self, config):
self.config = config
self._configs_url = None
def latest_release_notes(self):
response = self.config.get_json(f"{base_url}/releases/latest")
@ -27,4 +28,16 @@ class GitHub:
break
commits.append(message)
return "\n".join(commits)
@property
def configs_url(self):
if self._configs_url is None:
try:
config_tags = [r["ref"][10:] for r in self.config.get_json(f"{base_url}-Configs/git/refs/tags")]
except TypeError:
config_tags = []
if self.config.version[1] in config_tags:
self._configs_url = f"{configs_raw_url}/{self.config.version[1]}/"
else:
self._configs_url = f"{configs_raw_url}/master/"
return self._configs_url

@ -71,7 +71,7 @@ class DataFile:
self.templates = {}
def get_file_name(self):
data = f"{overlay.github_base}{self.path}.yml" if self.type == "GIT" else self.path
data = f"{self.config.GitHub.configs_url}{self.path}.yml" if self.type == "GIT" else self.path
if "/" in data:
if data.endswith(".yml"):
return data[data.rfind("/") + 1:-4]
@ -89,7 +89,7 @@ class DataFile:
if file_type in ["URL", "Git", "Repo"]:
if file_type == "Repo" and not self.config.custom_repo:
raise Failed("Config Error: No custom_repo defined")
content_path = file_path if file_type == "URL" else f"{self.config.custom_repo if file_type == 'Repo' else overlay.github_base}{file_path}.yml"
content_path = file_path if file_type == "URL" else f"{self.config.custom_repo if file_type == 'Repo' else self.config.GitHub.configs_url}{file_path}.yml"
response = self.config.get(content_path)
if response.status_code >= 400:
raise Failed(f"URL Error: No file found at {content_path}")

@ -7,7 +7,6 @@ logger = util.logger
portrait_dim = (1000, 1500)
landscape_dim = (1920, 1080)
github_base = "https://raw.githubusercontent.com/meisnate12/Plex-Meta-Manager-Configs/master/"
rating_mods = ["0", "%", "#"]
special_text_overlays = [f"text({a}{s})" for a in ["audience_rating", "critic_rating", "user_rating"] for s in [""] + rating_mods]
@ -177,7 +176,7 @@ class Overlay:
if "file" in self.data and self.data["file"]:
self.path = self.data["file"]
elif "git" in self.data and self.data["git"]:
self.path = get_and_save_image(f"{github_base}{self.data['git']}.png")
self.path = get_and_save_image(f"{self.config.GitHub.configs_url}{self.data['git']}.png")
elif "repo" in self.data and self.data["repo"]:
self.path = get_and_save_image(f"{self.config.custom_repo}{self.data['repo']}.png")
elif "url" in self.data and self.data["url"]:

@ -2,7 +2,6 @@ import os, re, time
from datetime import datetime
from modules import plex, util, overlay
from modules.builder import CollectionBuilder
from modules.overlay import Overlay
from modules.util import Failed, NotScheduled
from plexapi.exceptions import BadRequest
from plexapi.video import Movie, Show, Season, Episode

Loading…
Cancel
Save