livescore-parser 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/bin/livescore-parser +1 -5
- data/lib/livescore-parser.rb +2 -2
- data/lib/livescore-parser/parser.rb +3 -3
- data/lib/livescore-parser/writer.rb +2 -7
- data/pages.yml +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28346a91d0d901ddf6a854e83e845aca7c903a1c
|
|
4
|
+
data.tar.gz: 0b91ec6c1d0c9d2d7b846d6511085fa60f155637
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e673425ef60ef01d82a894da198491638f42e296526a38060ddc49e29a645d1c07bb0092d323930ebd63e2f674e3c16b5e881b67c30a0ff1c6466c2803a5efe
|
|
7
|
+
data.tar.gz: 9ee8a819ba2e9eb60ded790929298cb7dcaa70afd378530bcbfb0c35d80d80e0df54fd07536315c363c314178ee8b38da52cd8605a4198b96e50297a16d12eaa
|
data/bin/livescore-parser
CHANGED
|
@@ -27,10 +27,6 @@ OptionParser.new do |op|
|
|
|
27
27
|
op.on("-c", "--pages PATH", "path to yml channel list") do |path|
|
|
28
28
|
options[:pages] = path
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
op.on("-d", "--destination PATH", "directory with XML files with parsed scores") do |path|
|
|
32
|
-
options[:destination] = path
|
|
33
|
-
end
|
|
34
30
|
end.parse!
|
|
35
31
|
|
|
36
32
|
begin
|
|
@@ -39,4 +35,4 @@ begin
|
|
|
39
35
|
rescue Exception => ex
|
|
40
36
|
puts ex.message
|
|
41
37
|
exit!
|
|
42
|
-
end
|
|
38
|
+
end
|
data/lib/livescore-parser.rb
CHANGED
|
@@ -2,7 +2,7 @@ module LivescoreParser
|
|
|
2
2
|
|
|
3
3
|
#----------------------------------------------------------------------------
|
|
4
4
|
|
|
5
|
-
VERSION = "0.1.
|
|
5
|
+
VERSION = "0.1.4"
|
|
6
6
|
SUMMARY = "livescore parser"
|
|
7
7
|
DESCRIPTION = "Downloads livescore results to XML files"
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ module LivescoreParser
|
|
|
18
18
|
def self.run!(options = {})
|
|
19
19
|
@@options = options
|
|
20
20
|
data = Parser.new.run
|
|
21
|
-
Writer.new(data
|
|
21
|
+
Writer.new(data).run
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
private
|
|
@@ -8,9 +8,9 @@ module LivescoreParser
|
|
|
8
8
|
# Runs dynamic-sprites command.
|
|
9
9
|
#
|
|
10
10
|
def run
|
|
11
|
-
LivescoreParser.selected_pages.map do |name,
|
|
12
|
-
data = download(url)
|
|
13
|
-
{ name: name, data: data } unless data.nil?
|
|
11
|
+
LivescoreParser.selected_pages.map do |name, options|
|
|
12
|
+
data = download(options['url'])
|
|
13
|
+
{ name: name, path: options['path'], data: data } unless data.nil?
|
|
14
14
|
end.compact
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -4,14 +4,13 @@ require_relative 'hash_helper'
|
|
|
4
4
|
module LivescoreParser
|
|
5
5
|
class Writer
|
|
6
6
|
|
|
7
|
-
def initialize(scores
|
|
7
|
+
def initialize(scores)
|
|
8
8
|
@scores = scores
|
|
9
|
-
@destination = destination
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def run
|
|
13
12
|
@scores.each do |page|
|
|
14
|
-
File.open(
|
|
13
|
+
File.open(page[:path]), "w+") do |file|
|
|
15
14
|
file.write(build_xml(page[:data]))
|
|
16
15
|
end
|
|
17
16
|
end
|
|
@@ -19,10 +18,6 @@ module LivescoreParser
|
|
|
19
18
|
|
|
20
19
|
private
|
|
21
20
|
|
|
22
|
-
def xml_path(name)
|
|
23
|
-
File.join(@destination, "#{name}_#{Date.today.to_s}.xml")
|
|
24
|
-
end
|
|
25
|
-
|
|
26
21
|
# Builds XML data from schedule Hash
|
|
27
22
|
def build_xml(data)
|
|
28
23
|
xml_builder = Builder::XmlMarkup.new( :indent => 2 )
|
data/pages.yml
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: livescore-parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Walusiak
|
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
85
85
|
version: '0'
|
|
86
86
|
requirements: []
|
|
87
87
|
rubyforge_project:
|
|
88
|
-
rubygems_version: 2.2.
|
|
88
|
+
rubygems_version: 2.2.0
|
|
89
89
|
signing_key:
|
|
90
90
|
specification_version: 4
|
|
91
91
|
summary: TV Channel parser
|