junkie 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ed71ddaca3f0e73496a82dc0c89398cbdf8cd45
4
- data.tar.gz: 4e00ffdbd8d799a0fdb246fc2a65bd91ff7bdc5d
3
+ metadata.gz: cee9998ed6619f25ad25d6ecf5a0b1630e590f62
4
+ data.tar.gz: 167176d895dcde45b58d63d01bcda1678dcda5dd
5
5
  SHA512:
6
- metadata.gz: bec01655ec952f9e58fa60e23b4e16eb4db1649bd09809e474088d405eabf5f74b5aa4912cfa7437699abd29b0653c0feb73e8b8e25935027bff51f76a9436b9
7
- data.tar.gz: bc3576523ca070cd0ab381f13185434eaf6bb233301a469f24bafea01fc489db5c553002d12fc16498fd6b088505893feb8f7ca739a6b3ef92a5051cd3f9e895
6
+ metadata.gz: a8d7c7baa3489f5a1ea4bf4e81d1766662e20edb4cf77742b435be03c5ad33f7fd09b88a2e9f1a0b20436917b214b6ff84957244190f11650a4e57eadcff78cd
7
+ data.tar.gz: b4824a30267a7b4e0b382d33bb8f2f6ad9c4e7424cd0d9d88d40367ba889110d41082fe9cfd225b2c029740f709d147fc0f563c00c42a3d38a2c2e99fb083df2
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  *.swo
19
19
  *.swp
20
+ pyload/
data/junkie.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.required_ruby_version = '>= 1.9.0'
20
+ gem.required_ruby_version = '>= 1.9.3'
21
21
  gem.add_runtime_dependency('eventmachine', [">= 1.0"])
22
22
  gem.add_runtime_dependency('em-http-request', [">= 1.0"])
23
23
  gem.add_runtime_dependency('yajl-ruby', ["~> 1.1.0"])
@@ -29,6 +29,6 @@ Gem::Specification.new do |gem|
29
29
  gem.add_runtime_dependency('logging', ["~> 1.8.0"])
30
30
  gem.add_runtime_dependency('twitter', ["~> 4.4.0"])
31
31
  gem.add_runtime_dependency('thin')
32
- gem.add_runtime_dependency('sinatra')
32
+ gem.add_runtime_dependency('sinatra', ["~> 1.3.3"])
33
33
  gem.add_runtime_dependency('sinatra-websocket', ["~> 0.2.1"])
34
34
  end
@@ -0,0 +1,58 @@
1
+ require 'json'
2
+
3
+ module Junkie
4
+ module Notification
5
+
6
+ # This module writes all completed episodes to a log file which could be
7
+ # handled by tools like series to get the right series name for an episode
8
+ class Dumper
9
+ include Log, Config
10
+
11
+ DEFAULT_CONFIG = {
12
+ enabled: false,
13
+ dump_file: "",
14
+ }
15
+
16
+ def initialize(channels)
17
+ @channels = channels
18
+ @config = Config.get_config(self)
19
+
20
+ if @config[:enabled] and @config[:dump_file] != ""
21
+
22
+ # bind to channel
23
+ @channels[:notifications].subscribe do |episode|
24
+ next unless episode.status == :extracted
25
+
26
+ log.info("Got an extracted episode from the channel: #{ episode }")
27
+ dump_episode(episode)
28
+ end
29
+
30
+ else
31
+ log.info("Dumper is disabled or no dump_file has been configured")
32
+ end
33
+ end
34
+
35
+ def dump_episode(episode)
36
+ data = []
37
+
38
+ if File.file? @config[:dump_file]
39
+ loaded = JSON.load(File.read(@config[:dump_file]))
40
+ ( data = loaded ) if loaded.is_a? Array
41
+ end
42
+
43
+ data << {
44
+ id: episode.id,
45
+ series: episode.series,
46
+ extracted_at: DateTime.now
47
+ }
48
+
49
+ open(@config[:dump_file], "w") do |f|
50
+ f.write(JSON.dump(data))
51
+ end
52
+
53
+ rescue Exception => e
54
+ log.error(e)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -34,6 +34,7 @@ module Junkie
34
34
 
35
35
  @pyload_observer = Junkie::Pyload::Observer.new(@channels)
36
36
  @twitter_notification = Junkie::Notification::Twitter.new(@channels)
37
+ @dumper = Junkie::Notification::Dumper.new(@channels)
37
38
 
38
39
  @found_episodes = Hash.new
39
40
  build_procs # has to be called here
@@ -1,3 +1,3 @@
1
1
  module Junkie
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
data/lib/junkie.rb CHANGED
@@ -9,6 +9,7 @@ require 'junkie/patched/sjunkieex'
9
9
  require 'junkie/pyload/api'
10
10
  require 'junkie/pyload/observer'
11
11
  require 'junkie/notification/twitter'
12
+ require 'junkie/notification/dumper'
12
13
 
13
14
  module Junkie
14
15
 
metadata CHANGED
@@ -1,195 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junkie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Böhm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-07 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: em-http-request
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yajl-ruby
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.1.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.5'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: hashconfig
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.0.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.0.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: serienrenamer
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.0.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.0.1
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sjunkieex
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.0.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.0.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: sindex
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.0.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.0.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: logging
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.8.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.8.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: twitter
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 4.4.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 4.4.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: thin
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sinatra
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0'
173
+ version: 1.3.3
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0'
180
+ version: 1.3.3
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sinatra-websocket
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: 0.2.1
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ~>
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: 0.2.1
195
195
  description: TV series management application
@@ -200,9 +200,9 @@ executables:
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
- - .gitignore
204
- - .rspec
205
- - .travis.yml
203
+ - ".gitignore"
204
+ - ".rspec"
205
+ - ".travis.yml"
206
206
  - Gemfile
207
207
  - LICENSE.txt
208
208
  - README.md
@@ -215,6 +215,7 @@ files:
215
215
  - lib/junkie/errors.rb
216
216
  - lib/junkie/helper.rb
217
217
  - lib/junkie/log.rb
218
+ - lib/junkie/notification/dumper.rb
218
219
  - lib/junkie/notification/twitter.rb
219
220
  - lib/junkie/patched/sjunkieex.rb
220
221
  - lib/junkie/pyload/api.rb
@@ -239,17 +240,17 @@ require_paths:
239
240
  - lib
240
241
  required_ruby_version: !ruby/object:Gem::Requirement
241
242
  requirements:
242
- - - '>='
243
+ - - ">="
243
244
  - !ruby/object:Gem::Version
244
- version: 1.9.0
245
+ version: 1.9.3
245
246
  required_rubygems_version: !ruby/object:Gem::Requirement
246
247
  requirements:
247
- - - '>='
248
+ - - ">="
248
249
  - !ruby/object:Gem::Version
249
250
  version: '0'
250
251
  requirements: []
251
252
  rubyforge_project:
252
- rubygems_version: 2.0.3
253
+ rubygems_version: 2.2.0
253
254
  signing_key:
254
255
  specification_version: 4
255
256
  summary: TV series managament tool that does all the work you have with your series.