lib/ayadn/scroll.rb in ayadn-1.2.2 vs lib/ayadn/scroll.rb in ayadn-1.2.3
- old
+ new
@@ -18,22 +18,47 @@
end
def scroll_it(target, options, niceranks)
options = check_raw(options)
orig_target = target
+
+ ###DEBUG
+ @iter = 0
+ @adn = 1
+
loop do
begin
stream = get(target, options)
+
+ ###DEBUG
+ @adn += 1
+
if options[:filter] == true
unless stream['data'].empty?
- niceranks = @api.get_niceranks stream
+ ###DEBUG
+ #niceranks = @api.get_niceranks stream
+ niceranks, @iter = @api.get_niceranks stream, @iter
+ ###DEBUG
+ if Settings.options[:timeline][:show_debug] == true
+ puts "@@@@@\nADN calls:\t#{@adn}\n".color(Settings.options[:colors][:debug])
+ puts "NiceRank calls:\t#{@iter}".color(Settings.options[:colors][:debug])
+ puts "@@@@@\n".color(Settings.options[:colors][:debug])
+ end
else
- niceranks = {}
+ niceranks = {}
end
else
niceranks = {}
end
+
+ if Settings.options[:timeline][:show_debug] == true
+ puts "+++++\nStream meta:\t#{stream['meta']}\n".color(Settings.options[:colors][:debug])
+ puts "Options:\t#{options.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Target:\t\t#{target.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Posts:\t\t#{stream['data'].length}\n+++++\n".color(Settings.options[:colors][:debug])
+ end
+
target = "explore:#{target}" if explore?(target)
show_if_new(stream, options, target, niceranks)
target = orig_target if target =~ /explore/
options = save_then_return(stream, options)
countdown
@@ -48,10 +73,18 @@
user = @api.get_user(username)
id = user['data']['id']
loop do
begin
stream = @api.get_mentions(username, options)
+
+ if Settings.options[:timeline][:show_debug] == true
+ puts "+++++\nStream meta:\t#{stream['meta']}\n".color(Settings.options[:colors][:debug])
+ puts "Options:\t#{options.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Target:\t\t#{username}\n".color(Settings.options[:colors][:debug])
+ puts "Posts:\t\t#{stream['data'].length}\n+++++\n".color(Settings.options[:colors][:debug])
+ end
+
show_if_new(stream, options, "mentions:#{id}")
options = save_then_return(stream, options)
countdown
rescue Interrupt
canceled
@@ -64,10 +97,18 @@
user = @api.get_user(username)
id = user['data']['id']
loop do
begin
stream = @api.get_posts(username, options)
+
+ if Settings.options[:timeline][:show_debug] == true
+ puts "+++++\nStream meta:\t#{stream['meta']}\n".color(Settings.options[:colors][:debug])
+ puts "Options:\t#{options.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Target:\t\t#{username}\n".color(Settings.options[:colors][:debug])
+ puts "Posts:\t\t#{stream['data'].length}\n+++++\n".color(Settings.options[:colors][:debug])
+ end
+
show_if_new(stream, options, "posts:#{id}")
options = save_then_return(stream, options)
countdown
rescue Interrupt
canceled
@@ -78,10 +119,18 @@
def convo(post_id, options)
options = check_raw(options)
loop do
begin
stream = @api.get_convo(post_id, options)
+
+ if Settings.options[:timeline][:show_debug] == true
+ puts "+++++\nStream meta:\t#{stream['meta']}\n".color(Settings.options[:colors][:debug])
+ puts "Options:\t#{options.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Target:\t\t#{post_id}\n".color(Settings.options[:colors][:debug])
+ puts "Posts:\t\t#{stream['data'].length}\n+++++\n".color(Settings.options[:colors][:debug])
+ end
+
show_if_new(stream, options, "replies:#{post_id}")
options = save_then_return(stream, options)
countdown
rescue Interrupt
canceled
@@ -92,9 +141,17 @@
def messages(channel_id, options)
options = check_raw(options)
loop do
begin
stream = @api.get_messages(channel_id, options)
+
+ if Settings.options[:timeline][:show_debug] == true
+ puts "+++++\nStream meta:\t#{stream['meta']}\n".color(Settings.options[:colors][:debug])
+ puts "Options:\t#{options.inspect}\n".color(Settings.options[:colors][:debug])
+ puts "Target:\t\t#{channel_id}\n".color(Settings.options[:colors][:debug])
+ puts "Posts:\t\t#{stream['data'].length}\n+++++\n".color(Settings.options[:colors][:debug])
+ end
+
show_if_new(stream, options, "channel:#{channel_id}")
options = save_then_return(stream, options)
countdown
rescue Interrupt
canceled