omniplex_uk 1.0.0 → 1.0.2
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/CHANGELOG.md +10 -0
- data/lib/omniplex_uk/internal/client.rb +7 -33
- data/lib/omniplex_uk/internal/listings.rb +2 -3
- data/lib/omniplex_uk/performance.rb +5 -2
- data/lib/omniplex_uk/version.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34a23136866807694df72905a39351543e9201f1b89887a72fe1093876a3d185
|
|
4
|
+
data.tar.gz: 70ffc74bfe06c6e3f5d173ca4ac73c90dcfb8697ca9159131b526e5798055c79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcab2ab429d0a1670bf916b92dc4f9d51acd6908fadc943f3e677dcb1fd74a7ef319e66d7845a29079c1d92e319d86fa88b11917f769014c88cf14df64ea1cbd
|
|
7
|
+
data.tar.gz: 3a773b39a7d55af75701bea2896b13fc51dbe5e361a9824dbfa00bc150183fb8a87408514b2423139be812de04df3369e8e7ec2cff0e89daf3faeeebad0ce738
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [1.0.2] - 2026-11-03
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Placeholder `Live event test` sessions are left out of performances.
|
|
9
|
+
|
|
10
|
+
## [1.0.1] - 2026-11-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Requests and London times use cinebase 5.8's `Cinebase::Http` and `Cinebase::London`.
|
|
14
|
+
|
|
5
15
|
## [1.0.0] - 2026-11-01
|
|
6
16
|
|
|
7
17
|
### Added
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'cgi/escape'
|
|
2
|
-
require 'net/http'
|
|
3
2
|
|
|
4
3
|
module OmniplexUk
|
|
5
4
|
# Internal utility classes: Do not use
|
|
@@ -19,10 +18,10 @@ module OmniplexUk
|
|
|
19
18
|
|
|
20
19
|
# Pages claim ISO-8859-1 but mix UTF-8 with Windows-1252 apostrophes
|
|
21
20
|
LEGACY_ENCODING = Encoding::Windows_1252
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
|
|
22
|
+
def initialize
|
|
23
|
+
@http = Cinebase::Http.new(keep_alive: true)
|
|
24
|
+
end
|
|
26
25
|
|
|
27
26
|
# UK venues in the home page's site picker
|
|
28
27
|
# @return [Array<Hash>] with :url, :name and :code, e.g.
|
|
@@ -58,8 +57,7 @@ module OmniplexUk
|
|
|
58
57
|
end
|
|
59
58
|
|
|
60
59
|
def close
|
|
61
|
-
@http.
|
|
62
|
-
@http = nil
|
|
60
|
+
@http.close
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
private
|
|
@@ -71,35 +69,11 @@ module OmniplexUk
|
|
|
71
69
|
end
|
|
72
70
|
|
|
73
71
|
def get(path)
|
|
74
|
-
|
|
75
|
-
begin
|
|
76
|
-
response = http.request(Net::HTTP::Get.new(path))
|
|
77
|
-
rescue *TRANSIENT_ERRORS
|
|
78
|
-
close
|
|
79
|
-
attempts += 1
|
|
80
|
-
raise if attempts > RETRIES
|
|
81
|
-
|
|
82
|
-
sleep(attempts)
|
|
83
|
-
retry
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
if response.is_a?(Net::HTTPSuccess)
|
|
87
|
-
decode(response.body)
|
|
88
|
-
else
|
|
89
|
-
# Omit response bodies from errors, and never follow redirects.
|
|
90
|
-
raise "HTTP error #{response.code} from #{URI(WEBSITE).host}"
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def http
|
|
95
|
-
@http ||= begin
|
|
96
|
-
uri = URI(WEBSITE)
|
|
97
|
-
Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 10, read_timeout: 30, max_retries: 0)
|
|
98
|
-
end
|
|
72
|
+
decode(@http.get(WEBSITE + path))
|
|
99
73
|
end
|
|
100
74
|
|
|
101
75
|
def decode(body)
|
|
102
|
-
body.
|
|
76
|
+
body.scrub do |bytes|
|
|
103
77
|
bytes.force_encoding(LEGACY_ENCODING).encode(Encoding::UTF_8, invalid: :replace, undef: :replace)
|
|
104
78
|
end
|
|
105
79
|
end
|
|
@@ -36,7 +36,6 @@ module OmniplexUk
|
|
|
36
36
|
# Films whose genres include it are live and recorded events
|
|
37
37
|
EVENT_GENRE = 'Event'.freeze
|
|
38
38
|
MILLISECONDS = 1000
|
|
39
|
-
TIME_ZONE = 'Europe/London'.freeze
|
|
40
39
|
|
|
41
40
|
# @return [Date, nil] the day this page lists
|
|
42
41
|
attr_reader :date
|
|
@@ -84,12 +83,12 @@ module OmniplexUk
|
|
|
84
83
|
end
|
|
85
84
|
|
|
86
85
|
def local_date(seconds)
|
|
87
|
-
|
|
86
|
+
Cinebase::London.date(Time.at(seconds))
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
def starting_at(hour, minute)
|
|
91
90
|
local = Time.utc(date.year, date.month, date.day, hour, minute)
|
|
92
|
-
|
|
91
|
+
Cinebase::London.utc(local)
|
|
93
92
|
end
|
|
94
93
|
|
|
95
94
|
def text(html)
|
|
@@ -58,6 +58,9 @@ module OmniplexUk
|
|
|
58
58
|
COUNTRY_LANGUAGES = { 'Poland' => 'Polish' }.freeze
|
|
59
59
|
COUNTRY = /\((#{COUNTRY_LANGUAGES.keys.join('|')})\)/
|
|
60
60
|
|
|
61
|
+
# Placeholder sessions Omniplex lists while setting up a broadcast
|
|
62
|
+
TEST_EVENT = /\ALive event test\b/i
|
|
63
|
+
|
|
61
64
|
# Performances within an inclusive range of showing dates. The website
|
|
62
65
|
# lists one day per page, so this reads the venue's advertised dates
|
|
63
66
|
# from its first page, then one page for each other date in the range.
|
|
@@ -67,7 +70,7 @@ module OmniplexUk
|
|
|
67
70
|
# @return [Array<OmniplexUk::Performance>]
|
|
68
71
|
def self.at(
|
|
69
72
|
cinema_id,
|
|
70
|
-
from:
|
|
73
|
+
from: Cinebase::London.today,
|
|
71
74
|
to: from + 13
|
|
72
75
|
)
|
|
73
76
|
raise ArgumentError, 'to must not precede from' if to < from
|
|
@@ -76,7 +79,7 @@ module OmniplexUk
|
|
|
76
79
|
if cinema.url.empty?
|
|
77
80
|
[]
|
|
78
81
|
else
|
|
79
|
-
showings = listings(cinema.id, from..to).flat_map(&:showings)
|
|
82
|
+
showings = listings(cinema.id, from..to).flat_map(&:showings).reject { |showing| showing.title.match?(TEST_EVENT) }
|
|
80
83
|
performances = showings.map do |showing|
|
|
81
84
|
new(attributes(showing).merge(cinema_id: cinema.id, cinema_name: cinema.name))
|
|
82
85
|
end
|
data/lib/omniplex_uk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniplex_uk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Croll
|
|
@@ -99,14 +99,14 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - "~>"
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '5.
|
|
102
|
+
version: '5.8'
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - "~>"
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '5.
|
|
109
|
+
version: '5.8'
|
|
110
110
|
description: Pull movie & cinema information from the Omniplex Cinemas website
|
|
111
111
|
email:
|
|
112
112
|
- andy@goodscary.com
|