tivohmo 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG +23 -0
- data/lib/tivohmo/adapters/plex/episode.rb +27 -9
- data/lib/tivohmo/beacon.rb +1 -1
- data/lib/tivohmo/server/views/unsupported.builder +7 -0
- data/lib/tivohmo/server.rb +21 -7
- data/lib/tivohmo/tvdb_helper.rb +19 -0
- data/lib/tivohmo/version.rb +1 -1
- data/spec/server_spec.rb +23 -0
- data/spec/spec_helper.rb +24 -1
- data/tivohmo.gemspec +4 -0
- metadata +46 -5
- data/lib/tivohmo/server/views/layout.erb +0 -10
- data/lib/tivohmo/server/views/unsupported.erb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82b98cf908b70108f96047411d32f7e1b7fe4b86
|
4
|
+
data.tar.gz: d78429acd344c4df742e8e849600a71ad5ccbb91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1d414df9691878b936744d0ce977806df8b820078876e763b3b116d13167b8fabd71b46c1618c30426ae898152f0105d5b17785b1ff2b8a3642dcbffd925c48
|
7
|
+
data.tar.gz: 31eb7b4f97bc01856f0148f9483ebf1746129dfc9f9f552ecf837a8f02d9923222f0a9f1f823e4e339706c9c1f10eb3095aff035fcd49bcf6323c0e9feb08af9
|
data/.travis.yml
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
0.2.3 (11/29/2014)
|
2
|
+
------------------
|
3
|
+
|
4
|
+
add webmock/vcr <98c0a61> [Matt Conway]
|
5
|
+
fix transliteration fir ubuntu (replace iconv with unidecoder) <4aa988e> [Matt Conway]
|
6
|
+
lookup zap2it series id to enable thumbnails in My Shows UI <b737600> [Matt Conway]
|
7
|
+
transliterate for SD UI, xml cleanup <1a80126> [Matt Conway]
|
8
|
+
try to fix travis <3efda2a> [Matt Conway]
|
9
|
+
try to fix travis <a2c5d08> [Matt Conway]
|
10
|
+
warn for expected exceptions <c5e0736> [Matt Conway]
|
11
|
+
|
12
|
+
0.2.2 (11/25/2014)
|
13
|
+
------------------
|
14
|
+
|
15
|
+
decrease default beacon interval to 10s <4fd10c6> [Matt Conway]
|
16
|
+
disable recurse for now <c8f0100> [Matt Conway]
|
17
|
+
fix sort <33bce77> [Matt Conway]
|
18
|
+
handle recurse (no groups) <d2a0019> [Matt Conway]
|
19
|
+
improve ordering/sorting <06adca5> [Matt Conway]
|
20
|
+
try to prevent beacon thread from erroring out when network temporarily unavailable (e.g. laptop suspend/wake) <73e2ea4> [Matt Conway]
|
21
|
+
use movie/episode airdates for sorting if possible <397c50d> [Matt Conway]
|
22
|
+
zap2it comment <d5d176d> [Matt Conway]
|
23
|
+
|
1
24
|
0.2.1 (11/23/2014)
|
2
25
|
------------------
|
3
26
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tivohmo/tvdb_helper'
|
2
|
+
|
1
3
|
module TivoHMO
|
2
4
|
module Adapters
|
3
5
|
module Plex
|
@@ -39,15 +41,7 @@ module TivoHMO
|
|
39
41
|
md.episode_title = "%i - %s" % [md.episode_number, title]
|
40
42
|
md.title = "%s - %s" % [delegate.grandparent_title, title]
|
41
43
|
|
42
|
-
|
43
|
-
guid = delegate.guid
|
44
|
-
if guid =~ /thetvdb:\/\/(\d+)/
|
45
|
-
# TODO: figure out how to get zap2it series IDs into plex
|
46
|
-
# If we had zap2it ids in plex metadata and extracted them
|
47
|
-
# here, tivo would show a relevant thumbnail image for the
|
48
|
-
# series in the My Shows UI.
|
49
|
-
md.series_id = "SH#{$1}"
|
50
|
-
end
|
44
|
+
md.series_id = lookup_series_id
|
51
45
|
|
52
46
|
rescue => e
|
53
47
|
logger.log_exception e, "Failed to read plex metadata for #{self}"
|
@@ -56,6 +50,30 @@ module TivoHMO
|
|
56
50
|
md
|
57
51
|
end
|
58
52
|
|
53
|
+
# groups tv shows under same name if we can extract a seriesId
|
54
|
+
def lookup_series_id
|
55
|
+
series_id = nil
|
56
|
+
|
57
|
+
guid = delegate.guid
|
58
|
+
if guid =~ /thetvdb:\/\/(\d+)/
|
59
|
+
# zap2it ids allow tivo to show a relevant thumbnail image for the
|
60
|
+
# series in the My Shows UI.
|
61
|
+
tvdb_series_id = $1
|
62
|
+
begin
|
63
|
+
tvdb_series = TVDBHelper.instance.find_by_id(tvdb_series_id)
|
64
|
+
series_id = tvdb_series.zap2it_id
|
65
|
+
series_id = series_id.sub(/^EP/, 'SH')
|
66
|
+
logger.debug "Using zap2it series id: #{series_id}"
|
67
|
+
rescue => e
|
68
|
+
logger.log_exception e, "Failed to get zap2it series id", level: :warn
|
69
|
+
end
|
70
|
+
|
71
|
+
series_id ||= "SH#{tvdb_series_id}"
|
72
|
+
end
|
73
|
+
|
74
|
+
series_id
|
75
|
+
end
|
76
|
+
|
59
77
|
end
|
60
78
|
|
61
79
|
end
|
data/lib/tivohmo/beacon.rb
CHANGED
data/lib/tivohmo/server.rb
CHANGED
@@ -3,6 +3,7 @@ require 'sinatra/base'
|
|
3
3
|
require 'active_support/core_ext/string'
|
4
4
|
require 'zlib'
|
5
5
|
require 'time'
|
6
|
+
require 'unidecoder'
|
6
7
|
|
7
8
|
module TivoHMO
|
8
9
|
|
@@ -22,6 +23,16 @@ module TivoHMO
|
|
22
23
|
logger.debug "Headers: #{headers.inspect}"
|
23
24
|
end
|
24
25
|
|
26
|
+
after do
|
27
|
+
if ! response.body.is_a?(Sinatra::Helpers::Stream)
|
28
|
+
# Try and reduce invalid chars in browse UI (SD UI) by
|
29
|
+
# transliterating from full utf-8 to ascii equivalents
|
30
|
+
# The full utf-8 is still provided in tivo_header for
|
31
|
+
# display by the HD UI in My Shows
|
32
|
+
response.body = response.body.collect{|b| transliterate(b) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
25
36
|
after do
|
26
37
|
logger.info "Response to #{request.ip} for \"#{request.request_method} #{request.url}\" [#{response.status}]"
|
27
38
|
logger.debug "Headers: #{response.header}"
|
@@ -54,7 +65,7 @@ module TivoHMO
|
|
54
65
|
|
55
66
|
def unsupported
|
56
67
|
status 404
|
57
|
-
|
68
|
+
builder :unsupported, layout: true
|
58
69
|
end
|
59
70
|
|
60
71
|
def tsn
|
@@ -179,6 +190,10 @@ module TivoHMO
|
|
179
190
|
data
|
180
191
|
end
|
181
192
|
|
193
|
+
def transliterate(s)
|
194
|
+
# unidecoder gem
|
195
|
+
s.to_ascii rescue s
|
196
|
+
end
|
182
197
|
end
|
183
198
|
|
184
199
|
helpers do
|
@@ -187,6 +202,8 @@ module TivoHMO
|
|
187
202
|
|
188
203
|
# Get the xml doc describing the active HME applications
|
189
204
|
get '/TiVoConnect' do
|
205
|
+
response["Content-Type"] = 'application/xml'
|
206
|
+
|
190
207
|
command = params['Command']
|
191
208
|
|
192
209
|
# pagination
|
@@ -293,16 +310,13 @@ module TivoHMO
|
|
293
310
|
builder :server_info, layout: true
|
294
311
|
|
295
312
|
when 'QueryItem' then
|
296
|
-
|
297
|
-
body ""
|
313
|
+
builder(layout: true) {|xml| xml.QueryItem }
|
298
314
|
|
299
315
|
when 'FlushServer' then
|
300
|
-
|
301
|
-
body ""
|
316
|
+
builder(layout: true) {|xml| xml.FlushServer }
|
302
317
|
|
303
318
|
when 'ResetServer' then
|
304
|
-
|
305
|
-
body ""
|
319
|
+
builder(layout: true) {|xml| xml.ResetServer }
|
306
320
|
|
307
321
|
else
|
308
322
|
unsupported
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'tvdbr'
|
2
|
+
|
3
|
+
module TivoHMO
|
4
|
+
|
5
|
+
class TVDBHelper
|
6
|
+
include GemLogger::LoggerSupport
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@client = Tvdbr::Client.new('4A7C459A8771A96D')
|
11
|
+
@cache = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def find_by_id(series_id)
|
15
|
+
@cache[series_id] ||= @client.find_series_by_id(series_id) rescue nil
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/tivohmo/version.rb
CHANGED
data/spec/server_spec.rb
CHANGED
@@ -123,11 +123,24 @@ describe TivoHMO::Server do
|
|
123
123
|
expect(helpers).to receive(:builder).
|
124
124
|
with(:item_details, layout: true, locals: {item: item}).
|
125
125
|
and_return("<TvBusMarshalledStruct/>")
|
126
|
+
|
127
|
+
# should not translit for header as HD UI handles more utf8 chars
|
128
|
+
expect(helpers).to_not receive(:transliterate)
|
129
|
+
|
126
130
|
expect(helpers.tivo_header(item, 'video/x-tivo-mpeg')).to include('TvBusMarshalledStruct')
|
127
131
|
end
|
128
132
|
|
129
133
|
end
|
130
134
|
|
135
|
+
describe "#transliterate" do
|
136
|
+
|
137
|
+
it "generates ascii safe string" do
|
138
|
+
expect(helpers.transliterate("\u2019")).to eq("'")
|
139
|
+
expect(helpers.transliterate("\u2026")).to eq("...")
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
|
131
144
|
end
|
132
145
|
|
133
146
|
describe "TivoConnect" do
|
@@ -209,6 +222,16 @@ describe TivoHMO::Server do
|
|
209
222
|
expect(title).to eq(server.title)
|
210
223
|
end
|
211
224
|
|
225
|
+
it "should transliterate" do
|
226
|
+
server.title = "\u2026"
|
227
|
+
get "/TiVoConnect?Command=QueryContainer"
|
228
|
+
expect(last_response.status).to eq(200)
|
229
|
+
doc = Nokogiri::XML(last_response.body)
|
230
|
+
title = doc.at_xpath("/TiVoContainer/Details/Title").content
|
231
|
+
expect(title).to_not eq(server.title)
|
232
|
+
expect(title).to eq('...')
|
233
|
+
end
|
234
|
+
|
212
235
|
it "uses server as root" do
|
213
236
|
get "/TiVoConnect?Command=QueryContainer&Container=/"
|
214
237
|
expect(last_response.status).to eq(200)
|
data/spec/spec_helper.rb
CHANGED
@@ -14,6 +14,29 @@ Logging.logger.root.level = :error
|
|
14
14
|
require 'tivohmo'
|
15
15
|
require 'open-uri'
|
16
16
|
|
17
|
+
require 'webmock/rspec'
|
18
|
+
WebMock.disable_net_connect!(allow: 'samples.mplayerhq.hu')
|
19
|
+
|
20
|
+
# require 'vcr'
|
21
|
+
# VCR.configure do |c|
|
22
|
+
# c.cassette_library_dir = File.expand_path('../fixtures/vcr', __FILE__)
|
23
|
+
# c.hook_into :webmock
|
24
|
+
# c.default_cassette_options = { :record => :none, :allow_playback_repeats => true }
|
25
|
+
# # Uncomment this line to see more information about VCR when running tests
|
26
|
+
# #c.debug_logger = $stderr
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# def setup_vcr
|
30
|
+
# fixture_name = self.to_s.gsub(/[:#]+/, '-').gsub(/\s+/, '_').gsub(/^[_-]*/, '')
|
31
|
+
# fixture_location = __FILE__.gsub(/.*\/test\//, '').gsub(/\.[^\/]*/, '')
|
32
|
+
# @cassette_name = "#{fixture_location}/#{fixture_name}"
|
33
|
+
# VCR.insert_cassette(@cassette_name, :record => :once)
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# def teardown_vcr
|
37
|
+
# VCR.eject_cassette(@cassette_name)
|
38
|
+
# end
|
39
|
+
|
17
40
|
def video_fixture(name)
|
18
41
|
fixture_names = {
|
19
42
|
tiny: 'MPEG4 by philips.mp4',
|
@@ -30,7 +53,7 @@ def video_fixture(name)
|
|
30
53
|
video_file = "#{cache_dir}/#{file_name}"
|
31
54
|
|
32
55
|
if ! File.exist?(video_file)
|
33
|
-
|
56
|
+
Logging.logger.root.info "Downloading video fixture #{name} from #{video_url}"
|
34
57
|
FileUtils.mkdir_p(cache_dir)
|
35
58
|
File.write(video_file, open(video_url).read)
|
36
59
|
end
|
data/tivohmo.gemspec
CHANGED
@@ -27,9 +27,12 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "rack-test"
|
28
28
|
spec.add_development_dependency "nokogiri"
|
29
29
|
spec.add_development_dependency "timecop"
|
30
|
+
spec.add_development_dependency "webmock"
|
31
|
+
# spec.add_development_dependency "vcr"
|
30
32
|
|
31
33
|
# core dependencies
|
32
34
|
spec.add_dependency "activesupport"
|
35
|
+
spec.add_dependency "unidecoder"
|
33
36
|
spec.add_dependency "gem_logger"
|
34
37
|
spec.add_dependency "logging"
|
35
38
|
spec.add_dependency "sigdump"
|
@@ -37,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
37
40
|
spec.add_dependency "sinatra"
|
38
41
|
spec.add_dependency "builder"
|
39
42
|
spec.add_dependency "puma"
|
43
|
+
spec.add_dependency "tvdbr"
|
40
44
|
|
41
45
|
# filesystem adapter dependencies, make optional?
|
42
46
|
spec.add_dependency "listen"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tivohmo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Conway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: webmock
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: activesupport
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +164,20 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: unidecoder
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: gem_logger
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +276,20 @@ dependencies:
|
|
248
276
|
- - ">="
|
249
277
|
- !ruby/object:Gem::Version
|
250
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: tvdbr
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :runtime
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
251
293
|
- !ruby/object:Gem::Dependency
|
252
294
|
name: listen
|
253
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -345,11 +387,11 @@ files:
|
|
345
387
|
- lib/tivohmo/server/views/container.builder
|
346
388
|
- lib/tivohmo/server/views/item_details.builder
|
347
389
|
- lib/tivohmo/server/views/layout.builder
|
348
|
-
- lib/tivohmo/server/views/layout.erb
|
349
390
|
- lib/tivohmo/server/views/server.builder
|
350
391
|
- lib/tivohmo/server/views/server_info.builder
|
351
|
-
- lib/tivohmo/server/views/unsupported.
|
392
|
+
- lib/tivohmo/server/views/unsupported.builder
|
352
393
|
- lib/tivohmo/server/views/video_formats.builder
|
394
|
+
- lib/tivohmo/tvdb_helper.rb
|
353
395
|
- lib/tivohmo/version.rb
|
354
396
|
- spec/adapters/filesystem/application_spec.rb
|
355
397
|
- spec/adapters/filesystem/file_item_spec.rb
|
@@ -429,4 +471,3 @@ test_files:
|
|
429
471
|
- spec/cli_spec.rb
|
430
472
|
- spec/server_spec.rb
|
431
473
|
- spec/spec_helper.rb
|
432
|
-
has_rdoc:
|