Hash :
b7ab0f6d
Author :
Date :
2013-01-09T17:00:41
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# encoding: utf-8
require 'bundler'
Bundler.setup :default
require 'logger'
require 'mpd_client'
type = ARGV[0]
what = ARGV[1]
client = MPDClient.new
client.log = Logger.new($stderr)
# Connecting to the server
client.connect('/var/run/mpd/socket')
puts "MPD version: #{client.mpd_version}"
puts "mpd_client version: #{MPDClient::VERSION}"
uri = "world/j/Jane Air/2012.Иллюзия полёта/12. Любить любовь.ogg"
# sticker set {TYPE} {URI} {NAME} {VALUE}
# Adds a sticker value to the specified object. If a sticker item with that name already exists, it is replaced.
#
client.sticker_set('song', uri, 'rating', '1')
# sticker get {TYPE} {URI} {NAME}
# Reads a sticker value for the specified object.
#
puts client.sticker_get('song', uri, 'rating')
# sticker list {TYPE} {URI}
# Lists the stickers for the specified object.
#
puts client.sticker_list('song', uri)
# sticker find {TYPE} {URI} {NAME}
# 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.
#
puts client.sticker_find('song', '/', 'rating')
# sticker delete {TYPE} {URI} [NAME]
# Deletes a sticker value from the specified object. If you do not specify a sticker name, all sticker values are deleted.
#
puts client.sticker_delete('song', uri, 'rating')
client.close
client.disconnect