wait_up 0.1.0 → 0.1.2

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
- SHA1:
3
- metadata.gz: a5ccb2fb40cd34d1840b9c7c15407f679afffea7
4
- data.tar.gz: 47e74d3f2e7ba2aa7c7663881d26009bd99ed284
2
+ SHA256:
3
+ metadata.gz: 90a5da22c269e5072c01541fd0cf8408e96fc8bf568c7076d4b0fd5084d82f86
4
+ data.tar.gz: f25747bf90037f097813b06bf43051ac6724a69490353bc911ded33157468bc9
5
5
  SHA512:
6
- metadata.gz: '0329023475455c99a03fc2fecdbb0307139c654a252a1edfbcd892a1ddf9944e0d0b6fd2a187b915a38a87573ed9cc277f8dc7a40cd7bea4eb04affe0c6e51eb'
7
- data.tar.gz: 78f277839d2c54fa1037dbffbc32841af69211ae78e3fdf471f2ffad51fe137e95935cf27c07709601dbe3da31b605b6e81d8b38f517309f05837cddce09ddc2
6
+ metadata.gz: 2152a5a517a6b2a7c07836a9581e7b0276881143cf93c2dc8c3032a61f7139387a056e48394e0491bf102e68138a3866f8c3a9b4f9c93c48d7b5cebec7caef1d
7
+ data.tar.gz: 3e9a8b63a7c6f12ce9ce346d0e5a6b8c583bed903b46e170880e3ab19e8ed333e51ba17bb2fbb327b80b68ac823af15236401f5f81ebeecc5811fd900eb25684
data/Changelog.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change log
2
2
 
3
+ ## 0.1.2 2021-01-21
4
+
5
+ * Support Rubies 3.0 through 3.3
6
+ * Update dependencies
7
+
8
+ ## 0.1.1 2021-01-21
9
+
10
+ * Support Rubies 2.7 through 3.1
11
+ * Update dependencies
12
+
3
13
  ## 0.1.0 2017-04-25
4
14
 
5
15
  * Port to Ruby-GNOME2
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Matijs van Zuijlen
1
+ Copyright (c) 2015-2024 Matijs van Zuijlen
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -48,5 +48,5 @@ If you want to run the tests, you may need to install additional packages:
48
48
 
49
49
  ## License
50
50
 
