Liking cljdoc? Tell your friends :D

qy-upup.ai-make-music.core


extract-metadataclj

(extract-metadata response)

Extracts metadata from a mock Supermaker AI Music response.

Params: response (Map): A mock response containing music metadata. Expected structure: {:title "Song Title", :genre "Genre", :mood "Mood", :duration 120, :artist "AI Artist"}

Returns: Map: A map containing the extracted metadata, or nil if the input is invalid. Returns a map with keys :title, :genre, :mood, :duration, and :artist if all are present. Returns nil if the input is not a map or any of the keys are missing or their values are nil.

Example: (extract-metadata {:title "My Song", :genre "Pop", :mood "Happy", :duration 120, :artist "AI Artist"}) ;=> {:title "My Song", :genre "Pop", :mood "Happy", :duration 120, :artist "AI Artist"}

(extract-metadata {:title "My Song", :genre "Pop"}) ;=> nil

Extracts metadata from a mock Supermaker AI Music response.

Params:
  response (Map): A mock response containing music metadata.  Expected structure:
                  {:title "Song Title", :genre "Genre", :mood "Mood", :duration 120, :artist "AI Artist"}

Returns:
  Map: A map containing the extracted metadata, or nil if the input is invalid.
       Returns a map with keys :title, :genre, :mood, :duration, and :artist if all are present.
       Returns nil if the input is not a map or any of the keys are missing or their values are nil.

Example:
  (extract-metadata {:title "My Song", :genre "Pop", :mood "Happy", :duration 120, :artist "AI Artist"})
  ;=> {:title "My Song", :genre "Pop", :mood "Happy", :duration 120, :artist "AI Artist"}

  (extract-metadata {:title "My Song", :genre "Pop"})
  ;=> nil
raw docstring

generate-music-urlclj

(generate-music-url title genre mood duration)

Generates a Supermaker AI Music URL based on the provided parameters.

Params: title (String): The title of the music. genre (String): The genre of the music. mood (String): The mood of the music. duration (Integer): The desired duration in seconds.

Returns: String: A URL pointing to Supermaker AI Music creation with the given parameters. Returns nil if any of the required parameters are nil or empty strings.

Example: (generate-music-url "My Song" "Pop" "Happy" 60) ;=> "https://supermaker.ai/music/ai-make-music?title=My%20Song&genre=Pop&mood=Happy&duration=60"

Generates a Supermaker AI Music URL based on the provided parameters.

Params:
  title (String): The title of the music.
  genre (String): The genre of the music.
  mood (String): The mood of the music.
  duration (Integer): The desired duration in seconds.

Returns:
  String: A URL pointing to Supermaker AI Music creation with the given parameters.
          Returns nil if any of the required parameters are nil or empty strings.

Example:
  (generate-music-url "My Song" "Pop" "Happy" 60)
  ;=> "https://supermaker.ai/music/ai-make-music?title=My%20Song&genre=Pop&mood=Happy&duration=60"
raw docstring

process-mock-dataclj

(process-mock-data data transform-fn)

Processes a list of mock Supermaker AI Music data, applying a transformation function.

Params: data (List): A list of maps representing mock music data. Each map is expected to have keys like :title, :genre, :mood, and :duration. transform-fn (Function): A function to apply to each data item. This function should accept a single map argument (each element from the data list).

Returns: List: A list of the transformed data items. Returns an empty list if the input data is not a list. Returns a list of the results of applying transform-fn to each item in data.

Example: (process-mock-data [{:title "Song 1", :genre "Pop", :mood "Happy", :duration 60} {:title "Song 2", :genre "Rock", :mood "Energetic", :duration 120}] (fn [song] (assoc song :processed true))) ;=> [{:title "Song 1", :genre "Pop", :mood "Happy", :duration 60, :processed true} ;=> {:title "Song 2", :genre "Rock", :mood "Energetic", :duration 120, :processed true}]

Processes a list of mock Supermaker AI Music data, applying a transformation function.

Params:
  data (List): A list of maps representing mock music data.
                Each map is expected to have keys like :title, :genre, :mood, and :duration.
  transform-fn (Function): A function to apply to each data item.  This function should accept a single map argument (each element from the data list).

Returns:
  List: A list of the transformed data items.  Returns an empty list if the input data is not a list.
        Returns a list of the results of applying transform-fn to each item in data.

Example:
  (process-mock-data [{:title "Song 1", :genre "Pop", :mood "Happy", :duration 60}
                      {:title "Song 2", :genre "Rock", :mood "Energetic", :duration 120}]
                     (fn [song] (assoc song :processed true)))
  ;=> [{:title "Song 1", :genre "Pop", :mood "Happy", :duration 60, :processed true}
  ;=>  {:title "Song 2", :genre "Rock", :mood "Energetic", :duration 120, :processed true}]
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close