Commit 84303a2ce81848e314b9c04c38d9635abc38eb70

Anton Maminov 2022-05-05T21:43:47

Create albumart.rb

diff --git a/examples/albumart.rb b/examples/albumart.rb
new file mode 100644
index 0000000..5090ca5
--- /dev/null
+++ b/examples/albumart.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+require 'bundler'
+Bundler.setup :default
+
+require 'logger'
+require 'mpd_client'
+
+# MPD::Client.log = Logger.new($stderr)
+
+client = MPD::Client.new
+client.connect('localhost', 6600)
+
+if (current_song = client.currentsong)
+  data, io = client.albumart(current_song['file'])
+  puts data
+  File.write('cover.jpg', io.string)
+end