Edit

thodg/mpd_client/examples/albumart.rb

Branch :

  • Show log

    Commit

  • Author : Anton Maminov
    Date : 2022-05-05 21:43:47
    Hash : 84303a2c
    Message : Create albumart.rb

  • examples/albumart.rb
  • # 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