Skip to content

Instantly share code, notes, and snippets.

@sahib
Created September 20, 2011 13:22
Show Gist options
  • Save sahib/1229056 to your computer and use it in GitHub Desktop.
Save sahib/1229056 to your computer and use it in GitHub Desktop.
glyr_opt_dlcallback
require './glyros.so'
q = Glyros::GlyrQuery.new
Glyros::glyr_query_init(q)
Glyros::glyr_opt_artist(q,"Equilibrium")
Glyros::glyr_opt_type(q,Glyros::GLYR_GET_ARTIST_PHOTOS)
Glyros::glyr_opt_number(q,5)
my_proc = Proc.new do |cache,query|
Glyros::glyr_cache_print cache
puts "----------"
# Instead you could return
# GLYRE_STOP_POST -- to stop, but to add this item to the result list
# GLYRE_STOP_PRE -- to stop and not add this item to the result list
# GLYRE_SKIP -- to not add this item to the result list
Glyros::GLYRE_OK
end
Glyros::glyr_opt_dlcallback(q,my_proc)
list = Glyros::glyr_get(q,nil,nil)
counter = 0
until list.nil?
list = list.next
counter += 1
end
puts "Got #{counter}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment