Skip to content

Commit

Permalink
#630 add custom_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Jan 24, 2022
1 parent e9950b4 commit 35de31e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ def check_for_attribute(data, attribute, parent=None, test_list=None, default=No
"ignore_imdb_ids": check_for_attribute(self.data, "ignore_imdb_ids", parent="settings", var_type="list", default_is_none=True),
"playlist_sync_to_users": check_for_attribute(self.data, "playlist_sync_to_users", parent="settings", default="all", default_is_none=True),
"verify_ssl": check_for_attribute(self.data, "verify_ssl", parent="settings", var_type="bool", default=True),
"custom_repo": check_for_attribute(self.data, "custom_repo", parent="settings", default_is_none=True),
"assets_for_all": check_for_attribute(self.data, "assets_for_all", parent="settings", var_type="bool", default=False, save=False, do_print=False)
}
self.custom_repo = self.general["custom_repo"]

self.session = requests.Session()
if not self.general["verify_ssl"]:
Expand Down Expand Up @@ -447,6 +449,9 @@ def check_dict(attr):
git = check_dict("git")
if git:
playlists_pairs.append(("Git", git))
repo = check_dict("repo")
if repo:
playlists_pairs.append(("Repo", repo))
file = check_dict("file")
if file:
playlists_pairs.append(("File", file))
Expand Down Expand Up @@ -727,6 +732,7 @@ def check_dict(attr, name):
params["metadata_path"].append((name, path[attr]))
check_dict("url", "URL")
check_dict("git", "Git")
check_dict("repo", "Repo")
check_dict("file", "File")
check_dict("folder", "Folder")
else:
Expand Down
6 changes: 4 additions & 2 deletions modules/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ def get_file_name(self):

def load_file(self):
try:
if self.type in ["URL", "Git"]:
content_path = self.path if self.type == "URL" else f"{github_base}{self.path}.yml"
if self.type in ["URL", "Git", "Repo"]:
if self.type == "Repo" and not self.config.custom_repo:
raise Failed("Config Error: No custom_repo defined")
content_path = self.path if self.type == "URL" else f"{self.config.custom_repo if self.type == 'Repo' else github_base}{self.path}.yml"
response = self.config.get(content_path)
if response.status_code >= 400:
raise Failed(f"URL Error: No file found at {content_path}")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PlexAPI==4.9.0
PlexAPI==4.9.1
tmdbapis==0.1.8
arrapi==1.3.0
lxml==4.7.1
Expand Down

0 comments on commit 35de31e

Please sign in to comment.