picturehouse_uk 3.0.8 → 3.0.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437ad0e8ebc0d270642be6c4d4da06c33833be3f
|
4
|
+
data.tar.gz: 429a905ad6768ab2428c666dfe3d30c9c6148518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 073b9f66f5e761884c50faceb2a5b2b8aa9d13d451d112a1c9827c2f4c49d09cf53887dcc4716e9a85328e3907b60ff4d2a3245cdd5b1ebbf4286b80b93154c7
|
7
|
+
data.tar.gz: 0349ae4fd13d79da081476a63d02bb1c111d5702039fa862a3f054cf11d294ea9e577a8c9fa5994b0738cef3b6ddc74bcbbe32222016e2c8868ee53b79e2c241
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## [3.0.9] - 2015-04-12
|
5
|
+
|
6
|
+
### Fixed
|
7
|
+
- Date parsing was busted, it's not anymore
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
- Better use of Struct
|
11
|
+
|
4
12
|
## [3.0.8] - 2015-04-07
|
5
13
|
|
6
14
|
### Fixed
|
@@ -4,16 +4,16 @@ module PicturehouseUk
|
|
4
4
|
# @api private
|
5
5
|
module Parser
|
6
6
|
# Parses screenings page into an array of hashes for an individual cinema
|
7
|
-
|
7
|
+
Screenings = Struct.new(:cinema_id) do
|
8
8
|
# css for a day of films & screenings
|
9
|
-
LISTINGS = '#this-week .listings > li, #further-ahead .listings > li'
|
9
|
+
LISTINGS = '#today .listings > li, #this-week .listings > li, #further-ahead .listings > li'
|
10
10
|
|
11
11
|
# parse the cinema page into an array of screenings attributes
|
12
12
|
# @return [Array<Hash>]
|
13
13
|
def to_a
|
14
|
-
date =
|
14
|
+
date = Date.today
|
15
15
|
doc.css(LISTINGS).each_with_object([]) do |node, result|
|
16
|
-
if
|
16
|
+
if date?(node.text)
|
17
17
|
date = date_parse(node.text)
|
18
18
|
else
|
19
19
|
result << FilmWithShowtimes.new(node, date).to_a
|
@@ -33,13 +33,17 @@ module PicturehouseUk
|
|
33
33
|
@doc ||= Nokogiri::HTML(page)
|
34
34
|
end
|
35
35
|
|
36
|
+
def date?(text)
|
37
|
+
!!text.match(/(Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day \d{1,2}(st|nd|th) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/)
|
38
|
+
end
|
39
|
+
|
36
40
|
def page
|
37
41
|
@page ||= PicturehouseUk::Internal::Website.new.cinema(cinema_id)
|
38
42
|
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
|
42
|
-
|
46
|
+
FilmWithShowtimes = Struct.new(:node, :date) do
|
43
47
|
# film name css
|
44
48
|
NAME = '.top-mg-sm a'
|
45
49
|
# variants css
|
@@ -76,7 +80,7 @@ module PicturehouseUk
|
|
76
80
|
end
|
77
81
|
|
78
82
|
# variants can have multiple screenings
|
79
|
-
|
83
|
+
Variant = Struct.new(:node, :date) do
|
80
84
|
SHOWTIMES = '.btn'
|
81
85
|
VARIANT = '.film-type-desc'
|
82
86
|
|
@@ -94,7 +98,7 @@ module PicturehouseUk
|
|
94
98
|
end
|
95
99
|
|
96
100
|
# parse an individual screening node
|
97
|
-
|
101
|
+
Showtime = Struct.new(:node, :date) do
|
98
102
|
# the attributes of a single screening
|
99
103
|
# @return [Hash]
|
100
104
|
# @example
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picturehouse_uk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Croll
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|