tivohmo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +17 -0
  4. data/.travis.yml +10 -0
  5. data/Gemfile +7 -0
  6. data/LICENSE.txt +514 -0
  7. data/README.md +50 -0
  8. data/Rakefile +7 -0
  9. data/bin/tivohmo +8 -0
  10. data/contrib/tivohmo.conf +17 -0
  11. data/contrib/tivohmo.plist +22 -0
  12. data/lib/tivohmo/adapters/filesystem/application.rb +23 -0
  13. data/lib/tivohmo/adapters/filesystem/file_item.rb +29 -0
  14. data/lib/tivohmo/adapters/filesystem/folder_container.rb +105 -0
  15. data/lib/tivohmo/adapters/filesystem.rb +3 -0
  16. data/lib/tivohmo/adapters/plex/application.rb +41 -0
  17. data/lib/tivohmo/adapters/plex/category.rb +72 -0
  18. data/lib/tivohmo/adapters/plex/episode.rb +26 -0
  19. data/lib/tivohmo/adapters/plex/metadata.rb +24 -0
  20. data/lib/tivohmo/adapters/plex/movie.rb +26 -0
  21. data/lib/tivohmo/adapters/plex/qualified_category.rb +51 -0
  22. data/lib/tivohmo/adapters/plex/season.rb +39 -0
  23. data/lib/tivohmo/adapters/plex/section.rb +48 -0
  24. data/lib/tivohmo/adapters/plex/show.rb +39 -0
  25. data/lib/tivohmo/adapters/plex/transcoder.rb +19 -0
  26. data/lib/tivohmo/adapters/plex.rb +11 -0
  27. data/lib/tivohmo/adapters/streamio/metadata.rb +26 -0
  28. data/lib/tivohmo/adapters/streamio/transcoder.rb +239 -0
  29. data/lib/tivohmo/adapters/streamio.rb +17 -0
  30. data/lib/tivohmo/api/application.rb +35 -0
  31. data/lib/tivohmo/api/container.rb +31 -0
  32. data/lib/tivohmo/api/item.rb +32 -0
  33. data/lib/tivohmo/api/metadata.rb +98 -0
  34. data/lib/tivohmo/api/node.rb +115 -0
  35. data/lib/tivohmo/api/server.rb +24 -0
  36. data/lib/tivohmo/api/transcoder.rb +39 -0
  37. data/lib/tivohmo/api.rb +7 -0
  38. data/lib/tivohmo/beacon.rb +69 -0
  39. data/lib/tivohmo/cli.rb +182 -0
  40. data/lib/tivohmo/logging.rb +50 -0
  41. data/lib/tivohmo/server/views/_container.builder +19 -0
  42. data/lib/tivohmo/server/views/_item.builder +57 -0
  43. data/lib/tivohmo/server/views/container.builder +26 -0
  44. data/lib/tivohmo/server/views/item_details.builder +153 -0
  45. data/lib/tivohmo/server/views/layout.builder +2 -0
  46. data/lib/tivohmo/server/views/layout.erb +10 -0
  47. data/lib/tivohmo/server/views/server.builder +18 -0
  48. data/lib/tivohmo/server/views/server_info.builder +7 -0
  49. data/lib/tivohmo/server/views/unsupported.erb +7 -0
  50. data/lib/tivohmo/server/views/video_formats.builder +10 -0
  51. data/lib/tivohmo/server.rb +306 -0
  52. data/lib/tivohmo/version.rb +3 -0
  53. data/lib/tivohmo.rb +5 -0
  54. data/spec/adapters/filesystem/application_spec.rb +19 -0
  55. data/spec/adapters/filesystem/file_item_spec.rb +33 -0
  56. data/spec/adapters/filesystem/folder_container_spec.rb +115 -0
  57. data/spec/adapters/plex/application_spec.rb +20 -0
  58. data/spec/adapters/plex/category_spec.rb +66 -0
  59. data/spec/adapters/plex/episode_spec.rb +22 -0
  60. data/spec/adapters/plex/metadata_spec.rb +24 -0
  61. data/spec/adapters/plex/movie_spec.rb +22 -0
  62. data/spec/adapters/plex/qualified_category_spec.rb +51 -0
  63. data/spec/adapters/plex/season_spec.rb +22 -0
  64. data/spec/adapters/plex/section_spec.rb +38 -0
  65. data/spec/adapters/plex/show_spec.rb +22 -0
  66. data/spec/adapters/plex/transcoder_spec.rb +27 -0
  67. data/spec/adapters/streamio/metadata_spec.rb +34 -0
  68. data/spec/adapters/streamio/transcoder_spec.rb +42 -0
  69. data/spec/api/application_spec.rb +63 -0
  70. data/spec/api/container_spec.rb +34 -0
  71. data/spec/api/item_spec.rb +53 -0
  72. data/spec/api/metadata_spec.rb +59 -0
  73. data/spec/api/node_spec.rb +178 -0
  74. data/spec/api/server_spec.rb +24 -0
  75. data/spec/api/transcoder_spec.rb +25 -0
  76. data/spec/beacon_spec.rb +87 -0
  77. data/spec/cli_spec.rb +227 -0
  78. data/spec/server_spec.rb +458 -0
  79. data/spec/spec_helper.rb +123 -0
  80. data/tivohmo.gemspec +46 -0
  81. metadata +416 -0
@@ -0,0 +1,22 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/plex'
3
+
4
+ describe TivoHMO::Adapters::Plex::Season do
5
+
6
+ let(:plex_delegate) { plex_stub(::Plex::Season) }
7
+
8
+ describe "#initialize" do
9
+
10
+ it "should instantiate" do
11
+ season = described_class.new(plex_delegate)
12
+ expect(season).to be_a described_class
13
+ expect(season).to be_a TivoHMO::API::Container
14
+ expect(season.title).to eq(plex_delegate.title)
15
+ expect(season.identifier).to eq(plex_delegate.key)
16
+ # expect(app.modified_at).to eq(Time.at(plex_delegate.updated_at))
17
+ # expect(app.created_at).to eq(Time.at(plex_delegate.added_at))
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,38 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/plex'
3
+
4
+ describe TivoHMO::Adapters::Plex::Section do
5
+
6
+ let(:plex_delegate) { plex_stub(::Plex::Section) }
7
+
8
+ describe "#initialize" do
9
+
10
+ it "should instantiate" do
11
+ section = described_class.new(plex_delegate)
12
+ expect(section).to be_a described_class
13
+ expect(section).to be_a TivoHMO::API::Container
14
+ expect(section.title).to eq(plex_delegate.title)
15
+ expect(section.identifier).to eq(plex_delegate.key)
16
+ expect(section.modified_at).to eq(Time.at(plex_delegate.updated_at))
17
+ expect(section.created_at).to eq(Time.at(plex_delegate.added_at))
18
+ end
19
+
20
+ end
21
+
22
+ describe "#children" do
23
+
24
+ it "should memoize" do
25
+ section = described_class.new(plex_delegate)
26
+ expect(section.children.object_id).to eq(section.children.object_id)
27
+ end
28
+
29
+ it "should have category children" do
30
+ section = described_class.new(plex_delegate)
31
+ expect(section.children.size).to eq(11)
32
+ classes = [TivoHMO::Adapters::Plex::Category, TivoHMO::Adapters::Plex::QualifiedCategory]
33
+ expect(section.children.collect(&:class).uniq).to eq(classes)
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,22 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/plex'
3
+
4
+ describe TivoHMO::Adapters::Plex::Show do
5
+
6
+ let(:plex_delegate) { plex_stub(::Plex::Show) }
7
+
8
+ describe "#initialize" do
9
+
10
+ it "should instantiate" do
11
+ show = described_class.new(plex_delegate)
12
+ expect(show).to be_a described_class
13
+ expect(show).to be_a TivoHMO::API::Container
14
+ expect(show.title).to eq(plex_delegate.title)
15
+ expect(show.identifier).to eq(plex_delegate.key)
16
+ expect(show.modified_at).to eq(Time.at(plex_delegate.updated_at))
17
+ expect(show.created_at).to eq(Time.at(plex_delegate.added_at))
18
+ end
19
+
20
+ end
21
+
22
+ end
@@ -0,0 +1,27 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/plex'
3
+
4
+ describe TivoHMO::Adapters::Plex::Transcoder do
5
+
6
+
7
+ let(:plex_delegate) { plex_stub(::Plex::Movie,
8
+ summary: 'Summary',
9
+ duration: 10000,
10
+ medias: [double('media',
11
+ parts: [double('part',
12
+ file: '/foo')])])}
13
+
14
+ let(:item) { double('item', identifier: plex_delegate.key, delegate: plex_delegate)}
15
+
16
+ describe "#initialize" do
17
+
18
+ it "should instantiate" do
19
+ trans = described_class.new(item)
20
+ expect(trans).to be_a described_class
21
+ expect(trans).to be_a TivoHMO::API::Transcoder
22
+ expect(trans.source_filename).to eq '/foo'
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,34 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/streamio'
3
+
4
+ describe TivoHMO::Adapters::StreamIO::Metadata do
5
+
6
+ let(:item) { TestAPI::Item.new(video_fixture(:tiny)) }
7
+
8
+ describe "#initialize" do
9
+
10
+ it "should instantiate" do
11
+ md = described_class.new(item)
12
+ expect(md).to be_a described_class
13
+ expect(md.item).to eq(item)
14
+ expect(md.movie).to be_instance_of FFMPEG::Movie
15
+ expect(md.duration).to be(7)
16
+ end
17
+
18
+ it "should not fail" do
19
+ orig_appenders = Logging.logger.root.appenders
20
+ Logging.logger.root.appenders = nil
21
+ begin
22
+ expect(FFMPEG::Movie).to receive(:new).and_raise("bad")
23
+ md = described_class.new(item)
24
+ expect(md).to be_a described_class
25
+ expect(md.movie).to be_nil
26
+ expect(md.duration).to eq(0)
27
+ ensure
28
+ Logging.logger.root.appenders = orig_appenders
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,42 @@
1
+ require_relative "../../spec_helper"
2
+ require 'tivohmo/adapters/streamio'
3
+
4
+ describe TivoHMO::Adapters::StreamIO::Transcoder do
5
+
6
+ let(:item) { TestAPI::Item.new(video_fixture(:tiny)) }
7
+
8
+ describe "#initialize" do
9
+
10
+ it "should instantiate" do
11
+ trans = described_class.new(item)
12
+ expect(trans).to be_a described_class
13
+ expect(trans.item).to eq(item)
14
+ end
15
+
16
+ end
17
+
18
+ describe "#transcoder_options" do
19
+
20
+ let(:subject) { described_class.new(item) }
21
+
22
+ it "returns a hash" do
23
+ opts = subject.transcoder_options
24
+ expect(opts).to be_instance_of(Hash)
25
+ end
26
+
27
+ end
28
+
29
+ describe "#transcode" do
30
+
31
+ let(:subject) { described_class.new(item) }
32
+ let(:destination) { Tempfile.new('streamio_transcode') }
33
+
34
+ it "performs a valid transcode" do
35
+ thread = subject.transcode(destination)
36
+ movie = FFMPEG::Movie.new(destination.path)
37
+ expect(movie.valid?).to be(true)
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,63 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Application do
4
+
5
+ def test_class
6
+ TestAPI::Application
7
+ end
8
+
9
+ describe "#initialize" do
10
+
11
+ it "should initialize" do
12
+ node = test_class.new('a')
13
+ expect(node).to be_a(TivoHMO::API::Container)
14
+ expect(node).to be_a(TivoHMO::API::Node)
15
+ expect(node.identifier).to eq('a')
16
+ expect(node.app).to eq(node)
17
+ expect(node.content_type).to eq("x-container/tivo-videos")
18
+ expect(node.source_format).to eq("x-container/folder")
19
+ end
20
+
21
+ end
22
+
23
+ describe "#metadata_for" do
24
+
25
+ before(:each) do
26
+ @app = test_class.new('a')
27
+ @item = double(TivoHMO::API::Item)
28
+ end
29
+
30
+ it "should return nil when no metadata_class" do
31
+ expect(@app.metadata_for(@item)).to eq(nil)
32
+ end
33
+
34
+ it "should return an instance of the metadata class when present" do
35
+ o = double()
36
+ c = double(TivoHMO::API::Metadata, :new => o)
37
+ @app.metadata_class = c
38
+ expect(@app.metadata_for(@item)).to eq(o)
39
+ end
40
+
41
+ end
42
+
43
+ describe "#transcoder_for" do
44
+
45
+ before(:each) do
46
+ @app = test_class.new('a')
47
+ @item = double(TivoHMO::API::Item)
48
+ end
49
+
50
+ it "should return nil when no transcoder_class" do
51
+ expect(@app.transcoder_for(@item)).to eq(nil)
52
+ end
53
+
54
+ it "should return an instance of the transcoder class when present" do
55
+ o = double()
56
+ c = double(TivoHMO::API::Transcoder, :new => o)
57
+ @app.transcoder_class = c
58
+ expect(@app.transcoder_for(@item)).to eq(o)
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,34 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Container do
4
+
5
+ def test_class
6
+ TestAPI::Container
7
+ end
8
+
9
+ describe "#initialize" do
10
+
11
+ it "should initialize" do
12
+ node = test_class.new('c')
13
+ expect(node).to be_a(TivoHMO::API::Node)
14
+ expect(node.identifier).to eq('c')
15
+ expect(node.uuid).to_not be_nil
16
+ expect(node.content_type).to eq("x-tivo-container/tivo-videos")
17
+ expect(node.source_format).to eq("x-tivo-container/folder")
18
+ end
19
+
20
+ end
21
+
22
+ describe "#refresh" do
23
+
24
+ it "should clear children" do
25
+ node = test_class.new('c')
26
+ node2 = node.add_child(test_class.new('c2'))
27
+ expect(node.children).to eq([node2])
28
+ node.refresh
29
+ expect(node.children).to eq([])
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,53 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Item do
4
+
5
+ def test_class
6
+ TestAPI::Item
7
+ end
8
+
9
+ describe "#initialize" do
10
+
11
+ it "should initialize" do
12
+ node = test_class.new('i')
13
+ expect(node).to be_a(TivoHMO::API::Item)
14
+ expect(node).to be_a(TivoHMO::API::Node)
15
+ expect(node.identifier).to eq('i')
16
+ expect(node.title).to eq('i')
17
+ expect(node.content_type).to eq("video/x-tivo-mpeg")
18
+ expect(node.source_format).to eq("video/x-tivo-mpeg")
19
+ end
20
+
21
+ end
22
+
23
+ describe "#metadata" do
24
+
25
+ before(:each) do
26
+ @app = double(TivoHMO::API::Application)
27
+ @node = test_class.new('i')
28
+ @node.app = @app
29
+ end
30
+
31
+ it "asks app for metadata" do
32
+ expect(@app).to receive(:metadata_for).with(@node)
33
+ @node.metadata
34
+ end
35
+
36
+ end
37
+
38
+ describe "#transcoder" do
39
+
40
+ before(:each) do
41
+ @app = double(TivoHMO::API::Application)
42
+ @node = test_class.new('i')
43
+ @node.app = @app
44
+ end
45
+
46
+ it "asks app for transcoder" do
47
+ expect(@app).to receive(:transcoder_for).with(@node)
48
+ @node.transcoder
49
+ end
50
+
51
+ end
52
+
53
+ end
@@ -0,0 +1,59 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Metadata do
4
+
5
+ class TestMetadata
6
+ include TivoHMO::API::Metadata
7
+ end
8
+
9
+ def test_class
10
+ TestMetadata
11
+ end
12
+
13
+ describe "#initialize" do
14
+
15
+ it "should initialize" do
16
+ item = double(TivoHMO::API::Item)
17
+ md = test_class.new(item)
18
+ expect(md).to be_a(TivoHMO::API::Metadata)
19
+ expect(md.item).to eq(item)
20
+ end
21
+
22
+ end
23
+
24
+ describe "#estimate_source_size" do
25
+
26
+ it "uses transcoder to estimate size" do
27
+ transcoder = double(TivoHMO::API::Transcoder,
28
+ transcoder_options: {video_bitrate: 1, audio_bitrate: 2})
29
+ item = double(TivoHMO::API::Item, transcoder: transcoder)
30
+
31
+ md = test_class.new(item)
32
+ md.duration = 3
33
+ expect(md.estimate_source_size).to eq(1147)
34
+ end
35
+
36
+ it "uses defaults if no bitrates in options to estimate size" do
37
+ transcoder = double(TivoHMO::API::Transcoder,
38
+ transcoder_options: {})
39
+ item = double(TivoHMO::API::Item, transcoder: transcoder)
40
+
41
+ md = test_class.new(item)
42
+ md.duration = 3
43
+ expect(md.estimate_source_size).to eq(11646360)
44
+ end
45
+
46
+ end
47
+
48
+ describe "#source_size" do
49
+
50
+ it "uses estimate_source_size" do
51
+ item = double(TivoHMO::API::Item)
52
+ md = test_class.new(item)
53
+ expect(md).to receive(:estimate_source_size).and_return(5)
54
+ expect(md.source_size).to eq(5)
55
+ end
56
+
57
+ end
58
+
59
+ end
@@ -0,0 +1,178 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Node do
4
+
5
+ class TestNode
6
+ include TivoHMO::API::Node
7
+ end
8
+
9
+ def test_class
10
+ TestNode
11
+ end
12
+
13
+ describe "#initialize" do
14
+
15
+ it "should initialize" do
16
+ node = test_class.new('n')
17
+ expect(node).to be_a(TivoHMO::API::Node)
18
+ expect(node.identifier).to eq('n')
19
+ expect(node.title).to eq('n')
20
+ expect(node.children).to eq([])
21
+ end
22
+
23
+ it "force title to string" do
24
+ node = test_class.new(:n)
25
+ expect(node).to be_a(TivoHMO::API::Node)
26
+ expect(node.identifier).to eq(:n)
27
+ expect(node.title).to eq('n')
28
+ end
29
+
30
+ end
31
+
32
+ describe "root?" do
33
+
34
+ it "should be false if not root" do
35
+ node = test_class.new('r')
36
+ expect(node.root?).to be(false)
37
+ end
38
+
39
+ it "should be true if root" do
40
+ node = test_class.new('r')
41
+ node.root = node
42
+ expect(node.root?).to be(true)
43
+ end
44
+
45
+ end
46
+
47
+ describe "app?" do
48
+
49
+ it "should be false if not app" do
50
+ node = test_class.new('a')
51
+ expect(node.app?).to be(false)
52
+ end
53
+
54
+ it "should be true if root" do
55
+ node = test_class.new('a')
56
+ node.app = node
57
+ expect(node.app?).to be(true)
58
+ end
59
+
60
+ end
61
+
62
+ describe "#add_child" do
63
+
64
+ before(:each) do
65
+ @root = test_class.new('r')
66
+ @root.root = @root
67
+ end
68
+
69
+ it "should setup parent/child relationship" do
70
+ child = test_class.new('c')
71
+ @root.add_child(child)
72
+ expect(@root.children).to eq([child])
73
+ expect(child.parent).to eq(@root)
74
+ end
75
+
76
+ it "should preserve root for children" do
77
+ app1 = test_class.new('a1')
78
+ app1.app = app1
79
+ app2 = test_class.new('a2')
80
+ app2.app = app2
81
+
82
+ @root.add_child(app1)
83
+ @root.add_child(app2)
84
+
85
+ child1 = test_class.new('c1')
86
+ app1.add_child(child1)
87
+
88
+ child2 = test_class.new('c2')
89
+ app2.add_child(child2)
90
+
91
+ expect(@root.root).to eq(@root)
92
+ expect(app1.root).to eq(@root)
93
+ expect(app2.root).to eq(@root)
94
+ expect(child1.root).to eq(@root)
95
+ expect(child2.root).to eq(@root)
96
+ end
97
+
98
+ it "should preserve app for children" do
99
+ app1 = test_class.new('a1')
100
+ app1.app = app1
101
+ app2 = test_class.new('a2')
102
+ app2.app = app2
103
+
104
+ @root.add_child(app1)
105
+ @root.add_child(app2)
106
+
107
+ child1 = test_class.new('c1')
108
+ app1.add_child(child1)
109
+
110
+ child2 = test_class.new('c2')
111
+ app2.add_child(child2)
112
+
113
+ expect(app1.app).to eq(app1)
114
+ expect(child1.app).to eq(app1)
115
+
116
+ expect(app2.app).to eq(app2)
117
+ expect(child2.app).to eq(app2)
118
+ end
119
+
120
+ end
121
+
122
+ describe "#title_path" do
123
+
124
+ before(:each) do
125
+ @root = test_class.new('r')
126
+ @root.root = @root
127
+ @child1 = @root.add_child(test_class.new('c1'))
128
+ @child11 = @child1.add_child(test_class.new('c11'))
129
+ @child111 = @child11.add_child(test_class.new('c111'))
130
+ @child2 = @root.add_child(test_class.new('c2'))
131
+ end
132
+
133
+ it "should be '/' for root" do
134
+ expect(@root.title_path).to eq('/')
135
+ end
136
+
137
+ it "should reflect the heirarchy" do
138
+ expect(@child111.title_path).to eq('/c1/c11/c111')
139
+ expect(@child2.title_path).to eq('/c2')
140
+ end
141
+
142
+ end
143
+
144
+ describe "#find" do
145
+
146
+ before(:each) do
147
+ @root = test_class.new('r')
148
+ @root.root = @root
149
+ @child1 = @root.add_child(test_class.new('c1'))
150
+ @child11 = @child1.add_child(test_class.new('c11'))
151
+ @child111 = @child11.add_child(test_class.new('c111'))
152
+ @child2 = @root.add_child(test_class.new('c2'))
153
+ end
154
+
155
+ it "should find '/' for root" do
156
+ expect(@root.find('/')).to eq(@root)
157
+ expect(@child111.find('/')).to eq(@root)
158
+ end
159
+
160
+ it "should find relative path" do
161
+ expect(@child1.find('c11')).to eq(@child11)
162
+ end
163
+
164
+ it "should find deep full path" do
165
+ expect(@root.find('/c1/c11/c111')).to eq(@child111)
166
+ expect(@child11.find('/c1/c11/c111')).to eq(@child111)
167
+ end
168
+
169
+ it "should find deep relative path" do
170
+ expect(@root.find('c1/c11/c111')).to eq(@child111)
171
+ expect(@child1.find('c11/c111')).to eq(@child111)
172
+ expect(@root.find('c11/c111')).to eq(nil)
173
+ expect(@child1.find('c1/c11/c111')).to eq(nil)
174
+ end
175
+
176
+ end
177
+
178
+ end
@@ -0,0 +1,24 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Server do
4
+
5
+ def test_class
6
+ TivoHMO::API::Server
7
+ end
8
+
9
+ describe "#initialize" do
10
+
11
+ it "should initialize" do
12
+ node = test_class.new
13
+ expect(node).to be_a(TivoHMO::API::Container)
14
+ expect(node).to be_a(TivoHMO::API::Node)
15
+ expect(node.identifier).to eq('TivoHMO Server')
16
+ expect(node.title).to eq(Socket.gethostname.split(".").first)
17
+ expect(node.root).to eq(node)
18
+ expect(node.content_type).to eq("x-container/tivo-server")
19
+ expect(node.source_format).to eq("x-container/folder")
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,25 @@
1
+ require_relative "../spec_helper"
2
+
3
+ describe TivoHMO::API::Transcoder do
4
+
5
+ class TestTranscoder
6
+ include TivoHMO::API::Transcoder
7
+ end
8
+
9
+ def test_class
10
+ TestTranscoder
11
+ end
12
+
13
+ describe "#initialize" do
14
+
15
+ it "should initialize" do
16
+ item = double(TivoHMO::API::Item, identifier: 'foo')
17
+ trans = test_class.new(item)
18
+ expect(trans).to be_a(TivoHMO::API::Transcoder)
19
+ expect(trans.item).to eq(item)
20
+ expect(trans.source_filename).to eq('foo')
21
+ end
22
+
23
+ end
24
+
25
+ end