lib/feedlrop/feedlrop.rb in feedlrop-0.1.20 vs lib/feedlrop/feedlrop.rb in feedlrop-0.1.21

- old
+ new

@@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- require 'arxutils' require 'arxutils/store' require 'csv' require 'pp' +require 'feedlr' +require 'awesome_print' module Feedlrop class Feedlrop def initialize( token , kind, hs ) @@ -22,41 +24,53 @@ n = Time.now fname = %Q!#{n.year}-#{n.month}-#{n.day}-#{n.hour}-#{n.min}-#{n.sec}.#{ext}! File.open( fname , "w") end - def csv_open - @csv = CSV.new(get_output_file("csv") , { - :headers => %w!category_id id count!, - :write_headers => true - } ) - end - - def csv_add(category_id , id , count) - @csv << [category_id , id , count ] - end - def get_all_unread_count - #p categories @categories.each do | x | # f.puts "id=#{x.id.split('/')[-1]}" f = true - if x.class == String + if x.class != String category_id = x.id.split('/')[-1] else f = false end next unless f - + en = @client.user_unread_counts( {:streamId => x.id } ) en.unreadcounts.each do |y| + puts "y.id=#{y.id}" if y.id =~ /^feed\/(.+)/ url = $1 csv_add( category_id , url , y[:count] ) @dbmgr.add( category_id , url , y[:count] ) end end end + end + + def print_user_profile + pp @profile + end + + def print_subscription + option = {:plain => true } + puts @client.user_subscriptions.size + @client.user_subscriptions.map{|m| puts m.id} + puts "===============" + @client.user_subscriptions.map{|m| ap m , option } + end + + def csv_open + @csv = CSV.new(get_output_file("csv") , { + :headers => %w!category_id id count!, + :write_headers => true + } ) + end + + def csv_add(category_id , id , count) + @csv << [category_id , id , count ] end def csv_close @csv.close end