automatic 13.5.0 → 13.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +11 -5
- data/README.md +4 -6
- data/VERSION +1 -1
- data/automatic.gemspec +61 -18
- data/doc/ChangeLog +25 -0
- data/doc/PLUGINS +202 -12
- data/doc/PLUGINS.ja +221 -30
- data/doc/README +1 -1
- data/doc/README.ja +1 -1
- data/lib/automatic.rb +3 -3
- data/lib/automatic/feed_parser.rb +2 -2
- data/lib/automatic/log.rb +12 -2
- data/lib/automatic/pipeline.rb +1 -1
- data/lib/automatic/recipe.rb +5 -2
- data/plugins/custom_feed/svn_log.rb +3 -3
- data/plugins/filter/absolute_uri.rb +8 -4
- data/plugins/filter/accept.rb +61 -0
- data/plugins/filter/full_feed.rb +4 -5
- data/plugins/filter/github_feed.rb +36 -0
- data/plugins/filter/ignore.rb +1 -1
- data/plugins/filter/image.rb +1 -1
- data/plugins/filter/image_source.rb +34 -10
- data/plugins/filter/one.rb +1 -1
- data/plugins/filter/rand.rb +1 -1
- data/plugins/filter/sanitize.rb +50 -0
- data/plugins/filter/sort.rb +1 -1
- data/plugins/filter/tumblr_resize.rb +1 -1
- data/plugins/publish/console.rb +3 -3
- data/plugins/publish/console_link.rb +30 -0
- data/plugins/publish/eject.rb +42 -0
- data/plugins/publish/fluentd.rb +42 -0
- data/plugins/publish/google_calendar.rb +3 -3
- data/plugins/publish/hatena_bookmark.rb +1 -1
- data/plugins/publish/hipchat.rb +45 -0
- data/plugins/publish/instapaper.rb +2 -1
- data/plugins/publish/memcached.rb +44 -0
- data/plugins/publish/pocket.rb +1 -1
- data/plugins/publish/twitter.rb +1 -1
- data/plugins/store/database.rb +3 -3
- data/plugins/store/full_text.rb +2 -2
- data/plugins/store/permalink.rb +1 -1
- data/plugins/store/target_link.rb +3 -2
- data/plugins/subscription/chan_toru.rb +56 -0
- data/plugins/subscription/feed.rb +1 -1
- data/plugins/subscription/g_guide.rb +48 -0
- data/plugins/subscription/google_reader_star.rb +3 -3
- data/plugins/subscription/link.rb +2 -2
- data/plugins/subscription/pocket.rb +49 -0
- data/plugins/subscription/text.rb +3 -12
- data/plugins/subscription/tumblr.rb +7 -1
- data/plugins/subscription/twitter.rb +1 -1
- data/plugins/subscription/twitter_search.rb +50 -0
- data/plugins/subscription/weather.rb +7 -41
- data/script/build +3 -0
- data/spec/fixtures/sampleRecipe.yml +1 -1
- data/spec/lib/automatic/log_spec.rb +31 -0
- data/spec/lib/automatic/pipeline_spec.rb +1 -1
- data/spec/lib/automatic/recipe_spec.rb +1 -1
- data/spec/lib/automatic_spec.rb +3 -3
- data/spec/plugins/custom_feed/svn_log_spec.rb +1 -1
- data/spec/plugins/filter/absolute_uri_spec.rb +1 -1
- data/spec/plugins/filter/accept_spec.rb +331 -0
- data/spec/plugins/filter/full_feed_spec.rb +4 -6
- data/spec/plugins/filter/github_feed_spec.rb +54 -0
- data/spec/plugins/filter/ignore_spec.rb +1 -1
- data/spec/plugins/filter/image_source_spec.rb +17 -3
- data/spec/plugins/filter/image_spec.rb +1 -1
- data/spec/plugins/filter/one_spec.rb +1 -1
- data/spec/plugins/filter/rand_spec.rb +1 -1
- data/spec/plugins/filter/sanitize_spec.rb +153 -0
- data/spec/plugins/filter/sort_spec.rb +1 -1
- data/spec/plugins/filter/tumblr_resize_spec.rb +1 -1
- data/spec/plugins/notify/ikachan_spec.rb +1 -1
- data/spec/plugins/publish/console_spec.rb +1 -1
- data/spec/plugins/publish/eject_spec.rb +40 -0
- data/spec/plugins/publish/fluentd_spec.rb +39 -0
- data/spec/plugins/publish/google_calendar_spec.rb +1 -1
- data/spec/plugins/publish/hatena_bookmark_spec.rb +1 -1
- data/spec/plugins/publish/hipchat_spec.rb +69 -0
- data/spec/plugins/publish/instapaper_spec.rb +42 -28
- data/spec/plugins/publish/memcached_spec.rb +63 -0
- data/spec/plugins/publish/pocket_spec.rb +33 -33
- data/spec/plugins/publish/twitter_spec.rb +57 -19
- data/spec/plugins/store/full_text_spec.rb +6 -1
- data/spec/plugins/store/permalink_spec.rb +18 -19
- data/spec/plugins/store/target_link_spec.rb +1 -1
- data/spec/plugins/subscription/chan_toru_spec.rb +56 -0
- data/spec/plugins/subscription/feed_spec.rb +1 -1
- data/spec/plugins/subscription/g_guide_spec.rb +76 -0
- data/spec/plugins/subscription/google_reader_star_spec.rb +1 -1
- data/spec/plugins/subscription/link_spec.rb +1 -1
- data/spec/plugins/subscription/pocket_spec.rb +57 -0
- data/spec/plugins/subscription/text_spec.rb +1 -14
- data/spec/plugins/subscription/tumblr_spec.rb +3 -2
- data/spec/plugins/subscription/twitter_search_spec.rb +57 -0
- data/spec/plugins/subscription/twitter_spec.rb +3 -2
- data/spec/plugins/subscription/weather_spec.rb +2 -15
- data/spec/spec_helper.rb +1 -0
- data/test/integration/test_chan_toru.yml +19 -0
- data/test/integration/test_fluentd.yml +20 -0
- data/test/integration/test_pocket.yml +21 -0
- data/test/integration/test_sanitize.yml +22 -0
- data/test/integration/test_twitter_search.yml +21 -0
- metadata +145 -24
- data/plugins/publish/mail.rb +0 -64
- data/plugins/publish/smtp.rb +0 -48
- data/spec/plugins/publish/mail_spec.rb +0 -53
- data/spec/plugins/publish/smtp_spec.rb +0 -49
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Feb 24, 2012
|
|
5
5
|
# Updated:: Jan 8, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
|
@@ -37,8 +37,8 @@ module Automatic::Plugin
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
puts "日付 : #{date}"
|
|
41
|
-
puts "タイトル : #{text}"
|
|
40
|
+
Automatic::Log.puts("info", "日付 : #{date}")
|
|
41
|
+
Automatic::Log.puts("info", "タイトル : #{text}")
|
|
42
42
|
|
|
43
43
|
# Register to calendar
|
|
44
44
|
require 'rubygems'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Feb 22, 2012
|
|
5
5
|
# Updated:: Mar 7, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Publish::Hipchat
|
|
3
|
+
# Author:: Kohei Hasegawa <http://github.com/banyan>
|
|
4
|
+
# Created:: Jun 6, 2013
|
|
5
|
+
# Updated:: Jun 6, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
module Automatic::Plugin
|
|
10
|
+
require 'hipchat'
|
|
11
|
+
|
|
12
|
+
class PublishHipchat
|
|
13
|
+
def initialize(config, pipeline=[])
|
|
14
|
+
@config = config
|
|
15
|
+
@pipeline = pipeline
|
|
16
|
+
@options = {
|
|
17
|
+
'color' => 'yellow',
|
|
18
|
+
'notify' => false
|
|
19
|
+
}
|
|
20
|
+
@options.merge!(@config.select { |k, v| @options.include?(k) })
|
|
21
|
+
@client = HipChat::Client.new(@config['api_token'])[@config['room_id']]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def run
|
|
25
|
+
@pipeline.each {|feeds|
|
|
26
|
+
unless feeds.nil?
|
|
27
|
+
feeds.items.each {|feed|
|
|
28
|
+
retries = 0
|
|
29
|
+
begin
|
|
30
|
+
@client.send(@config['username'], feed.description, @options)
|
|
31
|
+
Automatic::Log.puts("info", "post: #{feed.description.gsub(/[\r\n]/,'')[0..50]}...") rescue nil
|
|
32
|
+
rescue => e
|
|
33
|
+
retries += 1
|
|
34
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, #{e.message}")
|
|
35
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
36
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
|
37
|
+
end
|
|
38
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
}
|
|
42
|
+
@pipeline
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# 774 <http://id774.net>
|
|
5
5
|
# Created:: Feb 9, 2013
|
|
6
6
|
# Updated:: Mar 23, 2013
|
|
7
|
-
# Copyright::
|
|
7
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
9
|
|
|
10
10
|
module Automatic::Plugin
|
|
@@ -32,6 +32,7 @@ module Automatic::Plugin
|
|
|
32
32
|
Automatic::Log.puts(:info, message)
|
|
33
33
|
else
|
|
34
34
|
Automatic::Log.puts(:error, "#{res.code} Error: #{url}")
|
|
35
|
+
raise
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Publish::Memcached
|
|
3
|
+
# Author:: 774 <http://id774.net>
|
|
4
|
+
# Created:: Jun 25, 2013
|
|
5
|
+
# Updated:: Jun 25, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
module Automatic::Plugin
|
|
10
|
+
class PublishMemcached
|
|
11
|
+
require 'dalli'
|
|
12
|
+
|
|
13
|
+
def initialize(config, pipeline=[])
|
|
14
|
+
@config = config
|
|
15
|
+
@pipeline = pipeline
|
|
16
|
+
@cache = Dalli::Client.new(
|
|
17
|
+
@config['host'] + ":" +
|
|
18
|
+
@config['port'])
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def run
|
|
22
|
+
hash = {}
|
|
23
|
+
@pipeline.each {|feeds|
|
|
24
|
+
unless feeds.nil?
|
|
25
|
+
feeds.items.each {|feed|
|
|
26
|
+
hash[feed.link] =
|
|
27
|
+
{
|
|
28
|
+
:title => feed.title,
|
|
29
|
+
:description => feed.description,
|
|
30
|
+
:content => feed.content_encoded,
|
|
31
|
+
:created_at => Time.now.strftime("%Y/%m/%d %X")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
}
|
|
36
|
+
begin
|
|
37
|
+
@cache.set(@config['key'], hash)
|
|
38
|
+
rescue
|
|
39
|
+
Automatic::Log.puts("warn", "Skip feed due to fault in put to memcached.")
|
|
40
|
+
end
|
|
41
|
+
@pipeline
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/plugins/publish/pocket.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# Created:: May 15, 2013
|
|
5
5
|
# Updated:: May 15, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
data/plugins/publish/twitter.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# Created:: May 5, 2013
|
|
5
5
|
# Updated:: May 5, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
data/plugins/store/database.rb
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# 774 <http://id774.net>
|
|
5
5
|
# soramugi <http://soramugi.net>
|
|
6
6
|
# Created:: Feb 27, 2012
|
|
7
|
-
# Updated::
|
|
8
|
-
# Copyright::
|
|
7
|
+
# Updated:: Jun 27, 2013
|
|
8
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
9
9
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
10
10
|
|
|
11
11
|
require 'active_record'
|
|
@@ -14,7 +14,7 @@ module Automatic::Plugin
|
|
|
14
14
|
module Database
|
|
15
15
|
def for_each_new_feed
|
|
16
16
|
prepare_database
|
|
17
|
-
existing_records = model_class.
|
|
17
|
+
existing_records = model_class.all
|
|
18
18
|
@return_feeds = []
|
|
19
19
|
@pipeline.each {|feeds|
|
|
20
20
|
unless feeds.nil?
|
data/plugins/store/full_text.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Feb 26, 2012
|
|
5
5
|
# Updated:: Jun 14, 2012
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
require 'plugins/store/database'
|
|
@@ -39,7 +39,7 @@ module Automatic::Plugin
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def run
|
|
42
|
-
for_each_new_feed {
|
|
42
|
+
for_each_new_feed {|feed|
|
|
43
43
|
Automatic::Log.puts("info", "Saving: #{feed.link}")
|
|
44
44
|
begin
|
|
45
45
|
Blog.create(
|
data/plugins/store/permalink.rb
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Author:: 774 <http://id774.net>
|
|
5
5
|
# Created:: Feb 22, 2012
|
|
6
6
|
# Updated:: Sep 18, 2012
|
|
7
|
-
# Copyright::
|
|
7
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
9
|
|
|
10
10
|
require 'plugins/store/database'
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Author:: 774 <http://id774.net>
|
|
5
5
|
# Created:: Feb 28, 2012
|
|
6
6
|
# Updated:: Feb 9, 2013
|
|
7
|
-
# Copyright::
|
|
7
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
9
|
|
|
10
10
|
require 'open-uri'
|
|
@@ -23,6 +23,7 @@ module Automatic::Plugin
|
|
|
23
23
|
feeds.items.each {|feed|
|
|
24
24
|
unless feed.link.nil?
|
|
25
25
|
Automatic::Log.puts("info", "Downloading: #{feed.link}")
|
|
26
|
+
FileUtils.mkdir_p(@config['path']) unless FileTest.exist?(@config['path'])
|
|
26
27
|
retries = 0
|
|
27
28
|
begin
|
|
28
29
|
retries += 1
|
|
@@ -43,7 +44,7 @@ module Automatic::Plugin
|
|
|
43
44
|
private
|
|
44
45
|
def wget(url)
|
|
45
46
|
filename = url.split(/\//).last
|
|
46
|
-
open(url) {
|
|
47
|
+
open(url) {|source|
|
|
47
48
|
open(File.join(@config['path'], filename), "w+b") { |o|
|
|
48
49
|
o.print source.read
|
|
49
50
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Subscription::ChanToru
|
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
|
4
|
+
# Created:: Jun 28, 2013
|
|
5
|
+
# Updated:: Jun 28, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
require File.expand_path(File.dirname(__FILE__) + '/g_guide')
|
|
10
|
+
|
|
11
|
+
module Automatic::Plugin
|
|
12
|
+
class SubscriptionChanToru
|
|
13
|
+
|
|
14
|
+
def initialize(config, pipeline=[])
|
|
15
|
+
@config = config
|
|
16
|
+
@pipeline = pipeline
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def g_guide_pipeline
|
|
20
|
+
SubscriptionGGuide.new(@config, @pipeline).run
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run
|
|
24
|
+
retries = 0
|
|
25
|
+
begin
|
|
26
|
+
pipeline = g_guide_pipeline
|
|
27
|
+
pipeline.each {|feeds|
|
|
28
|
+
feeds.items.each {|feed|
|
|
29
|
+
feed = link_change(feed)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
@pipeline = pipeline
|
|
33
|
+
rescue
|
|
34
|
+
retries += 1
|
|
35
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
|
|
36
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
37
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
@pipeline
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def link_change(feed)
|
|
44
|
+
feed.link.gsub(/([0-9]+)/) do |pid|
|
|
45
|
+
if pid != ''
|
|
46
|
+
feed.link = "https://tv.so-net.ne.jp/chan-toru/intent" +
|
|
47
|
+
"?cat=1&area=23&pid=#{pid}&from=tw"
|
|
48
|
+
else
|
|
49
|
+
feed.link = nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
feed
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Feb 22, 2012
|
|
5
5
|
# Updated:: Feb 8, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Subscription::GGuide
|
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
|
4
|
+
# Created:: Jun 28, 2013
|
|
5
|
+
# Updated:: Jun 28, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
module Automatic::Plugin
|
|
10
|
+
class SubscriptionGGuide
|
|
11
|
+
G_GUIDE_RSS = 'http://tv.so-net.ne.jp/rss/schedulesBySearch.action?'
|
|
12
|
+
|
|
13
|
+
def initialize(config, pipeline=[])
|
|
14
|
+
@config = config
|
|
15
|
+
@pipeline = pipeline
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run
|
|
19
|
+
retries = 0
|
|
20
|
+
begin
|
|
21
|
+
@pipeline << Automatic::FeedParser.get(feed_url)
|
|
22
|
+
rescue
|
|
23
|
+
retries += 1
|
|
24
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
|
|
25
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
26
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
|
27
|
+
end
|
|
28
|
+
@pipeline
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def feed_url
|
|
32
|
+
feed = G_GUIDE_RSS
|
|
33
|
+
unless @config['keyword'].nil?
|
|
34
|
+
feed += "condition.keyword=#{@config['keyword']}&"
|
|
35
|
+
end
|
|
36
|
+
feed += station_param
|
|
37
|
+
URI.encode(feed)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def station_param
|
|
41
|
+
station = 0
|
|
42
|
+
unless @config['station'].nil?
|
|
43
|
+
station = '1' if @config['station'] == '地上波'
|
|
44
|
+
end
|
|
45
|
+
"stationPlatformId=#{station}&"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# 774 <http://id774.net>
|
|
5
5
|
# Created:: Feb 10, 2013
|
|
6
|
-
# Updated::
|
|
7
|
-
# Copyright::
|
|
6
|
+
# Updated:: Jun 28, 2013
|
|
7
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
8
8
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
9
9
|
|
|
10
10
|
module Automatic::Plugin
|
|
@@ -46,7 +46,7 @@ module Automatic::Plugin
|
|
|
46
46
|
unless feeds.nil?
|
|
47
47
|
feeds.each {|feed|
|
|
48
48
|
unless feed.link.href.nil?
|
|
49
|
-
Automatic::Log.puts("info", "
|
|
49
|
+
Automatic::Log.puts("info", "Feed: #{feed.link.href}")
|
|
50
50
|
item = maker.items.new_item
|
|
51
51
|
item.title = feed.title.content # google reader feed
|
|
52
52
|
item.link = feed.link.href # google reader feed
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: 774 <http://id774.net>
|
|
4
4
|
# Created:: Sep 18, 2012
|
|
5
5
|
# Updated:: Apr 5, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
|
@@ -22,7 +22,7 @@ module Automatic::Plugin
|
|
|
22
22
|
@config['urls'].each {|url|
|
|
23
23
|
retries = 0
|
|
24
24
|
begin
|
|
25
|
-
create_rss(url)
|
|
25
|
+
create_rss(URI.encode(url))
|
|
26
26
|
rescue
|
|
27
27
|
retries += 1
|
|
28
28
|
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{url}")
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Name:: Automatic::Plugin::Subscription::Pocket
|
|
3
|
+
# Author:: soramugi <http://soramugi.net>
|
|
4
|
+
# Created:: May 21, 2013
|
|
5
|
+
# Updated:: May 21, 2013
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
|
+
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
|
+
|
|
9
|
+
module Automatic::Plugin
|
|
10
|
+
class SubscriptionPocket
|
|
11
|
+
require 'pocket'
|
|
12
|
+
|
|
13
|
+
def initialize(config, pipeline=[])
|
|
14
|
+
@config = config
|
|
15
|
+
@pipeline = pipeline
|
|
16
|
+
Pocket.configure do |c|
|
|
17
|
+
c.consumer_key = @config['consumer_key']
|
|
18
|
+
c.access_token = @config['access_token']
|
|
19
|
+
end
|
|
20
|
+
@client = Pocket.client
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def run
|
|
24
|
+
retries = 0
|
|
25
|
+
begin
|
|
26
|
+
dummyfeeds = cleate_dummy_feed(@client.retrieve(@config['optional']))
|
|
27
|
+
@pipeline << Automatic::FeedParser.create(dummyfeeds)
|
|
28
|
+
rescue
|
|
29
|
+
retries += 1
|
|
30
|
+
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{retries}")
|
|
31
|
+
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
32
|
+
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
|
33
|
+
end
|
|
34
|
+
@pipeline
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def cleate_dummy_feed(retrieve)
|
|
38
|
+
dummyFeeds = []
|
|
39
|
+
retrieve['list'].each {|key,list|
|
|
40
|
+
dummy = Hashie::Mash.new
|
|
41
|
+
dummy.title = list['given_title']
|
|
42
|
+
dummy.link = list['given_url']
|
|
43
|
+
dummy.description = list['excerpt']
|
|
44
|
+
dummyFeeds << dummy
|
|
45
|
+
}
|
|
46
|
+
dummyFeeds
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Author:: soramugi <http://soramugi.net>
|
|
4
4
|
# Created:: May 6, 2013
|
|
5
5
|
# Updated:: May 6, 2013
|
|
6
|
-
# Copyright::
|
|
6
|
+
# Copyright:: Copyright (c) 2012-2013 Automatic Ruby Developers.
|
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
|
8
8
|
|
|
9
9
|
module Automatic::Plugin
|
|
@@ -67,18 +67,9 @@ module Automatic::Plugin
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def run
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if @dummyfeeds != []
|
|
73
|
-
@pipeline << Automatic::FeedParser.create(@dummyfeeds)
|
|
74
|
-
end
|
|
75
|
-
rescue
|
|
76
|
-
retries += 1
|
|
77
|
-
Automatic::Log.puts("error", "ErrorCount: #{retries}, Fault in parsing: #{feed}")
|
|
78
|
-
sleep @config['interval'].to_i unless @config['interval'].nil?
|
|
79
|
-
retry if retries <= @config['retry'].to_i unless @config['retry'].nil?
|
|
70
|
+
if @dummyfeeds != []
|
|
71
|
+
@pipeline << Automatic::FeedParser.create(@dummyfeeds)
|
|
80
72
|
end
|
|
81
|
-
|
|
82
73
|
@pipeline
|
|
83
74
|
end
|
|
84
75
|
end
|