light_uk 1.0.0 → 1.1.0
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 +12 -0
- data/lib/light_uk/internal/parser/session.rb +2 -2
- data/lib/light_uk/internal/website.rb +8 -6
- data/lib/light_uk/performance.rb +2 -1
- data/lib/light_uk/version.rb +2 -2
- data/lib/light_uk.rb +0 -1
- metadata +3 -4
- data/lib/light_uk/internal/http.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6e0788e71203e9c73136cf9cb979cd8d57f56651c0769e25cff64f3b164cddcd
|
|
4
|
+
data.tar.gz: cc297938bc9c3d803ee324bfc545e862ea714c82042e63b7a780ad9438e5a5d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e50d97b7698fabd86ff26cb549490d7546d38c9e2d5e893d458bc370624c7f6c338064e0d86abad93b18cf08ffc0a088da388ef04ca69ffaea9be69b983e91b8
|
|
7
|
+
data.tar.gz: 4a7b310b326a806d5def037dac4a4b42b7249d3bf14159d06390127394ca0bbf8747d937bbe7af310dc0bbef4f4e3ece118231ccec460774d2c7cf63767e5d5d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
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.1.0] - 2026-11-03
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Uses cinebase 5.9: performances take the raw `title:`, so audience labels become variants, and series prefixes such as `Met Opera:` become the performance's `event`.
|
|
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
|
+
- Requests retry dropped connections twice.
|
|
15
|
+
- HTTP errors read "HTTP error 500 from cambridge.thelight.co.uk" instead of "Light HTTP error 500".
|
|
16
|
+
|
|
5
17
|
## [1.0.0] - 2026-10-31
|
|
6
18
|
|
|
7
19
|
### Added
|
|
@@ -33,7 +33,6 @@ module LightUk
|
|
|
33
33
|
IMAX = /\bIMAX\b/i
|
|
34
34
|
|
|
35
35
|
LANGUAGE = /\((#{Cinebase::TitleSanitizer::LANGUAGES.join('|')})\)/i
|
|
36
|
-
TIME_ZONE = "Europe/London"
|
|
37
36
|
|
|
38
37
|
# @param [Hash] session one session
|
|
39
38
|
# @param [Hash] film the film the session shows
|
|
@@ -56,6 +55,7 @@ module LightUk
|
|
|
56
55
|
film_year: Cinebase::TitleSanitizer.film_year(title),
|
|
57
56
|
language: title[LANGUAGE, 1],
|
|
58
57
|
starting_at: starting_at,
|
|
58
|
+
title: title,
|
|
59
59
|
variant: variant
|
|
60
60
|
}
|
|
61
61
|
end
|
|
@@ -78,7 +78,7 @@ module LightUk
|
|
|
78
78
|
year, month, day = @date.fetch("Key").unpack("a4a2a2").map(&:to_i)
|
|
79
79
|
hour, minute = @session.fetch("Display").scan(/\d+/).map(&:to_i)
|
|
80
80
|
local = Time.utc(year, month, day, hour, minute)
|
|
81
|
-
|
|
81
|
+
Cinebase::London.utc(local)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -8,24 +8,26 @@ module LightUk
|
|
|
8
8
|
module Internal
|
|
9
9
|
# Reads venues and listings from the Light websites, one per venue
|
|
10
10
|
class Website
|
|
11
|
-
include Http
|
|
12
|
-
|
|
13
11
|
# Every venue's home page lists all the venues
|
|
14
12
|
SITES_URL = "https://sheffield.thelight.co.uk/"
|
|
15
13
|
MINIGUIDE_PATH = "/resource/services/miniguide/data.ashx"
|
|
16
14
|
COMING_SOON_PATH = "/cinema/comingsoon"
|
|
17
15
|
|
|
16
|
+
def initialize
|
|
17
|
+
@http = Cinebase::Http.new
|
|
18
|
+
end
|
|
19
|
+
|
|
18
20
|
# @return [Array<Hash>] venues, e.g. { 'id' => 7, 'title' => 'Sheffield',
|
|
19
21
|
# 'url' => 'https://sheffield.thelight.co.uk' }
|
|
20
22
|
def sites
|
|
21
|
-
JSON.parse(get(SITES_URL)[/var __sites = (\[.*?\]);/, 1] || "[]")
|
|
23
|
+
JSON.parse(@http.get(SITES_URL)[/var __sites = (\[.*?\]);/, 1] || "[]")
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
# @param [String] url a venue's home page
|
|
25
27
|
# @return [String, nil] the address in the page footer, e.g.
|
|
26
28
|
# 'The Moor, Sheffield, S1 4PF'
|
|
27
29
|
def address(url)
|
|
28
|
-
address = get(url)[%r{<p class="address">(.*?)</p>}m, 1]
|
|
30
|
+
address = @http.get(url)[%r{<p class="address">(.*?)</p>}m, 1]
|
|
29
31
|
CGI.unescapeHTML(address).strip if address
|
|
30
32
|
end
|
|
31
33
|
|
|
@@ -33,7 +35,7 @@ module LightUk
|
|
|
33
35
|
# @param [String] url a venue's home page
|
|
34
36
|
# @return [Array<Hash>] films with their sessions on each date
|
|
35
37
|
def miniguide(url)
|
|
36
|
-
script = get(URI.join(url, MINIGUIDE_PATH).to_s)
|
|
38
|
+
script = @http.get(URI.join(url, MINIGUIDE_PATH).to_s)
|
|
37
39
|
JSON.parse(script[/var __gfminiguidedata = (\{.*\});/m, 1] || "{}").fetch("Schedule", [])
|
|
38
40
|
end
|
|
39
41
|
|
|
@@ -41,7 +43,7 @@ module LightUk
|
|
|
41
43
|
# @param [String] url a venue's home page
|
|
42
44
|
# @return [Array<Hash>] films in the shape of #miniguide
|
|
43
45
|
def coming_soon(url)
|
|
44
|
-
Parser::ComingSoon.new(get(URI.join(url, COMING_SOON_PATH).to_s)).films
|
|
46
|
+
Parser::ComingSoon.new(@http.get(URI.join(url, COMING_SOON_PATH).to_s)).films
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
end
|
data/lib/light_uk/performance.rb
CHANGED
|
@@ -23,6 +23,7 @@ module LightUk
|
|
|
23
23
|
# @option options [Integer] :film_year (nil) year from the film's title
|
|
24
24
|
# @option options [String] :language (nil) audio language, e.g. 'Hindi'
|
|
25
25
|
# @option options [Time] :starting_at listed start time of the performance
|
|
26
|
+
# @option options [String] :title (nil) raw title, for audience variants
|
|
26
27
|
|
|
27
28
|
# Performances within an inclusive range of showing dates, from two
|
|
28
29
|
# requests for all of the cinema's advertised dates: the next fortnight's
|
|
@@ -33,7 +34,7 @@ module LightUk
|
|
|
33
34
|
# @return [Array<LightUk::Performance>]
|
|
34
35
|
def self.at(
|
|
35
36
|
cinema_id,
|
|
36
|
-
from:
|
|
37
|
+
from: Cinebase::London.today,
|
|
37
38
|
to: from + 13
|
|
38
39
|
)
|
|
39
40
|
raise ArgumentError, 'to must not precede from' if to < from
|
data/lib/light_uk/version.rb
CHANGED
data/lib/light_uk.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: light_uk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
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.9'
|
|
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.9'
|
|
110
110
|
description: Pull movie & cinema information from the Light cinemas website
|
|
111
111
|
email:
|
|
112
112
|
- andy@goodscary.com
|
|
@@ -120,7 +120,6 @@ files:
|
|
|
120
120
|
- README.md
|
|
121
121
|
- lib/light_uk.rb
|
|
122
122
|
- lib/light_uk/cinema.rb
|
|
123
|
-
- lib/light_uk/internal/http.rb
|
|
124
123
|
- lib/light_uk/internal/parser/coming_soon.rb
|
|
125
124
|
- lib/light_uk/internal/parser/session.rb
|
|
126
125
|
- lib/light_uk/internal/title_sanitizer.rb
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "net/http"
|
|
4
|
-
|
|
5
|
-
module LightUk
|
|
6
|
-
# Internal utility classes: Do not use
|
|
7
|
-
# @api private
|
|
8
|
-
module Internal
|
|
9
|
-
# Requests to thelight.co.uk
|
|
10
|
-
module Http
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def get(url)
|
|
14
|
-
uri = URI(url)
|
|
15
|
-
request = Net::HTTP::Get.new(uri)
|
|
16
|
-
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true,
|
|
17
|
-
open_timeout: 10, read_timeout: 30) do |http|
|
|
18
|
-
http.request(request)
|
|
19
|
-
end
|
|
20
|
-
# Omit response bodies from errors, and never follow redirects.
|
|
21
|
-
raise "Light HTTP error #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
22
|
-
|
|
23
|
-
String.new(response.body, encoding: Encoding::UTF_8)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|