lib/hallon/scrobbler.rb in hallon-0.18.0 vs lib/hallon/scrobbler.rb in hallon-0.18.1
- old
+ new
@@ -42,11 +42,11 @@
# also mentioned the function would always return true for all other
# providers anyway
true
else
FFI::Buffer.alloc_out(:bool) do |buffer|
- Spotify.session_is_scrobbling_possible!(session.pointer, provider, buffer)
+ Spotify.try(:session_is_scrobbling_possible, session.pointer, provider, buffer)
return ! buffer.read_uchar.zero?
end
end
end
@@ -56,19 +56,19 @@
# scrobbling.credentials = 'kim', 'password'
#
# @param [Array<Username, Password>] credentials
def credentials=(credentials)
username, password = Array(credentials)
- Spotify.session_set_social_credentials!(session.pointer, provider, username, password)
+ Spotify.try(:session_set_social_credentials, session.pointer, provider, username, password)
end
# Enables or disables the local scrobbling setting.
#
# @param [Boolean] scrobble true if you want scrobbling to be enabled
def enabled=(scrobble)
state = scrobble ? :local_enabled : :local_disabled
- Spotify.session_set_scrobbling!(session.pointer, provider, state)
+ Spotify.try(:session_set_scrobbling, session.pointer, provider, state)
end
# @return [Boolean] true if scrobbling (global or local) is enabled.
def enabled?
FFI::Buffer.alloc_out(:int) do |buffer|
@@ -80,10 +80,10 @@
# Sets the local scrobbling state to the global state.
#
# @return [Scrobbler]
def reset
- tap { Spotify.session_set_scrobbling!(session.pointer, provider, :use_global_setting) }
+ tap { Spotify.try(:session_set_scrobbling, session.pointer, provider, :use_global_setting) }
end
protected
# Convert an integer state to an actual state symbol.