[2] add _encoded

pull/847/head
meisnate12 3 years ago
parent 0ea9fb01cc
commit ccd0e5dbe1

@ -1 +1 @@
1.16.3-develop1 1.16.3-develop2

@ -335,14 +335,14 @@ class CollectionBuilder:
if "sync_to_users" in methods or "sync_to_user" in methods: if "sync_to_users" in methods or "sync_to_user" in methods:
s_attr = f"sync_to_user{'s' if 'sync_to_users' in methods else ''}" s_attr = f"sync_to_user{'s' if 'sync_to_users' in methods else ''}"
logger.debug("") logger.debug("")
logger.debug("Validating Method: sync_to_users") logger.debug(f"Validating Method: {s_attr}")
if self.data[methods[s_attr]]: if self.data[methods[s_attr]]:
logger.warning(f"Playlist Error: sync_to_users attribute is blank defaulting to playlist_sync_to_user: {self.sync_to_users}")
else:
logger.debug(f"Value: {self.data[methods[s_attr]]}") logger.debug(f"Value: {self.data[methods[s_attr]]}")
self.sync_to_users = self.data[methods[s_attr]] self.sync_to_users = self.data[methods[s_attr]]
else: else:
logger.warning(f"Playlist Error: sync_to_users attribute not found defaulting to playlist_sync_to_user: {self.sync_to_users}") logger.warning(f"Playlist Error: sync_to_users attribute is blank defaulting to playlist_sync_to_users: {self.sync_to_users}")
else:
logger.warning(f"Playlist Error: sync_to_users attribute not found defaulting to playlist_sync_to_users: {self.sync_to_users}")
plex_users = self.library.users plex_users = self.library.users
if self.sync_to_users: if self.sync_to_users:

@ -1,4 +1,4 @@
import math, operator, os, re import math, operator, os, re, requests
from datetime import datetime from datetime import datetime
from modules import plex, ergast, util from modules import plex, ergast, util
from modules.util import Failed, ImageData from modules.util import Failed, ImageData
@ -131,6 +131,9 @@ class DataFile:
template_name = variables["name"] template_name = variables["name"]
template = self.templates[template_name] template = self.templates[template_name]
for key, value in variables.items():
variables[f"{key}_encoded"] = requests.utils.quote(str(value))
default = {} default = {}
if "default" in template: if "default" in template:
if template["default"]: if template["default"]:
@ -138,11 +141,12 @@ class DataFile:
for dv in template["default"]: for dv in template["default"]:
if str(dv) not in optional: if str(dv) not in optional:
if template["default"][dv] is not None: if template["default"][dv] is not None:
final_value = str(template["default"][dv]) final_value = template["default"][dv]
for key in variables: for key, value in variables.items():
if f"<<{key}>>" in final_value: if f"<<{key}>>" in str(final_value):
final_value = final_value.replace(f"<<{key}>>", str(name)) final_value = str(final_value).replace(f"<<{key}>>", str(value))
default[dv] = final_value default[dv] = final_value
default[f"{dv}_encoded"] = requests.utils.quote(str(final_value))
else: else:
raise Failed(f"{self.data_type} Error: template default sub-attribute {dv} is blank") raise Failed(f"{self.data_type} Error: template default sub-attribute {dv} is blank")
else: else:
@ -155,6 +159,7 @@ class DataFile:
for op in util.get_list(template["optional"]): for op in util.get_list(template["optional"]):
if op not in default: if op not in default:
optional.append(str(op)) optional.append(str(op))
optional.append(f"{op}_encoded")
else: else:
logger.warning(f"Template Warning: variable {op} cannot be optional if it has a default") logger.warning(f"Template Warning: variable {op} cannot be optional if it has a default")
else: else:

Loading…
Cancel
Save