Module: MPD::Plugins::Stickers

Included in:
MPD
Defined in:
lib/ruby-mpd/plugins/stickers.rb

Overview

“Stickers” are pieces of information attached to existing MPD objects (e.g. song files, directories, albums). Clients can create arbitrary name/value pairs. MPD itself does not assume any special meaning in them.

The goal is to allow clients to share additional (possibly dynamic) information about songs, which is neither stored on the client (not available to other clients), nor stored in the song files (MPD has no write access).

Client developers should create a standard for common sticker names, to ensure interoperability.

Objects which may have stickers are addressed by their object type (“song” for song objects) and their URI (the path within the database for songs).

Instance Method Summary collapse

Instance Method Details

#delete_sticker(type, uri, name = nil) ⇒ Object

Deletes a sticker value from the specified object. If you do not specify a sticker name, all sticker values are deleted.



34
35
36
# File 'lib/ruby-mpd/plugins/stickers.rb', line 34

def delete_sticker(type, uri, name = nil)
  send_command :sticker, :delete, type, uri, name
end

#find_sticker(type, uri, name) ⇒ Object

Searches the sticker database for stickers with the specified name, below the specified directory (URI). For each matching song, it prints the URI and that one sticker’s value.



46
47
48
# File 'lib/ruby-mpd/plugins/stickers.rb', line 46

def find_sticker(type, uri, name)
  send_command :sticker, :find, type, uri, name
end

#get_sticker(type, uri, name) ⇒ Object

Reads a sticker value for the specified object.



22
23
24
# File 'lib/ruby-mpd/plugins/stickers.rb', line 22

def get_sticker(type, uri, name)
  send_command :sticker, :get, type, uri, name
end

#list_stickers(type, uri) ⇒ Object

Lists the stickers for the specified object.



39
40
41
# File 'lib/ruby-mpd/plugins/stickers.rb', line 39

def list_stickers(type, uri)
  send_command :sticker, :list, type, uri
end

#set_sticker(type, uri, name, value) ⇒ Object

Adds a sticker value to the specified object. If a sticker item with that name already exists, it is replaced.



28
29
30
# File 'lib/ruby-mpd/plugins/stickers.rb', line 28

def set_sticker(type, uri, name, value)
  send_command :sticker, :set, type, uri, name, value
end