typingpool 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/tp-make
CHANGED
|
@@ -71,6 +71,11 @@ OptionParser.new do |opts|
|
|
|
71
71
|
options[:bitrate] = kbps
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
opts.on('--devtest',
|
|
75
|
+
'Runs in a special development mode. Ignore.') do
|
|
76
|
+
options[:devtest] = true
|
|
77
|
+
end
|
|
78
|
+
|
|
74
79
|
opts.on('--help',
|
|
75
80
|
'Display this screen.') do
|
|
76
81
|
puts opts
|
|
@@ -136,6 +141,7 @@ else
|
|
|
136
141
|
converted_files = project.local.subdir('audio', 'originals').as(:audio).to_mp3(temp_conversion_dir, project.bitrate) do |file|
|
|
137
142
|
STDERR.puts "Converting #{File.basename(file) } to mp3"
|
|
138
143
|
end
|
|
144
|
+
converted_files = Typingpool::Filer::Files::Audio.new(converted_files.sort{|a,b| a.path <=> b.path})
|
|
139
145
|
|
|
140
146
|
STDERR.puts "Merging audio" if converted_files.count > 1
|
|
141
147
|
temp_merge_file = Tempfile.new(["#{project.name}.all.", ".mp3"])
|
|
@@ -151,6 +157,9 @@ else
|
|
|
151
157
|
assignment_path = project.create_assignment_csv(:path => ['data', 'assignment.csv'], :urls => urls, :unusual => options[:unusual], :voices => options[:voices])
|
|
152
158
|
|
|
153
159
|
temp_merge_file.close
|
|
160
|
+
if options[:devtest]
|
|
161
|
+
FileUtils.cp(temp_merge_file.path, project.local.subdir('audio', 'originals'))
|
|
162
|
+
end
|
|
154
163
|
temp_merge_file.unlink
|
|
155
164
|
FileUtils.remove_entry_secure(temp_conversion_dir)
|
|
156
165
|
end #if project.local
|
data/lib/typingpool/version.rb
CHANGED
|
@@ -5,6 +5,7 @@ $:.unshift File.join(File.dirname(File.dirname($0)), 'lib')
|
|
|
5
5
|
require 'typingpool'
|
|
6
6
|
require 'typingpool/test'
|
|
7
7
|
require 'csv'
|
|
8
|
+
require 'open3'
|
|
8
9
|
|
|
9
10
|
class TestTpMake < Typingpool::Test::Script
|
|
10
11
|
def test_abort_with_no_files
|
|
@@ -118,4 +119,30 @@ class TestTpMake < Typingpool::Test::Script
|
|
|
118
119
|
end #in_temp_tp_dir do...
|
|
119
120
|
end
|
|
120
121
|
|
|
122
|
+
def test_audio_files_sorted_correctly
|
|
123
|
+
in_temp_tp_dir do |dir|
|
|
124
|
+
config_path = self.config_path(dir)
|
|
125
|
+
skip_if_no_upload_credentials('tp-make audio file sorting test', Typingpool::Config.file(config_path))
|
|
126
|
+
assert(audio_files('mp3').count > 1)
|
|
127
|
+
correctly_ordered_paths = audio_files('mp3').sort
|
|
128
|
+
tp_make_with(dir, config_path, 'mp3')
|
|
129
|
+
assert(project = temp_tp_dir_project(dir))
|
|
130
|
+
assert(merged_audio_file = project.local.subdir('audio','originals').files.detect{|filer| filer.path.match(/.\.all\../)})
|
|
131
|
+
assert(File.exists? merged_audio_file)
|
|
132
|
+
actually_ordered_paths = originals_from_merged_audio_file(merged_audio_file)
|
|
133
|
+
assert_equal(correctly_ordered_paths.map{|path| File.basename(path) }, actually_ordered_paths.map{|path| File.basename(path) })
|
|
134
|
+
end #in_temp_tp_dir
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def originals_from_merged_audio_file(path)
|
|
138
|
+
out, err, status = Open3.capture3('mp3splt', '-l', path)
|
|
139
|
+
refute_nil(out)
|
|
140
|
+
refute_empty(out)
|
|
141
|
+
paths = out.scan(/^\/.+\.mp3$/i)
|
|
142
|
+
refute_empty(paths)
|
|
143
|
+
assert(paths.count > 1)
|
|
144
|
+
paths.each{|path| assert(File.exists? path) }
|
|
145
|
+
paths
|
|
146
|
+
end
|
|
147
|
+
|
|
121
148
|
end #TestTpMake
|
|
@@ -64,7 +64,7 @@ class TestProjectRemote < Typingpool::Test
|
|
|
64
64
|
standard_put_remove_tests(remote)
|
|
65
65
|
assert(s3.buckets[config.amazon.bucket].exists?)
|
|
66
66
|
ensure
|
|
67
|
-
s3.buckets[config.amazon.bucket].delete
|
|
67
|
+
s3.buckets[config.amazon.bucket].delete rescue AWS::S3::Errors::NoSuchBucket
|
|
68
68
|
end #begin
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -101,6 +101,7 @@ class TestProjectRemote < Typingpool::Test
|
|
|
101
101
|
:test_with => lambda{|urls| urls.each_with_index{|url, i| assert_includes(url, basenames[i]) } }
|
|
102
102
|
)
|
|
103
103
|
|
|
104
|
+
sleep 5
|
|
104
105
|
#now with different basenames
|
|
105
106
|
remote_basenames = basenames.map{|name| [File.basename(name, '.*'), pseudo_random_chars, File.extname(name)].join }
|
|
106
107
|
base_args = {
|
|
@@ -115,6 +116,7 @@ class TestProjectRemote < Typingpool::Test
|
|
|
115
116
|
)
|
|
116
117
|
)
|
|
117
118
|
|
|
119
|
+
sleep 5
|
|
118
120
|
#now using remove_urls for removal
|
|
119
121
|
put_remove_test(
|
|
120
122
|
base_args.merge(
|
|
@@ -123,6 +125,7 @@ class TestProjectRemote < Typingpool::Test
|
|
|
123
125
|
)
|
|
124
126
|
)
|
|
125
127
|
|
|
128
|
+
sleep 5
|
|
126
129
|
#now with stringio streams
|
|
127
130
|
put_remove_test(
|
|
128
131
|
base_args.merge(
|
|
@@ -161,12 +164,13 @@ class TestProjectRemote < Typingpool::Test
|
|
|
161
164
|
assert(urls = args[:remote].put(*put_args))
|
|
162
165
|
begin
|
|
163
166
|
assert_equal(args[:streams].count, urls.count)
|
|
164
|
-
sleep
|
|
167
|
+
sleep 10
|
|
165
168
|
urls.each{|url| assert(working_url?(url)) }
|
|
166
169
|
args[:test_with].call(urls) if args[:test_with]
|
|
167
170
|
ensure
|
|
168
171
|
args[:remove_with].call(urls)
|
|
169
172
|
end #begin
|
|
173
|
+
sleep 10
|
|
170
174
|
urls.each{|url| refute(working_url?(url)) }
|
|
171
175
|
urls
|
|
172
176
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: typingpool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rturk
|