scott_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 +11 -0
- data/lib/scott_uk/internal/feed.rb +5 -3
- data/lib/scott_uk/internal/parser/showtime.rb +1 -0
- data/lib/scott_uk/performance.rb +2 -9
- data/lib/scott_uk/version.rb +2 -2
- data/lib/scott_uk.rb +0 -1
- metadata +3 -4
- data/lib/scott_uk/internal/http.rb +0 -39
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13beea842328164e2cfec3d107c4a075d341318fb23410aa26d63c337a2800fa
|
|
4
|
+
data.tar.gz: 2124df74adc9b98106f84df4ad45db136065719b3425abbd0e7d183dc488339d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 977cceab36657c07980c57082ad05b479f81c56425d0a6b659532ca4652f29d95e9c999f9dc0481fd95ebce4d983fb41a2f27c73079a0ed230c00260bb0ef676
|
|
7
|
+
data.tar.gz: e123e8453e0bda646e14badca060bc0d63716a7b49d3ad8b817b9b68fbaf9dcd3267adba76f7bb78349f80f4a24202442d8eb89c5be18e7f5074b2bc5b600d30
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
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
|
+
- HTTP errors read "HTTP error 500 from www.scottcinemas.co.uk" rather than "Scott Cinemas HTTP error 500".
|
|
15
|
+
|
|
5
16
|
## [1.0.0] - 2026-11-01
|
|
6
17
|
|
|
7
18
|
### Added
|
|
@@ -8,16 +8,18 @@ module ScottUk
|
|
|
8
8
|
# https://www.scottcinemas.co.uk/api. Each venue's feed holds every
|
|
9
9
|
# advertised date.
|
|
10
10
|
class Feed
|
|
11
|
-
include Http
|
|
12
|
-
|
|
13
11
|
URL = 'https://www.scottcinemas.co.uk/json.php'
|
|
14
12
|
|
|
13
|
+
def initialize
|
|
14
|
+
@http = Cinebase::Http.new
|
|
15
|
+
end
|
|
16
|
+
|
|
15
17
|
# @param [String] code a venue's feed code, e.g. 'SCOBAR'
|
|
16
18
|
# @return [Hash] the feed: 'cinema', 'films' by id, and 'schedule' of
|
|
17
19
|
# showtimes by local midnight, then screen, then start, each a Unix
|
|
18
20
|
# timestamp
|
|
19
21
|
def listings(code)
|
|
20
|
-
JSON.parse(get("#{URL}?cinema=#{CGI.escape(code)}"))
|
|
22
|
+
JSON.parse(@http.get("#{URL}?cinema=#{CGI.escape(code)}"))
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
end
|
data/lib/scott_uk/performance.rb
CHANGED
|
@@ -24,8 +24,6 @@ module ScottUk
|
|
|
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
26
|
|
|
27
|
-
TIME_ZONE = 'Europe/London'.freeze
|
|
28
|
-
|
|
29
27
|
# Performances within an inclusive range of showing dates, from one
|
|
30
28
|
# request: the venue's feed holds every advertised date.
|
|
31
29
|
# @param [String] cinema_id the cinema's feed code, e.g. 'SCOBAR'
|
|
@@ -34,7 +32,7 @@ module ScottUk
|
|
|
34
32
|
# @return [Array<ScottUk::Performance>]
|
|
35
33
|
def self.at(
|
|
36
34
|
cinema_id,
|
|
37
|
-
from:
|
|
35
|
+
from: Cinebase::London.today,
|
|
38
36
|
to: from + 13
|
|
39
37
|
)
|
|
40
38
|
raise ArgumentError, 'to must not precede from' if to < from
|
|
@@ -68,7 +66,7 @@ module ScottUk
|
|
|
68
66
|
def self.showtimes_between(feed, from, to)
|
|
69
67
|
films = Hash(feed['films'])
|
|
70
68
|
Hash(feed['schedule']).flat_map do |midnight, screens|
|
|
71
|
-
if (from..to).cover?(
|
|
69
|
+
if (from..to).cover?(Cinebase::London.date(Time.at(midnight.to_i)))
|
|
72
70
|
Hash(screens).values.flat_map do |showtimes|
|
|
73
71
|
Hash(showtimes).filter_map do |timestamp, showtime|
|
|
74
72
|
film = films[showtime['film_id']]
|
|
@@ -81,10 +79,5 @@ module ScottUk
|
|
|
81
79
|
end
|
|
82
80
|
end
|
|
83
81
|
private_class_method :showtimes_between
|
|
84
|
-
|
|
85
|
-
def self.london_date(timestamp)
|
|
86
|
-
TZInfo::Timezone.get(TIME_ZONE).to_local(Time.at(timestamp.to_i).utc).to_date
|
|
87
|
-
end
|
|
88
|
-
private_class_method :london_date
|
|
89
82
|
end
|
|
90
83
|
end
|
data/lib/scott_uk/version.rb
CHANGED
data/lib/scott_uk.rb
CHANGED
|
@@ -5,7 +5,6 @@ require 'cinebase'
|
|
|
5
5
|
|
|
6
6
|
require_relative './scott_uk/version'
|
|
7
7
|
|
|
8
|
-
require_relative './scott_uk/internal/http'
|
|
9
8
|
require_relative './scott_uk/internal/feed'
|
|
10
9
|
require_relative './scott_uk/internal/title_sanitizer'
|
|
11
10
|
require_relative './scott_uk/internal/parser/showtime'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scott_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 Scott Cinemas website
|
|
111
111
|
email:
|
|
112
112
|
- andy@goodscary.com
|
|
@@ -121,7 +121,6 @@ files:
|
|
|
121
121
|
- lib/scott_uk.rb
|
|
122
122
|
- lib/scott_uk/cinema.rb
|
|
123
123
|
- lib/scott_uk/internal/feed.rb
|
|
124
|
-
- lib/scott_uk/internal/http.rb
|
|
125
124
|
- lib/scott_uk/internal/parser/showtime.rb
|
|
126
125
|
- lib/scott_uk/internal/title_sanitizer.rb
|
|
127
126
|
- lib/scott_uk/performance.rb
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'net/http'
|
|
4
|
-
|
|
5
|
-
module ScottUk
|
|
6
|
-
# Internal utility classes: Do not use
|
|
7
|
-
# @api private
|
|
8
|
-
module Internal
|
|
9
|
-
# Requests to scottcinemas.co.uk
|
|
10
|
-
module Http
|
|
11
|
-
RETRIES = 2
|
|
12
|
-
TRANSIENT_ERRORS = [
|
|
13
|
-
EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout, Net::ReadTimeout, OpenSSL::SSL::SSLError
|
|
14
|
-
].freeze
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
def get(url)
|
|
19
|
-
uri = URI(url)
|
|
20
|
-
attempts = 0
|
|
21
|
-
begin
|
|
22
|
-
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 10, read_timeout: 30) do |http|
|
|
23
|
-
http.request(Net::HTTP::Get.new(uri))
|
|
24
|
-
end
|
|
25
|
-
rescue *TRANSIENT_ERRORS
|
|
26
|
-
attempts += 1
|
|
27
|
-
raise if attempts > RETRIES
|
|
28
|
-
|
|
29
|
-
sleep(attempts)
|
|
30
|
-
retry
|
|
31
|
-
end
|
|
32
|
-
# Omit response bodies from errors, and never follow redirects.
|
|
33
|
-
raise "Scott Cinemas HTTP error #{response.code}" unless response.is_a?(Net::HTTPSuccess)
|
|
34
|
-
|
|
35
|
-
String.new(response.body, encoding: Encoding::UTF_8)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|