duo_splitter 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.ja.md +128 -0
- data/README.md +13 -11
- data/exe/duo_splitter +9 -3
- data/lib/duo_splitter.rb +39 -10
- data/lib/duo_splitter/batch_processor.rb +36 -0
- data/lib/duo_splitter/commands/base_command.rb +121 -0
- data/lib/duo_splitter/commands/overlapping_command.rb +37 -0
- data/lib/duo_splitter/commands/repeating_command.rb +38 -0
- data/lib/duo_splitter/commands/split_command.rb +31 -0
- data/lib/duo_splitter/context.rb +34 -0
- data/lib/duo_splitter/encoders/aac_encoder.rb +17 -0
- data/lib/duo_splitter/encoders/base_encoder.rb +57 -0
- data/lib/duo_splitter/encoders/mp3_encoder.rb +17 -0
- data/lib/duo_splitter/encoders/wav_encoder.rb +17 -0
- data/lib/duo_splitter/models/album.rb +23 -0
- data/lib/duo_splitter/models/section.rb +38 -0
- data/lib/duo_splitter/models/sentence.rb +35 -0
- data/lib/duo_splitter/runner.rb +43 -64
- data/lib/duo_splitter/services/create_overlapping_sentences.rb +19 -0
- data/lib/duo_splitter/services/create_repeating_sentences.rb +20 -0
- data/lib/duo_splitter/services/create_sentences.rb +18 -0
- data/lib/duo_splitter/services/support/base_concatenate.rb +46 -0
- data/lib/duo_splitter/services/support/create_blank_sentences.rb +40 -0
- data/lib/duo_splitter/services/support/encode.rb +23 -0
- data/lib/duo_splitter/services/support/overlapping_concatenate.rb +19 -0
- data/lib/duo_splitter/services/support/repeating_concatenate.rb +22 -0
- data/lib/duo_splitter/services/support/split_tracks.rb +42 -0
- data/lib/duo_splitter/temp_dir_wrapper.rb +20 -0
- data/lib/duo_splitter/version.rb +3 -1
- metadata +34 -15
- data/lib/duo_splitter/aac_encoder.rb +0 -13
- data/lib/duo_splitter/album.rb +0 -21
- data/lib/duo_splitter/encoder.rb +0 -71
- data/lib/duo_splitter/mp3_encoder.rb +0 -13
- data/lib/duo_splitter/section.rb +0 -30
- data/lib/duo_splitter/sentence.rb +0 -22
- data/lib/duo_splitter/wav_encoder.rb +0 -13
data/lib/duo_splitter/section.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module DuoSplitter
|
2
|
-
class Section
|
3
|
-
attr_reader :number, :sentences
|
4
|
-
|
5
|
-
attr_accessor :source_path
|
6
|
-
|
7
|
-
def initialize(number:)
|
8
|
-
@number = number
|
9
|
-
@sentences = load_sentences
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def load_sentences
|
15
|
-
label_path = DATA_DIR.join('labels/%02d.txt' % number)
|
16
|
-
|
17
|
-
records = label_path.readlines.map {|line| line.chomp.split(/\t/) }
|
18
|
-
|
19
|
-
records.unshift(%w[0 0 0])
|
20
|
-
|
21
|
-
records.each_cons(2).map do |current_record, next_record|
|
22
|
-
sentence_number = current_record.last.to_i
|
23
|
-
start_pos = current_record.first
|
24
|
-
end_pos = next_record.first
|
25
|
-
|
26
|
-
Sentence.new(number: sentence_number, start_pos: start_pos, end_pos: end_pos, section: self)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module DuoSplitter
|
2
|
-
class Sentence
|
3
|
-
attr_reader :number, :start_pos, :end_pos, :section
|
4
|
-
|
5
|
-
def initialize(number:, start_pos:, end_pos:, section:)
|
6
|
-
@number = number
|
7
|
-
@start_pos = start_pos
|
8
|
-
@end_pos = end_pos
|
9
|
-
@section = section
|
10
|
-
end
|
11
|
-
|
12
|
-
def intro?
|
13
|
-
number.zero?
|
14
|
-
end
|
15
|
-
|
16
|
-
def output_name(add_section_prefix: true, ext:)
|
17
|
-
name = '%03d.%s' % [number, ext]
|
18
|
-
name = ('%02d-' % section.number) + name if add_section_prefix
|
19
|
-
name
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|