rio_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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e3e5119b7aa4f3c0822c76f974c76e2be2ebdfb9a9c08fcc3fac80549551eaf
4
- data.tar.gz: b06872046de7982781e513ff8813e87b832490aafc18d5da46f0ef1b69ce7575
3
+ metadata.gz: ee16c0c022f2fa1ecf21cdd679ec226c97f34c068cc84a09c86fed03690a5022
4
+ data.tar.gz: ad086a55a3b0ae48ce3c8101525a857fbd7443a55589a142c3e0c82703d79777
5
5
  SHA512:
6
- metadata.gz: e952d79239ed7ccffd543dd7a0cbb4e540ec8c0fa66c0ccb889af162b2269720fc481ac39efbae8dd9e5ea770b81e12679fbca672b7ca76f8a369fd273a44c89
7
- data.tar.gz: 1f2909dcd30cdf621ceeadcf1d1b4e1d184668cccba4c75b5dbfc6cbfb3ca85cc53e8228ed0f6b5541b3555aa57341c0e87f6fbba112de55b631a2079c9b7adb
6
+ metadata.gz: d2b27c8de08c32cc0f4d58c31dd18bd4dc15d7f8998237beb748cd47585de809ebdc64444be4cdf28f275bfd928835976df531cc9cdc73ee7180d8d09fa9ddbd
7
+ data.tar.gz: 78cab9f6b1276dca143d39922459f791b215048c5d91ca8f3d0207afd0cfdfa953bc0d964cf3c6590bc4235c3788992c84cab51ac103cab1d26465494907125e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
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
+ ### Fixed
11
+ - `THE DEVILS (4K Restoration)` reads "The Devils", not "The Devils (4K".
12
+
13
+ ## [1.0.1] - 2026-11-02
14
+
15
+ ### Changed
16
+ - Requests and London times use cinebase 5.8's `Cinebase::Http` and `Cinebase::London`.
17
+ - HTTP errors read "HTTP error 500 from riocinema.org.uk" instead of "Rio Cinema HTTP error 500".
18
+
19
+ ### Removed
20
+ - `RioUk::Performance::TIME_ZONE`, now unused.
21
+
5
22
  ## [1.0.0] - 2026-11-02
6
23
 
7
24
  The first release, as 1.0.0.
@@ -33,7 +33,6 @@ module RioUk
33
33
  YES = 'Y'
34
34
  THREE_D = /\b3D\b/i
35
35
  YEAR = /\A\d{4}\z/
36
- TIME_ZONE = 'Europe/London'
37
36
 
38
37
  # @param [Hash] event one of the website's Savoy events
39
38
  def initialize(event)
@@ -67,6 +66,7 @@ module RioUk
67
66
  film_name: film_name,
68
67
  film_year: film_year,
69
68
  starting_at: starting_at,
69
+ title: title,
70
70
  variant: variant(performance)
71
71
  }
72
72
  end
@@ -101,7 +101,7 @@ module RioUk
101
101
  def starting_at(performance, date)
102
102
  hour, minute = performance.fetch('StartTime').unpack('a2a2').map(&:to_i)
103
103
  local = Time.utc(date.year, date.month, date.day, hour, minute)
104
- TZInfo::Timezone.get(TIME_ZONE).local_to_utc(local) { |periods| periods.first }.utc
104
+ Cinebase::London.utc(local)
105
105
  end
106
106
 
107
107
  def strands
@@ -36,9 +36,9 @@ module RioUk
36
36
  @sanitized ||= begin
37
37
  listed = without_director(title.squeeze(' ').strip)
38
38
  event_cinema = listed[EVENT_CINEMA].to_s
39
- film = without_strand(listed.delete_prefix(event_cinema))
39
+ film = without_labels(without_strand(listed.delete_prefix(event_cinema)))
40
40
  film = titlecase(leading_capitals(film)) if capitals?(film)
41
- film = remove.reduce(event_cinema + film) { |text, pattern| text.gsub(pattern, '') }
41
+ film = without_labels(event_cinema + film)
42
42
  replace.reduce(film) { |text, (pattern, prefix)| text.gsub(pattern) { prefix + $1 } }.squeeze(' ').strip
