Class: Muzak::Plugin::Scrobble

Inherits:
StubPlugin show all
Includes:
Utils
Defined in:
lib/muzak/plugin/scrobble.rb

Instance Attribute Summary

Attributes inherited from StubPlugin

#instance

Instance Method Summary collapse

Methods included from Utils

#album_art?, #debug, #debug?, #error, #fail_arity, #info, #music?, #output, #pretty, resolve_command, resolve_method, #verbose, #verbose?, #warn, #warn_arity

Methods inherited from StubPlugin

plugin_name

Constructor Details

#initialize(instance) ⇒ Scrobble

Returns a new instance of Scrobble.



9
10
11
12
# File 'lib/muzak/plugin/scrobble.rb', line 9

def initialize(instance)
  super
  @username, @password_hash = Config.plugin_scrobble.split(":")
end

Instance Method Details

#song_loaded(song) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/muzak/plugin/scrobble.rb', line 14

def song_loaded(song)
  if song.title.nil? || song.artist.nil?
    debug "cowardly refusing to scrobble a song ('#{song.path}') with missing metadata"
    return
  end

  scrobble song
end