51
- Copyright © 2015–2017 [Matijs van Zuijlen](http://www.matijs.net).
51
+ Copyright © 2015–2024 [Matijs van Zuijlen](http://www.matijs.net).
52
52
  See LICENSE for details.
data/bin/wait_up CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/wait_up'
2
+ # frozen_string_literal: true
3
+
4
+ require "wait_up"
3
5
 
4
6
  Gtk.init
5
7
 
data/bin/wait_up-cli CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../lib/wait_up/pipeline'
2
+ # frozen_string_literal: true
3
+
4
+ require "wait_up/pipeline"
3
5
 
4
6
  unless ARGV.length == 2
5
- warn 'Usage: wait_up-cli [file] [tempo]'
7
+ warn "Usage: wait_up-cli [file] [tempo]"
6
8
  exit 1
7
9
  end
8
10
  filename = ARGV[0]
@@ -16,7 +18,7 @@ mainloop = GLib::MainLoop.new(GLib::MainContext.default, true)
16
18
  bus = pipeline.play_bin.bus
17
19
  bus.add_signal_watch
18
20
 
19
- bus.signal_connect 'message' do |_bus, message, _ud|
21
+ bus.signal_connect "message" do |_bus, message, _ud|
20
22
  case message.type
21
23
  when Gst::MessageType::ERROR, Gst::MessageType::EOS
22
24
  mainloop.quit
@@ -1,4 +1,6 @@
1
- require 'gtk3'
1
+ # frozen_string_literal: true
2
+
3
+ require "gtk3"
2
4
 
3
5
  module WaitUp
4
6
  # Main Wait Up application class
@@ -19,11 +21,11 @@ module WaitUp
19
21
  end
20
22
 
21
23
  def connect_destroy_signal
22
- @win.signal_connect('destroy') { Gtk.main_quit }
24
+ @win.signal_connect("destroy") { Gtk.main_quit }
23
25
  end
24
26
 
25
27
  def connect_key_press_event_signal
26
- @win.signal_connect 'key-press-event' do |_wdg, evt, _ud|
28
+ @win.signal_connect "key-press-event" do |_wdg, evt, _ud|
27
29
  handle_key(evt) if evt.state.control_mask?
28
30
  false
29
31
  end
@@ -31,35 +33,47 @@ module WaitUp
31
33
 
32
34
  def handle_key(evt)
33
35
  case evt.keyval
34
- when 'q'.ord
36
+ when "q".ord
35
37
  @win.destroy
36
38
  end
37
39
  end
38
40
 
39
41
  def connect_slide_signal
40
- @timeline.signal_connect 'format-value' do |_scale, value, _user_data|
42
+ timeline.signal_connect "format-value" do |_scale, value, _user_data|
41
43
  ">#{value}<"
42
44
  end
43
45
  end
44
46
 
45
47
  def connect_file_chooser_signal
46
- @chooser.signal_connect 'file-set' do |_widget, _user_data|
47
- puts @chooser.filename
48
+ chooser.signal_connect "file-set" do |_widget, _user_data|
49
+ puts chooser.filename
48
50
  end
49
51
  end
50
52
 
51
53
  def setup_gui
52
54
  @win = Gtk::Window.new :toplevel
53
- @grid = Gtk::Grid.new
54
- @grid.orientation = :vertical
55
- @win.add @grid
56
- @chooser = Gtk::FileChooserButton.new('Hello!', :open)
57
- @grid.add @chooser
58
- @timeline = Gtk::Scale.new :horizontal, 0.0, 10.0, 0.1
59
- @timeline.hexpand = true
60
- @grid.add @timeline
61
- @volume = Gtk::VolumeButton.new
62
- @grid.add @volume
55
+ @win.add grid
56
+ end
57
+
58
+ def grid
59
+ @grid ||=
60
+ Gtk::Grid.new.tap do |grid|
61
+ grid.orientation = :vertical
62
+ grid.add chooser
63
+ grid.add timeline
64
+ grid.add Gtk::VolumeButton.new
65
+ end
66
+ end
67
+
68
+ def timeline
69
+ @timeline ||=
70
+ Gtk::Scale.new(:horizontal, 0.0, 10.0, 0.1).tap do |it|
71
+ it.hexpand = true
72
+ end
73
+ end
74
+
75
+ def chooser
76
+ @chooser ||= Gtk::FileChooserButton.new("Hello!", :open)
63
77
  end
64
78
  end
65
79
  end
@@ -1,4 +1,6 @@
1
- require 'gstreamer'
1
+ # frozen_string_literal: true
2
+
3
+ require "gstreamer"
2
4
 
3
5
  module WaitUp
4
6
  # Wait Up pipeline class
@@ -9,21 +11,10 @@ module WaitUp
9
11
  @filename = filename
10
12
  @tempo = tempo
11
13
 
12
- play_bin.set_property 'uri', "file://#{File.absolute_path(filename)}"
13
-
14
- sink_bin.add audiosink
15
- sink_bin.add postconverter
16
- sink_bin.add speed_changer
17
-
18
- speed_changer.link postconverter
19
- postconverter.link audiosink
14
+ fill_sink_bin
15
+ link_elements
20
16
 
21
- sink_pad = Gst::GhostPad.new 'sink', speed_changer.sinkpads.first
22
- sink_bin.add_pad sink_pad
23
-
24
- play_bin.audio_sink = sink_bin
25
- play_bin.state = :paused
26
- play_bin.get_state(-1)
17
+ set_up_play_bin
27
18
  end
28
19
 
29
20
  def play
@@ -31,29 +22,54 @@ module WaitUp
31
22
  end
32
23
 
33
24
  def play_bin
34
- @play_bin ||= Gst::ElementFactory.make 'playbin', nil
25
+ @play_bin ||= Gst::ElementFactory.make "playbin", nil
35
26
  end
36
27
 
37
28
  def sink_bin
38
- @sink_bin ||= Gst::Bin.new('sinkbin')
29
+ @sink_bin ||= Gst::Bin.new("sinkbin")
39
30
  end
40
31
 
41
32
  def speed_changer
42
- @speed_changer ||= Gst::ElementFactory.make('pitch', 'speed changer').tap do |element|
43
- element.set_property 'tempo', tempo
33
+ @speed_changer ||= Gst::ElementFactory.make("pitch", "speed changer").tap do |element|
34
+ element.set_property "tempo", tempo
44
35
  end
45
36
  end
46
37
 
47
38
  def audiosink
48
- @audiosink ||= Gst::ElementFactory.make('autoaudiosink', 'audiosink')
39
+ @audiosink ||= Gst::ElementFactory.make("autoaudiosink", "audiosink")
49
40
  end
50
41
 
51
42
  def postconverter
52
- @postconverter ||= Gst::ElementFactory.make('audioconvert', 'postconverter')
43
+ @postconverter ||= Gst::ElementFactory.make("audioconvert", "postconverter")
53
44
  end
54
45
 
55
46
  def preconverter
56
- @preconverter ||= Gst::ElementFactory.make('audioconvert', 'preconverter')
47
+ @preconverter ||= Gst::ElementFactory.make("audioconvert", "preconverter")
48
+ end
49
+
50
+ private
51
+
52
+ def fill_sink_bin
53
+ sink_bin.add audiosink
54
+ sink_bin.add postconverter
55
+ sink_bin.add speed_changer
56
+ sink_bin.add_pad speed_changer_ghost_pad
57
+ end
58
+
59
+ def speed_changer_ghost_pad
60
+ @speed_changer_ghost_pad ||= Gst::GhostPad.new "sink", speed_changer.sinkpads.first
61
+ end
62
+
63
+ def link_elements
64
+ speed_changer.link postconverter
65
+ postconverter.link audiosink
66
+ end
67
+
68
+ def set_up_play_bin
69
+ play_bin.set_property "uri", "file://#{File.absolute_path(filename)}"
70
+ play_bin.audio_sink = sink_bin
71
+ play_bin.state = :paused
72
+ play_bin.get_state(-1)
57
73
  end
58
74
  end
59
75
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WaitUp
4
+ VERSION = "0.1.2"
5
+ end
data/lib/wait_up.rb CHANGED
@@ -1 +1,4 @@
1
- require_relative 'wait_up/application'
1
+ # frozen_string_literal: true
2
+
3
+ require "wait_up/application"
4
+ require "wait_up/version"
metadata CHANGED
@@ -1,146 +1,199 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wait_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2024-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gtk3
14
+ name: gstreamer
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.1.1
19
+ version: 4.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.1.1
26
+ version: 4.2.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: gstreamer
28
+ name: gtk3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.1.1
33
+ version: 4.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.1.1
40
+ version: 4.2.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: rake
42
+ name: gnome_app_driver
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 12.0.0
47
+ version: 0.3.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 12.0.0
54
+ version: 0.3.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.5'
61
+ version: '5.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '13.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '13.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake-manifest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.51'
62
104
  type: :development
63
105
  prerelease: false
64
106
  version_requirements: !ruby/object:Gem::Requirement
65
107
  requirements:
66
108
  - - "~>"
67
109
  - !ruby/object:Gem::Version
68
- version: '5.5'
110
+ version: '1.51'
69
111
  - !ruby/object:Gem::Dependency
70
- name: atspi_app_driver
112
+ name: rubocop-minitest
71
113
  requirement: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - "~>"
74
116
  - !ruby/object:Gem::Version
75
- version: 0.1.0
117
+ version: 0.36.0
76
118
  type: :development
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
- version: 0.1.0
124
+ version: 0.36.0
83
125
  - !ruby/object:Gem::Dependency
84
- name: pry
126
+ name: rubocop-packaging
85
127
  requirement: !ruby/object:Gem::Requirement
86
128
  requirements:
87
129
  - - "~>"
88
130
  - !ruby/object:Gem::Version
89
- version: 0.10.2
131
+ version: 0.5.1
90
132
  type: :development
91
133
  prerelease: false
92
134
  version_requirements: !ruby/object:Gem::Requirement
93
135
  requirements:
94
136
  - - "~>"
95
137
  - !ruby/object:Gem::Version
96
- version: 0.10.2
97
- description:
138
+ version: 0.5.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '1.18'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '1.18'
153
+ description:
98
154
  email:
99
155
  - matijs@matijs.net
100
156
  executables:
101
157
  - wait_up
102
158
  - wait_up-cli
103
159
  extensions: []
104
- extra_rdoc_files: []
160
+ extra_rdoc_files:
161
+ - README.md
162
+ - Changelog.md
105
163
  files:
106
164
  - Changelog.md
107
- - Gemfile
108
165
  - LICENSE
109
166
  - README.md
110
- - Rakefile
111
167
  - bin/wait_up
112
168
  - bin/wait_up-cli
113
169
  - lib/wait_up.rb
114
170
  - lib/wait_up/application.rb
115
171
  - lib/wait_up/pipeline.rb
116
- - test/end_to_end/basic_run_test.rb
117
- - test/test_helper.rb
118
- - test/unit/pipeline_test.rb
172
+ - lib/wait_up/version.rb
119
173
  homepage: http://www.github.com/mvz/wait_up
120
174
  licenses:
121
175
  - MIT
122
- metadata: {}
123
- post_install_message:
124
- rdoc_options: []
176
+ metadata:
177
+ rubygems_mfa_required: 'true'
178
+ post_install_message:
179
+ rdoc_options:
180
+ - "--main"
181
+ - README.md
125
182
  require_paths:
126
183
  - lib
127
184
  required_ruby_version: !ruby/object:Gem::Requirement
128
185
  requirements:
129
186
  - - ">="
130
187
  - !ruby/object:Gem::Version
131
- version: '0'
188
+ version: 3.0.0
132
189
  required_rubygems_version: !ruby/object:Gem::Requirement
133
190
  requirements:
134
191
  - - ">="
135
192
  - !ruby/object:Gem::Version
136
193
  version: '0'
137
194
  requirements: []
138
- rubyforge_project:
139
- rubygems_version: 2.6.8
140
- signing_key:
195
+ rubygems_version: 3.5.23
196
+ signing_key:
141
197
  specification_version: 4
142
198
  summary: Play sound files slowly so you can follow along
143
- test_files:
144
- - test/unit/pipeline_test.rb
145
- - test/test_helper.rb
146
- - test/end_to_end/basic_run_test.rb
199
+ test_files: []
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gemspec
data/Rakefile DELETED
@@ -1,23 +0,0 @@
1
- require 'rake/clean'
2
- require 'bundler/gem_tasks'
3
- require 'rake/testtask'
4
-
5
- namespace :test do
6
- Rake::TestTask.new(:unit) do |t|
7
- t.libs = ['lib']
8
- t.test_files = FileList['test/unit/*_test.rb']
9
- t.warning = true
10
- end
11
-
12
- Rake::TestTask.new(:end_to_end) do |t|
13
- t.libs = ['lib']
14
- t.test_files = FileList['test/end_to_end/*_test.rb']
15
- t.warning = true
16
- end
17
-
18
- task all: [:unit, :end_to_end]
19
- end
20
-
21
- task test: 'test:all'
22
-
23
- task default: 'test'
@@ -1,27 +0,0 @@
1
- require_relative '../test_helper'
2
- require 'atspi_app_driver'
3
-
4
- # Test driver for the Wait Up application.
5
- class WaitUpDriver < AtspiAppDriver
6
- def initialize
7
- super 'wait_up'
8
- end
9
- end
10
-
11
- describe 'The Wait Up application' do
12
- before do
13
- @driver = WaitUpDriver.new
14
- @driver.boot
15
- end
16
-
17
- it 'starts and can be quit with Ctrl-q' do
18
- @driver.press_ctrl_q
19
-
20
- status = @driver.cleanup
21
- status.exitstatus.must_equal 0
22
- end
23
-
24
- after do
25
- @driver.cleanup
26
- end
27
- end
data/test/test_helper.rb DELETED
@@ -1 +0,0 @@
1
- require 'minitest/autorun'
@@ -1,75 +0,0 @@
1
- require_relative '../test_helper'
2
- require_relative '../../lib/wait_up/pipeline'
3
-
4
- Gst.init
5
-
6
- def next_element(element)
7
- # FIXME: Reduce the number of necessary chained calls here.
8
- pad = element.srcpads.first
9
- peer = pad.peer if pad
10
- peer.parent if peer
11
- end
12
-
13
- describe WaitUp::Pipeline do
14
- # Empty mp3 file from http://www.xamuel.com/blank-mp3s/
15
- let(:filename) { File.join(File.dirname(__FILE__), '..', 'fixtures', 'point1sec.mp3') }
16
- let(:instance) { WaitUp::Pipeline.new filename, 0.9 }
17
-
18
- describe '#sink_bin' do
19
- let(:sink_bin) { instance.sink_bin }
20
-
21
- it 'returns a Gst::Bin' do
22
- sink_bin.must_be_instance_of Gst::Bin
23
- end
24
-
25
- it 'has the correct build-up' do
26
- sink_bin.map(&:name).must_equal ['speed changer', 'postconverter', 'audiosink']
27
- end
28
-
29
- it 'has the elements all linked up' do
30
- sink_bin.each_cons(2) do |src, dst|
31
- next_element(src).
32
- must_equal dst, "Expected #{src.name} to link up to #{dst.name}"
33
- end
34
- end
35
-
36
- it 'must have the state :paused' do
37
- sink_bin.get_state(0)[1].must_equal Gst::State::PAUSED
38
- end
39
-
40
- it 'must be linked up to a source' do
41
- sink_bin.sinkpads.first.peer.wont_be_nil
42
- end
43
- end
44
-
45
- describe '#play_bin' do
46
- let(:play_bin) { instance.play_bin }
47
-
48
- it 'must have the state :paused' do
49
- play_bin.get_state(0)[1].must_equal Gst::State::PAUSED
50
- end
51
-
52
- it 'has the correct source set up' do
53
- source = play_bin.source
54
- source.uri.must_equal "file://#{File.absolute_path filename}"
55
- end
56
- end
57
-
58
- describe '#speed_changer' do
59
- let(:speed_changer) { instance.speed_changer }
60
- it 'returns a Gst::Element' do
61
- speed_changer.must_be_kind_of Gst::Element
62
- end
63
-
64
- it 'has the correct tempo' do
65
- speed_changer.get_property('tempo').must_be_close_to 0.9
66
- end
67
- end
68
-
69
- describe '#play' do
70
- it "sets the play bin's state to :playing" do
71
- instance.play
72
- instance.play_bin.get_state(0)[1].must_equal Gst::State::PLAYING
73
- end
74
- end
75
- end