livescore-parser 0.1.3 → 0.1.4

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: 58ce15c34cc7bddc32a5d7e732c91e7373949b16
4
- data.tar.gz: 690673eb5ca3c4384bac4e536899db73669a871e
3
+ metadata.gz: 28346a91d0d901ddf6a854e83e845aca7c903a1c
4
+ data.tar.gz: 0b91ec6c1d0c9d2d7b846d6511085fa60f155637
5
5
  SHA512:
6
- metadata.gz: 5d555f5c0e8704a505d1bb2f320ca6e616534936a7f8861293c42708390f34e0942dee8645e45af6a78a4a622f8f729ae9ea7419456b55963fe3667430b3d4b3
7
- data.tar.gz: 01d64e014baf28b88ef1d2ba1133c16e9dfa559503d0fa7931e4bd492fbbcce4ba3d31c6e0713a5ecb19ed5db782e3ad08b36e51519c60a2f7f4ab0606b2408a
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
@@ -2,7 +2,7 @@ module LivescoreParser
2
2
 
3
3
  #----------------------------------------------------------------------------
4
4
 
5
- VERSION = "0.1.0"
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, @@options[:destination]).run
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, url|
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, destination)
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(xml_path(page[:name]), "w+") do |file|
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
@@ -1 +1,3 @@
1
- soccer: 'http://www.livescore.com/'
1
+ soccer:
2
+ url: 'http://www.livescore.com/'
3
+ path: 'soccer.xml'
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.3
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.2
88
+ rubygems_version: 2.2.0
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: TV Channel parser