cuesnap 1.0.0 → 1.0.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/lib/cuesnap/cli.rb +3 -0
- data/lib/cuesnap/version.rb +1 -1
- metadata +3 -24
- data/.gitignore +0 -21
- data/Gemfile +0 -3
- data/Guardfile +0 -9
- data/Rakefile +0 -10
- data/cuesnap.gemspec +0 -26
- data/spec/cli_spec.rb +0 -19
- data/spec/fixtures/same_name.cue +0 -7
- data/spec/fixtures/same_name.mp3 +0 -0
- data/spec/fixtures/ten_minute.mp3 +0 -0
- data/spec/fixtures/ten_splits.cue +0 -39
- data/spec/fixtures/unicode.cue +0 -19
- data/spec/spec_helper.rb +0 -100
- data/spec/splitter_spec.rb +0 -64
data/lib/cuesnap/cli.rb
CHANGED
data/lib/cuesnap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuesnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -100,27 +100,14 @@ executables:
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
-
- .gitignore
|
104
|
-
- Gemfile
|
105
|
-
- Guardfile
|
106
103
|
- LICENSE
|
107
104
|
- README.md
|
108
|
-
- Rakefile
|
109
105
|
- bin/cuesnap
|
110
|
-
- cuesnap.gemspec
|
111
106
|
- lib/cuesnap.rb
|
112
107
|
- lib/cuesnap/base.rb
|
113
108
|
- lib/cuesnap/cli.rb
|
114
109
|
- lib/cuesnap/splitter.rb
|
115
110
|
- lib/cuesnap/version.rb
|
116
|
-
- spec/cli_spec.rb
|
117
|
-
- spec/fixtures/same_name.cue
|
118
|
-
- spec/fixtures/same_name.mp3
|
119
|
-
- spec/fixtures/ten_minute.mp3
|
120
|
-
- spec/fixtures/ten_splits.cue
|
121
|
-
- spec/fixtures/unicode.cue
|
122
|
-
- spec/spec_helper.rb
|
123
|
-
- spec/splitter_spec.rb
|
124
111
|
homepage: http://github.com/mutewinter/cuesnap
|
125
112
|
licenses: []
|
126
113
|
post_install_message:
|
@@ -132,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
119
|
requirements:
|
133
120
|
- - ! '>='
|
134
121
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
122
|
+
version: 1.9.2
|
136
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
124
|
none: false
|
138
125
|
requirements:
|
@@ -145,12 +132,4 @@ rubygems_version: 1.8.24
|
|
145
132
|
signing_key:
|
146
133
|
specification_version: 3
|
147
134
|
summary: A command line tool for splitting mp3s with cue files
|
148
|
-
test_files:
|
149
|
-
- spec/cli_spec.rb
|
150
|
-
- spec/fixtures/same_name.cue
|
151
|
-
- spec/fixtures/same_name.mp3
|
152
|
-
- spec/fixtures/ten_minute.mp3
|
153
|
-
- spec/fixtures/ten_splits.cue
|
154
|
-
- spec/fixtures/unicode.cue
|
155
|
-
- spec/spec_helper.rb
|
156
|
-
- spec/splitter_spec.rb
|
135
|
+
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Guardfile
DELETED
data/Rakefile
DELETED
data/cuesnap.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/cuesnap/version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.authors = ['Jeremy Mack']
|
6
|
-
s.email = ['jeremy@pileofturtles.com']
|
7
|
-
s.description = %q{A Ruby wrapper around mp3splt that makes splitting mp3s with a cue file super simple.}
|
8
|
-
s.summary = %q{A command line tool for splitting mp3s with cue files}
|
9
|
-
s.homepage = "http://github.com/mutewinter/cuesnap"
|
10
|
-
|
11
|
-
s.files = `git ls-files`.split($\)
|
12
|
-
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
14
|
-
s.name = "cuesnap"
|
15
|
-
s.require_paths = ["lib"]
|
16
|
-
s.version = CueSnap::VERSION
|
17
|
-
|
18
|
-
# Regular Gems
|
19
|
-
s.add_dependency 'rubycue', '~> 0.1.0'
|
20
|
-
s.add_dependency 'methadone', '~> 1.2.1'
|
21
|
-
s.add_dependency 'hashie', '~> 1.2.0'
|
22
|
-
|
23
|
-
# Development Gems
|
24
|
-
s.add_development_dependency 'minitest', '~> 3.3.0'
|
25
|
-
s.add_development_dependency 'guard-minitest', '~> 0.5.0'
|
26
|
-
end
|
data/spec/cli_spec.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.expand_path('../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe CueSnap::CLI do
|
4
|
-
describe 'When running the command line' do
|
5
|
-
describe 'with no cue file argument' do
|
6
|
-
it 'should tell the user when no .cue file is found' do
|
7
|
-
stdin, stdout = Open3.popen3 'bin/cuesnap spec/fixtures/ten_minute.mp3'
|
8
|
-
stdout.read.must_match(/I looked for .*ten_minute\.cue, but didn't find it\./)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe 'with missing .mp3 argument' do
|
13
|
-
it "should tell the user when the specified mp3 isn't found" do
|
14
|
-
stdin, stdout = Open3.popen3 'bin/cuesnap spec/fixtures/missing.mp3'
|
15
|
-
stdout.read.must_match(/I looked for .*missing\.mp3, but didn't find it\./)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/spec/fixtures/same_name.cue
DELETED
data/spec/fixtures/same_name.mp3
DELETED
File without changes
|
Binary file
|
@@ -1,39 +0,0 @@
|
|
1
|
-
PERFORMER "Sir Splits-A-Lot"
|
2
|
-
TITLE "Many Splits Test"
|
3
|
-
FILE "ten_minute.mp3" MP3
|
4
|
-
TRACK 01 AUDIO
|
5
|
-
PERFORMER "I'm First"
|
6
|
-
TITLE "Always First"
|
7
|
-
INDEX 01 01:00:00
|
8
|
-
TRACK 02 AUDIO
|
9
|
-
PERFORMER "Derp Man"
|
10
|
-
TITLE "36 Second Track"
|
11
|
-
INDEX 01 02:36:71
|
12
|
-
TRACK 03 AUDIO
|
13
|
-
PERFORMER "Herp Woman"
|
14
|
-
TITLE "Two Minute 50 Second Track"
|
15
|
-
INDEX 01 03:50:42
|
16
|
-
TRACK 05 AUDIO
|
17
|
-
PERFORMER "Test Artist"
|
18
|
-
TITLE "Tësting Unicode"
|
19
|
-
INDEX 01 04:00:00
|
20
|
-
TRACK 06 AUDIO
|
21
|
-
PERFORMER "I'm First"
|
22
|
-
TITLE "Always First"
|
23
|
-
INDEX 01 05:00:00
|
24
|
-
TRACK 07 AUDIO
|
25
|
-
PERFORMER "Derp Man"
|
26
|
-
TITLE "36 Second Track"
|
27
|
-
INDEX 01 06:36:71
|
28
|
-
TRACK 08 AUDIO
|
29
|
-
PERFORMER "Herp Woman"
|
30
|
-
TITLE "Two Minute 50 Second Track"
|
31
|
-
INDEX 01 07:50:42
|
32
|
-
TRACK 09 AUDIO
|
33
|
-
PERFORMER "Test Artist"
|
34
|
-
TITLE "Tësting Unicode"
|
35
|
-
INDEX 01 08:00:00
|
36
|
-
TRACK 10 AUDIO
|
37
|
-
PERFORMER "I'm First"
|
38
|
-
TITLE "Always First"
|
39
|
-
INDEX 01 09:00:00
|
data/spec/fixtures/unicode.cue
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
PERFORMER "T�st"
|
2
|
-
TITLE "Small Unicode Test"
|
3
|
-
FILE "small_unicode.mp3" MP3
|
4
|
-
TRACK 01 AUDIO
|
5
|
-
PERFORMER "I'm First"
|
6
|
-
TITLE "Always First"
|
7
|
-
INDEX 01 00:00:00
|
8
|
-
TRACK 02 AUDIO
|
9
|
-
PERFORMER "Derp Man"
|
10
|
-
TITLE "36 Second Track"
|
11
|
-
INDEX 01 00:36:71
|
12
|
-
TRACK 03 AUDIO
|
13
|
-
PERFORMER "Herp Woman"
|
14
|
-
TITLE "Two Minute 50 Second Track"
|
15
|
-
INDEX 01 02:50:42
|
16
|
-
TRACK 04 AUDIO
|
17
|
-
PERFORMER "Test Artist"
|
18
|
-
TITLE "T�sting Unicode"
|
19
|
-
INDEX 01 10:00:00
|
data/spec/spec_helper.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
|
3
|
-
require "minitest/autorun"
|
4
|
-
require "minitest/pride"
|
5
|
-
|
6
|
-
require 'cuesnap'
|
7
|
-
require 'rubycue'
|
8
|
-
|
9
|
-
# -------------
|
10
|
-
# Constants
|
11
|
-
# -------------
|
12
|
-
|
13
|
-
OUTPUT_FOLDER = File.expand_path("../../tmp/spec_output", __FILE__)
|
14
|
-
|
15
|
-
# -------------
|
16
|
-
# Helpers
|
17
|
-
# -------------
|
18
|
-
def cuesheet_fixture(name)
|
19
|
-
if name && name.strip != ''
|
20
|
-
fixture_path "#{name}.cue"
|
21
|
-
else
|
22
|
-
name
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def mp3_fixture(name)
|
27
|
-
fixture_path "#{name}.mp3"
|
28
|
-
end
|
29
|
-
|
30
|
-
def fixture_path(name)
|
31
|
-
File.join(File.dirname(__FILE__), "fixtures/#{name}")
|
32
|
-
end
|
33
|
-
|
34
|
-
def load_splitter(mp3_name, cuesheet_name)
|
35
|
-
mp3 = mp3_fixture(mp3_name)
|
36
|
-
cuesheet = cuesheet_fixture(cuesheet_name)
|
37
|
-
|
38
|
-
@splitter = CueSnap::Splitter.new(mp3, cuesheet, {
|
39
|
-
quiet: true,
|
40
|
-
output_folder: "#{Time.now.to_i}#{rand(1000)}"
|
41
|
-
})
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
# -------------
|
46
|
-
# Output Folder
|
47
|
-
# -------------
|
48
|
-
|
49
|
-
def cd_to_output
|
50
|
-
FileUtils.mkdir_p OUTPUT_FOLDER unless File.exists? OUTPUT_FOLDER
|
51
|
-
Dir.chdir OUTPUT_FOLDER
|
52
|
-
end
|
53
|
-
|
54
|
-
# Public: Get all of the mp3s in the output folder for the splitter.
|
55
|
-
def created_mp3s
|
56
|
-
Dir.glob("#{@splitter.output_folder}/*.mp3").map { |f| File.basename f }
|
57
|
-
end
|
58
|
-
|
59
|
-
# Public: Adds after test suite callback to ensure temporary files are deleted.
|
60
|
-
class MyMiniTest
|
61
|
-
class Unit < MiniTest::Unit
|
62
|
-
def before_suites
|
63
|
-
end
|
64
|
-
|
65
|
-
def after_suites
|
66
|
-
remove_mp3s
|
67
|
-
remove_empty_directories
|
68
|
-
end
|
69
|
-
|
70
|
-
def remove_mp3s
|
71
|
-
Dir.glob("#{OUTPUT_FOLDER}/**/*.mp3").each do |f|
|
72
|
-
File.delete f unless File.directory? f
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def remove_empty_directories
|
77
|
-
Dir.glob("#{OUTPUT_FOLDER}/*/").each { |d| Dir.delete d }
|
78
|
-
end
|
79
|
-
|
80
|
-
def _run_suites(suites, type)
|
81
|
-
begin
|
82
|
-
before_suites
|
83
|
-
super(suites, type)
|
84
|
-
ensure
|
85
|
-
after_suites
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def _run_suite(suite, type)
|
90
|
-
begin
|
91
|
-
suite.before_suite if suite.respond_to?(:before_suite)
|
92
|
-
super(suite, type)
|
93
|
-
ensure
|
94
|
-
suite.after_suite if suite.respond_to?(:after_suite)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
MiniTest::Unit.runner = MyMiniTest::Unit.new
|
data/spec/splitter_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../spec_helper', __FILE__)
|
3
|
-
|
4
|
-
describe CueSnap::Splitter do
|
5
|
-
|
6
|
-
describe 'When splitting ten_minute.mp3 and unicode.cue' do
|
7
|
-
|
8
|
-
before do
|
9
|
-
load_splitter 'ten_minute', 'unicode'
|
10
|
-
cd_to_output
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'splitting should produce 4 mp3 files' do
|
14
|
-
created_mp3s.length.wont_equal 4
|
15
|
-
@splitter.split!
|
16
|
-
created_mp3s.length.must_equal 4
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'the third track should not have a zero-padded index' do
|
20
|
-
# FIXME failing test
|
21
|
-
@splitter.split!
|
22
|
-
created_mp3s[2].must_match(/^3/)
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'it should have no numbers when no_numbers is specified' do
|
26
|
-
@splitter.options.no_numbers = true
|
27
|
-
@splitter.split!
|
28
|
-
created_mp3s.first.must_equal 'Derp Man - 36 Second Track.mp3'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'the fourth track should be proper unicode' do
|
32
|
-
@splitter.split!
|
33
|
-
created_mp3s[3].must_equal "Tësting Unicode"
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
describe 'When splitting ten_minute.mp3 and ten_splits.cue' do
|
39
|
-
|
40
|
-
before do
|
41
|
-
load_splitter 'ten_minute', 'ten_splits'
|
42
|
-
cd_to_output
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'must zero pad tracks less than 10th' do
|
46
|
-
@splitter.split!
|
47
|
-
created_mp3s.first.must_match(/^01/)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'When splitting same_name.mp3 without specified cuefile' do
|
52
|
-
|
53
|
-
before do
|
54
|
-
load_splitter 'same_name', nil
|
55
|
-
cd_to_output
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'should default to using same_name.cue' do
|
59
|
-
File.basename(@splitter.cue_file).must_equal 'same_name.cue'
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|