picturehouse_uk 2.0.0 → 2.0.1

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: 852cffd41d42e302152ccedd703e8f265b48015f
4
- data.tar.gz: a2cfd6c6dbb93d841cc2d7c22423d9228363d342
3
+ metadata.gz: 515cc194c2ddb6340b07b0a20c25f491aba6e7ac
4
+ data.tar.gz: c06643abffca387ca159f78a029532eddd304ec5
5
5
  SHA512:
6
- metadata.gz: a5da4c31df5e98af0f65e4261eca2de02da13e6f5f80ab5a75171c7b393537e801bab7740cffdfee6ce39caa6994165c3ddc4c91e28ba3f26367590c31863de3
7
- data.tar.gz: 36e769a6373c03914f241ca65babc5e878552902627d53b6123bdc99918a605009ba0dcc41815933139c918925d7d84be828496f2dfb0853c051e9efcde3f429
6
+ metadata.gz: 73ed0a6bfd6be3231955f23dd16a0ba8bfece01d3774abb47043c5b278552a398fda1717fb04fb8be810a1f5f19ee98f6b806eaf86f7d09952e8fa2912329728
7
+ data.tar.gz: 5d69b824baf177025b9d685d3fdbfe1f26c009703c87c78a39ed2e2c6957f5efad41a85bae3b733319591312f90d36452978586238850d19d7cfbcde91f84a82
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## v.2.0.1 -2014-10-19
5
+
6
+ ### Added
7
+ - Better parsing of ampersands in film titles
8
+ - Better parsing of autism screening film titles
9
+ - Better parsing of bad spacing in film titles
10
+ - Better parsing of Q&A events
11
+ - Better parsing of rogue screening types
12
+ - Better parsing of free screening types
13
+
4
14
  ## 2.0.0 - 2014-10-16
5
15
 
6
16
  ### Added
@@ -5,24 +5,29 @@ module PicturehouseUk
5
5
  class TitleSanitizer
6
6
  # strings and regex to be removed
7
7
  REMOVE = [
8
- /\s\[(AS LIVE: )?[ACPGU1258]+\]/, # regular certificate
9
- /\s+[23][dD]/, # 2d or 3d from title
10
- /\s\[NO CERT\]/, # no certificate
11
- /\s\[\]/, # blank certificate
12
- /ourscreen\: /, # ourscreen
13
- /\s\(Re(\: \d{0,4})?\)/i, # Re-release
14
- /\s\[CERT TBC\]/, # certificate TBC
8
+ /\s\[(AS LIVE:\s*)?[ACPGU1258]+\]/, # regular certificate
9
+ /\s+[23][dD]/, # 2d or 3d from title
10
+ /\s\[NO CERT\]/, # no certificate
11
+ /\s\[\]/, # blank certificate
12
+ /ourscreen\: /, # ourscreen
13
+ /\s\(Re(\: \d{0,4})?\)/i, # Re-release
14
+ /\s\[CERT TBC\]/, # certificate TBC
15
+ /\s?\-\s?autism.*ing\s?/i, # austim screening
16
+ /\s?\+\s?Q\&A\.?/i, # +Q&A
17
+ /KIDS CLUB\s*/i, # kids club
18
+ /DISCOVER TUE\s*/i, # discover tue
19
+ /FREE Screening\s*-\s*/i # free screening
15
20
  ]
16
21
 
17
22
  # regexes and their replacements
18
23
  REPLACE = {
19
- /Met\.? Encore: (.*)/ => 'Met Opera:',
20
- /Met\.? Opera: (.*)/ => 'Met Opera: ',
21
- /NT Encore: (.*)/ => 'National Theatre:',
22
- /NT Live: (.*)/ => 'National Theatre:',
23
- /ROH\.? Live: (.*)/ => 'Royal Opera House:',
24
- /RSC\.? Live: (.*)/ => 'Royal Shakespeare Company:',
25
- /RSC\.? Encore: (.*)/ => 'Royal Shakespeare Company:'
24
+ /Met\.? Encore:\s*(.*)/ => 'Met Opera:',
25
+ /Met\.? Opera:\s*(.*)/ => 'Met Opera: ',
26
+ /NT Encore:\s*(.*)/ => 'National Theatre:',
27
+ /NT Live:\s*(.*)/ => 'National Theatre:',
28
+ /ROH\.? Live:\s*(.*)/ => 'Royal Opera House:',
29
+ /RSC\.? Live:\s*(.*)/ => 'Royal Shakespeare Company:',
30
+ /RSC\.? Encore:\s*(.*)/ => 'Royal Shakespeare Company:'
26
31
  }
