Add format to online store templates

This commit is contained in:
Claudio Ortolina
2025-07-15 10:08:40 +01:00
parent 7d23e7a597
commit f329d66fb1
4 changed files with 21 additions and 1 deletions
@@ -68,9 +68,11 @@ defmodule MusicLibrary.OnlineStoreTemplates do
"""
def generate_url(template, record) do
artists_string = Enum.map_join(record.artists, " ", & &1.name)
format_string = Atom.to_string(record.format)
template.url_template
|> String.replace("{artist}", URI.encode(artists_string))
|> String.replace("{title}", URI.encode(record.title))
|> String.replace("{format}", URI.encode(format_string))
end
end