43
43
  end
44
44
  end
@@ -59,6 +59,12 @@ module RioUk
59
59
  }.merge(COMMON_REPLACE)
60
60
  end
61
61
 
62
+ # Before the case check too, as a mixed case label such as
63
+ # '(4K Restoration)' would otherwise be cut in half with the extras
64
+ def without_labels(text)
65
+ remove.reduce(text) { |stripped, pattern| stripped.gsub(pattern, '') }
66
+ end
67
+
62
68
  def capitals?(text)
63
69
  word = text[FIRST_WORD]
64
70
  !word.nil? && !word.match?(/\p{Ll}/)
@@ -7,17 +7,19 @@ module RioUk
7
7
  # Reads the Rio Cinema's website, run on Savoy Systems' ticketing. No
8
8
  # token is needed.
9
9
  class Website
10
- include Http
11
-
12
10
  WHATS_ON = 'https://riocinema.org.uk/Rio.dll/WhatsOn'
13
11
  # Savoy pages carry the whole programme as one line of JSON
14
12
  EVENTS = /^var Events =\s*(\{.*\})\s*$/
15
13
 
14
+ def initialize
15
+ @http = Cinebase::Http.new
16
+ end
17
+
16
18
  # Every event on sale with every advertised performance, however far
17
19
  # ahead, including sold out ones
18
20
  # @return [Array<Hash>] Savoy events, each with its 'Performances'
19
21
  def events
20
- JSON.parse(get(WHATS_ON)[EVENTS, 1] || '{}').fetch('Events', [])
22
+ JSON.parse(@http.get(WHATS_ON)[EVENTS, 1] || '{}').fetch('Events', [])
21
23
  end
22
24
 
23
25
  # @param [String] path a Savoy link relative to the what's on page,
@@ -23,8 +23,6 @@ module RioUk
23
23
  # @option options [Integer] :film_year (nil) year of the film
24
24
  # @option options [Time] :starting_at listed start time of the performance
25
25
 
26
- TIME_ZONE = 'Europe/London'.freeze
27
-
28
26
  # Performances within an inclusive range of showing dates, from one
29
27
  # request: the what's on page holds every advertised date.
30
28
  # @param [String] cinema_id the cinema's id, 'rio'
@@ -33,7 +31,7 @@ module RioUk
33
31
  # @return [Array<RioUk::Performance>]
34
32
  def self.at(
35
33
  cinema_id,
36
- from: TZInfo::Timezone.get(TIME_ZONE).now.to_date,
34
+ from: Cinebase::London.today,
37
35
  to: from + 13
38
36
  )
39
37
  raise ArgumentError, 'to must not precede from' if to < from
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for https://riocinema.org.uk
2
- # @version 1.0.0
2
+ # @version 1.1.0
3
3
  module RioUk
4
4
  # Gem version
5
- VERSION = '1.0.0'.freeze
5
+ VERSION = '1.1.0'.freeze
6
6
  end
data/lib/rio_uk.rb CHANGED
@@ -5,7 +5,6 @@ require 'cinebase'
5
5
 
6
6
  require_relative './rio_uk/version'
7
7
 
8
- require_relative './rio_uk/internal/http'
9
8
  require_relative './rio_uk/internal/website'
10
9
  require_relative './rio_uk/internal/title_sanitizer'
11
10
  require_relative './rio_uk/internal/parser/event'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rio_uk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
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.7'
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.7'
109
+ version: '5.9'
110
110
  description: Pull movie & cinema information from the Rio Cinema website
111
111
  email:
112
112
  - andy@goodscary.com
@@ -120,7 +120,6 @@ files:
120
120
  - README.md
121
121
  - lib/rio_uk.rb
122
122
  - lib/rio_uk/cinema.rb
123
- - lib/rio_uk/internal/http.rb
124
123
  - lib/rio_uk/internal/parser/event.rb
125
124
  - lib/rio_uk/internal/title_sanitizer.rb
126
125
  - lib/rio_uk/internal/website.rb
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'net/http'
4
-
5
- module RioUk
6
- # Internal utility classes: Do not use
7
- # @api private
8
- module Internal
9
- # Requests to riocinema.org.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 "Rio Cinema 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