27
32
 
28
33
  # @param [String] title a film title
@@ -34,7 +39,7 @@ module PicturehouseUk
34
39
  # @return [String] title
35
40
  def sanitized
36
41
  @sanitzed ||= begin
37
- sanitized = @title
42
+ sanitized = @title.gsub('&', '&')
38
43
  REMOVE.each do |pattern|
39
44
  sanitized.gsub! pattern, ''
40
45
  end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.picturehouses.co.uk
2
- # @version 2.0.0
2
+ # @version 2.0.1
3
3
  module PicturehouseUk
4
4
  # Gem version
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
@@ -6,6 +6,14 @@ describe PicturehouseUk::Internal::TitleSanitizer do
6
6
  describe '#sanitized' do
7
7
  subject { described_class.new(title).sanitized }
8
8
 
9
+ describe 'with HTML & in title' do
10
+ let(:title) { 'Withnail & I' }
11
+
12
+ it 'removes dimension' do
13
+ subject.must_equal('Withnail & I')
14
+ end
15
+ end
16
+
9
17
  describe 'with 2d in title' do
10
18
  let(:title) { 'Iron Man 3 2D' }
11
19
 
@@ -22,6 +30,14 @@ describe PicturehouseUk::Internal::TitleSanitizer do
22
30
  end
23
31
  end
24
32
 
33
+ describe 'autism friendly' do
34
+ let(:title) { 'Tarzan - Autism-Friendly Screening' }
35
+
36
+ it 'removes screening type' do
37
+ subject.must_equal('Tarzan')
38
+ end
39
+ end
40
+
25
41
  describe 'with NO CERT in title' do
26
42
  let(:title) { 'Iron Man 3 [NO CERT]' }
27
43
 
@@ -46,6 +62,30 @@ describe PicturehouseUk::Internal::TitleSanitizer do
46
62
  end
47
63
  end
48
64
 
65
+ describe 'with KIDS CLUB in title' do
66
+ let(:title) { 'KIDS CLUB Escape from Planet Earth' }
67
+
68
+ it 'removes KIDS CLUB' do
69
+ subject.must_equal('Escape from Planet Earth')
70
+ end
71
+ end
72
+
73
+ describe 'with DISCOVER TUE in title' do
74
+ let(:title) { 'DISCOVER TUE All this Mayhem' }
75
+
76
+ it 'remove rogue screening type' do
77
+ subject.must_equal('All this Mayhem')
78
+ end
79
+ end
80
+
81
+ describe 'with free screening' do
82
+ let(:title) { 'FREE Screening - Withnail & I' }
83
+
84
+ it 'remove rogue screening type' do
85
+ subject.must_equal('Withnail & I')
86
+ end
87
+ end
88
+
49
89
  describe 'with (Re) in title' do
50
90
  let(:title) { 'Beauty and the Beast 2D (Re) [U]' }
51
91
 
@@ -54,6 +94,14 @@ describe PicturehouseUk::Internal::TitleSanitizer do
54
94
  end
55
95
  end
56
96
 
97
+ describe 'with Q&A' do
98
+ let(:title) { 'Hidden Colors 3: The Rules of Racism + Q&A' }
99
+
100
+ it 'removes suffix' do
101
+ subject.must_equal('Hidden Colors 3: The Rules of Racism')
102
+ end
103
+ end
104
+
57
105
  describe 'Bolshoi screening' do
58
106
  let(:title) { 'Bolshoi: Spartacus [NO CERT]' }
59
107
 
@@ -88,6 +136,14 @@ describe PicturehouseUk::Internal::TitleSanitizer do
88
136
  end
89
137
  end
90
138
 
139
+ describe 'Met Opera screening v3' do
140
+ let(:title) { 'Met Opera:Le Nozze di Figaro [AS LIVE:12A]' }
141
+
142
+ it 'removes prefix' do
143
+ subject.must_equal('Met Opera: Le Nozze di Figaro')
144
+ end
145
+ end
146
+
91
147
  describe 'NT Live screening' do
92
148
  let(:title) { 'National Theatre: Hamlet [PG]' }
93
149
 
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: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Croll
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler