mpd v0.1.0 Mpd.Song View Source

Link to this section Summary

Functions

Checks if song filanem insensitively compares to a given query

Checks if song tags or filename insensitively compares to a given query

Parses a MPD song output to the appropriate stucture.

Puts a tag in a given song

Gets song summary

Gets song tag by name

Checks if song tags insensitively compares to a given query

Checks if a given song tag insensitively compares to a given query

Link to this section Types

Specs

t() :: %Mpd.Song{file: term(), tags: term()}

Link to this section Functions

Specs

file_like?(t(), any()) :: boolean()

Checks if song filanem insensitively compares to a given query

Specs

like?(t(), binary()) :: boolean()

Checks if song tags or filename insensitively compares to a given query

Specs

parse(binary()) :: Mpt.Song.t()

Parses a MPD song output to the appropriate stucture.

A common song output (using :currentsong, for instance) has the following body

file: Rouge Pompier/Neve Campbell/10 Gaetan Mouillé.m4a
Last-Modified: 2020-05-21T04:19:18Z
Artist: Rouge Pompier
Album: Neve Campbell
Title: Gaetan Mouillé
Track: 10
Genre: French Pop
Date: 2020-03-20T07:00:00Z
Composer: Jessy Fuchs & Alexandre Portelance
Disc: 1
AlbumArtist: Rouge Pompier
Time: 141
duration: 140.829
Pos: 34
Id: 45
OK

he file: ... entry is refered as the song URI's, the rests are song tags. Since these may vary depending files, it'a map.

Examples

iex> Mpd.Status.parse(str)
%Mpd.Status{
  file: "Rouge Pompier/Neve Campbell/10 Gaetan Mouillé.m4a",
  tags: %{
    "Artist" => "Rouge Pompier",
    "Album" => "Neve Campbell",
    "Title" => "Gaetan Mouillé",
    "Track" => "10",
    "Genre" => "French Pop",
    ...
  }
}
Link to this function

put_tag(song, key, value)

View Source

Specs

put_tag(t(), binary(), binary()) :: t()

Puts a tag in a given song

Specs

summary(t()) :: binary()

Gets song summary

Link to this function

tag(song, tag, fallback \\ "")

View Source

Specs

tag(t(), binary(), any()) :: any()

Gets song tag by name

Specs

tag_like?(t(), any()) :: boolean()

Checks if song tags insensitively compares to a given query

Link to this function

tag_like?(song, tag, query)

View Source

Specs

tag_like?(t(), binary(), any()) :: boolean()

Checks if a given song tag insensitively compares to a given query