dblugeon-rb-eyetv 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/eyetv.rb +14 -4
- data/lib/program.rb +7 -3
- data/rb-eyetv.gemspec +2 -2
- data/test/eyetv_test.rb +33 -5
- data/test/program_test.rb +15 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/eyetv.rb
CHANGED
@@ -66,9 +66,9 @@ module EyeTV
|
|
66
66
|
@instance.is_recording.get
|
67
67
|
end
|
68
68
|
|
69
|
-
#return channel
|
69
|
+
#return the current channel
|
70
70
|
def current_channel_number
|
71
|
-
@
|
71
|
+
@instance.current_channel.get
|
72
72
|
end
|
73
73
|
|
74
74
|
#return an channel, program or recording with the id
|
@@ -96,10 +96,20 @@ module EyeTV
|
|
96
96
|
|
97
97
|
def make_program(options = {})
|
98
98
|
program = check_program(options)
|
99
|
+
#TODO : add more control
|
99
100
|
if program != nil
|
100
101
|
puts "program = #{program.to_s}"
|
101
102
|
raise ConflictProgramException.new(program)
|
102
103
|
end
|
104
|
+
if options.has_key?(:input_source)
|
105
|
+
options[:input_source] = options[:input_source].to_sym
|
106
|
+
end
|
107
|
+
if options.has_key?(:quality)
|
108
|
+
options[:quality] = options[:quality].to_sym
|
109
|
+
end
|
110
|
+
if options.has_key?(:repeats)
|
111
|
+
options[:repeats] = options[:repeats].to_sym
|
112
|
+
end
|
103
113
|
record = Program.new(@instance.make(:new =>:program, :with_properties => options))
|
104
114
|
end
|
105
115
|
|
@@ -116,7 +126,7 @@ module EyeTV
|
|
116
126
|
end
|
117
127
|
res = nil
|
118
128
|
programs(true).each do |prog|
|
119
|
-
if(res == nil and prog.conflict?(options[:start_time], options[:duration]))
|
129
|
+
if(res == nil and prog.conflict?(options[:start_time], options[:duration], options[:uid]))
|
120
130
|
res = prog
|
121
131
|
end
|
122
132
|
end
|
@@ -130,7 +140,7 @@ module EyeTV
|
|
130
140
|
attr_reader :program_exist
|
131
141
|
|
132
142
|
def initialize(program)
|
133
|
-
program_exist = program
|
143
|
+
@program_exist = program
|
134
144
|
end
|
135
145
|
end
|
136
146
|
|
data/lib/program.rb
CHANGED
@@ -38,12 +38,16 @@ module EyeTV
|
|
38
38
|
end
|
39
39
|
|
40
40
|
#test if the parameters enter in conflict with a program instance
|
41
|
-
def conflict?(test_start_time, nduration)
|
42
|
-
nend_time = test_start_time + nduration
|
41
|
+
def conflict?(test_start_time, nduration, uid = nil)
|
42
|
+
nend_time = test_start_time + nduration.to_f
|
43
43
|
if nend_time < start_time or end_time < test_start_time
|
44
44
|
conflict = false
|
45
45
|
else
|
46
|
-
|
46
|
+
if (self.uid == uid)
|
47
|
+
conflict = false
|
48
|
+
else
|
49
|
+
conflict = true
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
data/rb-eyetv.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rb-eyetv}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["dblugeon"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-12}
|
13
13
|
s.description = %q{
|
14
14
|
This library provides ruby classes to control the EyeTV Application.
|
15
15
|
You can launch the EyeTV apllication, explore recordings, channels or
|
data/test/eyetv_test.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
include EyeTV
|
3
|
-
|
3
|
+
include Appscript
|
4
4
|
class RbEyetvTest < Test::Unit::TestCase
|
5
5
|
context "EyeTV application" do
|
6
6
|
setup do
|
7
7
|
@instance = EyeTV::EyeTV.new
|
8
|
+
@instance_ref = app('EyeTV')
|
8
9
|
if @instance.programs(true).empty?
|
9
10
|
@program_test = @instance.make_program({:start_time => Time.now + 3600, :duration => 3600, :title => "program unit test"})
|
10
11
|
@clean_program = true
|
@@ -12,8 +13,9 @@ class RbEyetvTest < Test::Unit::TestCase
|
|
12
13
|
@program_test = @instance.programs(true)[0]
|
13
14
|
end
|
14
15
|
end
|
15
|
-
|
16
|
-
|
16
|
+
|
17
|
+
should "test is_recording? method" do
|
18
|
+
assert_equal @instance_ref.is_recording.get, @instance.is_recording?
|
17
19
|
end
|
18
20
|
|
19
21
|
should "find an channel or nil" do
|
@@ -45,17 +47,43 @@ class RbEyetvTest < Test::Unit::TestCase
|
|
45
47
|
end
|
46
48
|
|
47
49
|
should "check check_program method without conflict program" do
|
48
|
-
tmp_progs = @instance.programs(true).sort do |
|
49
|
-
|
50
|
+
tmp_progs = @instance.programs(true).sort do |progA, progB|
|
51
|
+
progA.start_time <=> progB.start_time
|
50
52
|
end
|
51
53
|
prog = tmp_progs.last
|
52
54
|
assert_nil @instance.check_program({:start_time => prog.end_time + 200, :duration => prog.duration})
|
53
55
|
end
|
54
56
|
|
57
|
+
should "test make_program method with conflict program" do
|
58
|
+
assert_raise ConflictProgramException do
|
59
|
+
@r2 = @instance.make_program({:start_time=>@program_test.start_time, :duration=>@program_test.duration})
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
should "test make_program 2 method with conflict program" do
|
64
|
+
begin
|
65
|
+
@r3 = @instance.make_program({:start_time=>@program_test.start_time, :duration=>@program_test.duration})
|
66
|
+
rescue ConflictProgramException =>e
|
67
|
+
assert_not_nil e.program_exist
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
should "test current_channel_number" do
|
72
|
+
assert_equal @instance_ref.current_channel.get, @instance.current_channel_number
|
73
|
+
end
|
74
|
+
|
55
75
|
teardown do
|
56
76
|
if @clean_program
|
57
77
|
@program_test.delete
|
58
78
|
end
|
79
|
+
|
80
|
+
if @r2
|
81
|
+
@r2.delete
|
82
|
+
end
|
83
|
+
|
84
|
+
if @r3
|
85
|
+
r3.delete
|
86
|
+
end
|
59
87
|
end
|
60
88
|
end
|
61
89
|
end
|
data/test/program_test.rb
CHANGED
@@ -49,10 +49,18 @@ class RbProgramTest < Test::Unit::TestCase
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
should "test change channel_number= method with first channel" do
|
53
|
+
@program_test.channel_number = @instance.channels.first.channel_number
|
54
|
+
assert_equal @instance.channels.first.channel_number, @program_test.channel_number
|
55
|
+
|
56
|
+
@program_test.channel_number = @instance.channels.last.channel_number.to_s
|
57
|
+
assert_equal @instance.channels.last.channel_number, @program_test.channel_number
|
58
|
+
end
|
59
|
+
|
52
60
|
should "end_time must be equals to start_time + duration" do
|
53
61
|
assert_equal (@program_test.start_time + @program_test.duration), @program_test.end_time
|
54
62
|
end
|
55
|
-
|
63
|
+
|
56
64
|
should "program must conflict" do
|
57
65
|
test_start_time = @program_test.start_time + 200
|
58
66
|
duration = 1000
|
@@ -71,10 +79,13 @@ class RbProgramTest < Test::Unit::TestCase
|
|
71
79
|
should "program should not conflict" do
|
72
80
|
test_start_time = @program_test.start_time - 1500
|
73
81
|
duration = 1000
|
74
|
-
|
82
|
+
|
75
83
|
assert !@program_test.conflict?(test_start_time, duration)
|
76
|
-
|
77
|
-
test_start_time = @program_test.
|
84
|
+
|
85
|
+
test_start_time = @program_test.start_time + 200
|
86
|
+
duration = 1000
|
87
|
+
|
88
|
+
assert !@program_test.conflict?(test_start_time, duration, @program_test.uid)
|
78
89
|
end
|
79
90
|
|
80
91
|
teardown do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dblugeon-rb-eyetv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dblugeon
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-12 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|