Current section
Files
Jump to
Current section
Files
lib/veo_3_1.ex
defmodule Veo31 do
@moduledoc """
Provides utility functions for interacting with the Supermaker AI Veo 3.1 video platform.
This module focuses on generating URLs and providing helpful functions
for common tasks related to Veo 3.1 video generation.
"""
@base_url "https://supermaker.ai/video/veo-3-1"
@doc """
Builds a URL for the Veo 3.1 platform with optional parameters.
## Examples
iex> Veo31.build_url()
"https://supermaker.ai/video/veo-3-1"
iex> Veo31.build_url(query: "landscape", style: "impressionism")
"https://supermaker.ai/video/veo-3-1?query=landscape&style=impressionism"
"""
def build_url(params \\ []) do
query_string =
params
|> Enum.reject(fn {_, value} -> is_nil(value) or value == "" end)
|> Enum.map(fn {key, value} -> "#{key}=#{value}" end)
|> Enum.join("&")
case query_string do
"" -> @base_url
_ -> "#{@base_url}?#{query_string}"
end
end
@doc """
Generates a prompt suggestion based on a given theme and style.
## Examples
iex> Veo31.suggest_prompt("space", "futuristic")
"Create a futuristic space scene."
iex> Veo31.suggest_prompt("underwater", "abstract")
"Create an abstract underwater scene."
"""
def suggest_prompt(theme, style) do
"Create a #{style} #{theme} scene."
end
@doc """
Checks if a resolution is considered high definition (HD).
## Examples
iex> Veo31.is_hd_resolution?(1920, 1080)
true
iex> Veo31.is_hd_resolution?(1280, 720)
true
iex> Veo31.is_hd_resolution?(640, 480)
false
"""
def is_hd_resolution?(width, height) when is_integer(width) and is_integer(height) do
width >= 1280 and height >= 720
end
@doc """
Calculates the aspect ratio of a given resolution.
Returns a float representing the aspect ratio (width / height).
## Examples
iex> Veo31.calculate_aspect_ratio(1920, 1080)
1.7777777777777777
iex> Veo31.calculate_aspect_ratio(1280, 720)
1.7777777777777777
"""
def calculate_aspect_ratio(width, height) when is_integer(width) and is_integer(height) do
width / height
end
@doc """
Normalizes a style string to lowercase and removes leading/trailing whitespace.
## Examples
iex> Veo31.normalize_style(" Impressionism ")
"impressionism"
iex> Veo31.normalize_style("Abstract")
"abstract"
"""
def normalize_style(style) when is_binary(style) do
style
|> String.trim()
|> String.downcase()
end
end