README.md

# CopyrightFreeSongs

A simple Elixir library to access and manage a curated list of copyright-free songs. Provides convenient functions for retrieving song information and integrating them into your projects.

## Installation

Add `copyright_free_songs` to your list of dependencies in `mix.exs`:
elixir
def deps do
  [
    {:copyright_free_songs, "~> 0.1.0"}
  ]
end

After adding the dependency, run:
bash
mix deps.get

## Usage

This library provides functions to retrieve copyright-free song data. Here are a few examples:

**1. Retrieving a song by ID:**
elixir
alias CopyrightFreeSongs.Songs

song = Songs.get_by_id(123)

case song do
  {:ok, song_data} ->
    IO.puts("Song Title: #{song_data.title}")
    IO.puts("Artist: #{song_data.artist}")
  {:error, :not_found} ->
    IO.puts("Song with ID 123 not found.")
end

**2. Listing all songs:**
elixir
alias CopyrightFreeSongs.Songs

songs = Songs.list_all()

Enum.each(songs, fn song ->
  IO.puts("Title: #{song.title}, Artist: #{song.artist}")
end)

**3. Filtering songs by genre:**
elixir
alias CopyrightFreeSongs.Songs

genre = "Electronic"
filtered_songs = Songs.list_all() |> Enum.filter(fn song -> song.genre == genre end)

if Enum.empty?(filtered_songs) do
  IO.puts("No songs found in the genre: #{genre}")
else
  IO.puts("Songs in the genre: #{genre}")
  Enum.each(filtered_songs, fn song ->
    IO.puts("  - #{song.title} by #{song.artist}")
  end)
end

**4. Checking if a song is available:**
elixir
alias CopyrightFreeSongs.Songs

song = %{id: 456, title: "Sunset Vibes", artist: "DJ Aurora", is_available: true}

case Songs.is_available?(song) do
  true -> IO.puts("#{song.title} by #{song.artist} is available.")
  false -> IO.puts("#{song.title} by #{song.artist} is not currently available.")
end

**5. Transforming song data using pipes:**
elixir
alias CopyrightFreeSongs.Songs

Songs.get_by_id(789)
|> case do
  {:ok, song} ->
    song
    |> Map.get(:title)
    |> String.upcase()
    |> IO.puts()
  {:error, :not_found} ->
    IO.puts("Song with ID 789 not found.")
end

## Features

*   **Easy Access:** Provides simple functions to retrieve copyright-free song data.
*   **Data Structures:** Returns song data as Elixir maps for easy manipulation.
*   **Filtering:**  Supports filtering songs based on various criteria.
*   **Availability Checks:** Easily check if a song is currently available for use.
*   **Comprehensive Data:** Includes song titles, artists, genres, and other relevant information.

## License

MIT

This package is part of the copyright-free-songs ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/music/copyright-free-songs/