mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
replace string parts with replacement values
This commit is contained in:
parent
a2f5eaa780
commit
133dc509aa
1 changed files with 11 additions and 1 deletions
|
|
@ -126,10 +126,20 @@ class StreamProfile(models.Model):
|
|||
"{userAgent}": user_agent,
|
||||
}
|
||||
|
||||
cmd = [self.command] + [replacements.get(part, part) for part in self.parameters.split()]
|
||||
# Split the command and iterate through each part to apply replacements
|
||||
cmd = [self.command] + [
|
||||
self._replace_in_part(part, replacements) for part in self.parameters.split()
|
||||
]
|
||||
|
||||
return cmd
|
||||
|
||||
def _replace_in_part(self, part, replacements):
|
||||
# Iterate through the replacements and replace each part of the string
|
||||
for key, value in replacements.items():
|
||||
part = part.replace(key, value)
|
||||
return part
|
||||
|
||||
|
||||
DEFAULT_USER_AGENT_KEY= slugify("Default User-Agent")
|
||||
DEFAULT_STREAM_PROFILE_KEY = slugify("Default Stream Profile")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue