musical 1.0.2 → 1.0.4
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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/bin/musical +15 -3
- data/lib/musical.rb +1 -0
- data/lib/musical/dvd.rb +6 -6
- data/lib/musical/notification/progress_bar.rb +4 -1
- data/lib/musical/version.rb +1 -1
- data/musical.gemspec +1 -1
- data/spec/musical/dvd_spec.rb +0 -4
- data/spec/musical_spec.rb +5 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0e3eed1e21640f605dd3be2378d305bb487389
|
4
|
+
data.tar.gz: 28c05bdec7551b0181b4de684428ab0b9c6bdd96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c74c2cc5c4f260ee84f4ae57b0cddf6d925f90fa6eba470787bcd28d09afa41646bd147b32d6aec6b6381b064dee765451d59065076202517be20852bb94a2
|
7
|
+
data.tar.gz: 36d9d57a9501d8f491175c3aaaecc85d71e70baddd059a1179e6aa0d2375b9a8e48518616b66300a4784b922fff1064b66790a5fb98ea67b1f04b70284fffee0
|
data/README.md
CHANGED
data/bin/musical
CHANGED
@@ -8,17 +8,26 @@ Musical.setup
|
|
8
8
|
dvd_options = {
|
9
9
|
title: Musical.configuration.title,
|
10
10
|
artist: Musical.configuration.artist,
|
11
|
+
year: Musical.configuration.year,
|
11
12
|
path: Musical.configuration.path
|
12
13
|
}
|
14
|
+
progress_format = Musical.configuration.progress_format
|
13
15
|
|
14
16
|
DVD.load(dvd_options) do |dvd|
|
15
17
|
next puts dvd.info if Musical.configuration.info
|
16
18
|
|
17
|
-
|
19
|
+
chapter_size = dvd.title_sets.inject(0){ |size, set| size + set[:chapter] }
|
20
|
+
ripping_progress_bar = Notification::ProgressBar.create(title: 'Ripping', total: chapter_size)
|
18
21
|
|
19
|
-
chapters.
|
20
|
-
|
22
|
+
chapters = dvd.rip { ripping_progress_bar.increment }
|
23
|
+
|
24
|
+
next if Musical.configuration.ignore_convert_sound
|
25
|
+
|
26
|
+
unless Musical.configuration.ignore_use_itunes
|
27
|
+
converting_progress_bar = Notification::ProgressBar.create(title: 'Converting', total: chapters.size)
|
28
|
+
end
|
21
29
|
|
30
|
+
chapters.each do |chapter|
|
22
31
|
wav = chapter.to_wav
|
23
32
|
next if Musical.configuration.ignore_use_itunes
|
24
33
|
|
@@ -29,12 +38,15 @@ DVD.load(dvd_options) do |dvd|
|
|
29
38
|
name: chapter.name,
|
30
39
|
album: dvd.title,
|
31
40
|
artist: dvd.artist,
|
41
|
+
year: dvd.year,
|
32
42
|
track_count: chapters.size,
|
33
43
|
track_number: chapter.chapter_number,
|
34
44
|
)
|
35
45
|
|
36
46
|
wav.delete!
|
37
47
|
track.delete!
|
48
|
+
|
49
|
+
converting_progress_bar.increment
|
38
50
|
end
|
39
51
|
end
|
40
52
|
|
data/lib/musical.rb
CHANGED
@@ -37,6 +37,7 @@ module Musical
|
|
37
37
|
opt :path, "Set device path of DVD", type: :string
|
38
38
|
opt :title, "Set DVD title", type: :string, default: 'LIVE'
|
39
39
|
opt :artist, "Set DVD artist", type: :string, default: 'Artist'
|
40
|
+
opt :year, "Set year DVD was recorded", type: :int, default: Time.now.year
|
40
41
|
opt :output, "Set location of ripped data", type: :string, default: 'ripped'
|
41
42
|
end
|
42
43
|
|
data/lib/musical/dvd.rb
CHANGED
@@ -7,7 +7,7 @@ module Musical
|
|
7
7
|
include Musical::Util
|
8
8
|
extend Musical::Util
|
9
9
|
|
10
|
-
attr_accessor :title, :artist
|
10
|
+
attr_accessor :title, :artist, :year
|
11
11
|
|
12
12
|
@@path = nil
|
13
13
|
|
@@ -40,8 +40,9 @@ module Musical
|
|
40
40
|
end
|
41
41
|
|
42
42
|
dvd = DVD.instance
|
43
|
-
dvd.title
|
43
|
+
dvd.title = options[:title] || Musical.configuration.title
|
44
44
|
dvd.artist = options[:artist] || Musical.configuration.artist
|
45
|
+
dvd.year = options[:year] || Musical.configuration.year
|
45
46
|
|
46
47
|
if block_given?
|
47
48
|
yield(dvd)
|
@@ -84,8 +85,6 @@ module Musical
|
|
84
85
|
save_dir = Musical.configuration.output
|
85
86
|
FileUtils.mkdir_p save_dir
|
86
87
|
|
87
|
-
chapter_size = title_sets.inject(0){ |size, set| size + set[:chapter] }
|
88
|
-
progress_bar = Notification::ProgressBar.create(title: 'Ripping', total: chapter_size, format: '%a %B %p%% %t')
|
89
88
|
chapters = []
|
90
89
|
|
91
90
|
title_sets.each do |title_set|
|
@@ -99,10 +98,11 @@ module Musical
|
|
99
98
|
commands << "--output='#{Musical.configuration.working_dir}'"
|
100
99
|
execute_command(commands.join(' '), true)
|
101
100
|
|
102
|
-
progress_bar.increment
|
103
|
-
|
104
101
|
vob_save_path = "#{save_dir}/TITLE_#{title_set[:title]}_#{chapter_index}.VOB"
|
105
102
|
FileUtils.mv(vob_path, vob_save_path)
|
103
|
+
|
104
|
+
yield if block_given?
|
105
|
+
|
106
106
|
Chapter.new(vob_save_path, title_number: title_set[:title], chapter_number: chapter_index)
|
107
107
|
end
|
108
108
|
end
|
@@ -2,8 +2,11 @@
|
|
2
2
|
module Musical
|
3
3
|
module Notification
|
4
4
|
class ProgressBar < ::ProgressBar
|
5
|
+
FORMAT = '%a %B %p%% %t'
|
6
|
+
|
5
7
|
def self.create(options = {})
|
6
|
-
|
8
|
+
options = { format: FORMAT }.merge(options)
|
9
|
+
progress_bar = super(options)
|
7
10
|
|
8
11
|
Thread.new do
|
9
12
|
while !progress_bar.finished?
|
data/lib/musical/version.rb
CHANGED
data/musical.gemspec
CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "coveralls", "~> 0.6.6"
|
31
31
|
spec.add_runtime_dependency "ruby-progressbar", ">= 1.2.0"
|
32
32
|
spec.add_runtime_dependency "trollop", ">= 2.0"
|
33
|
-
spec.add_runtime_dependency "itunes-client", "~> 0.1.
|
33
|
+
spec.add_runtime_dependency "itunes-client", "~> 0.1.4"
|
34
34
|
end
|
data/spec/musical/dvd_spec.rb
CHANGED
@@ -209,10 +209,6 @@ EOM
|
|
209
209
|
dvd.should_receive(:title_sets).at_least(1).and_return(title_sets)
|
210
210
|
dvd.should_receive(:execute_command).at_least(1).with(/dvdbackup (.)*/, true) { FileUtils.touch(vob_path) }
|
211
211
|
dvd.should_receive(:execute_command).at_least(1).with(/find (.)*/).and_return("#{vob_path}\n")
|
212
|
-
|
213
|
-
progress_bar = double
|
214
|
-
progress_bar.should_receive(:increment).at_least(1)
|
215
|
-
ProgressBar.should_receive(:create).and_return(progress_bar)
|
216
212
|
end
|
217
213
|
|
218
214
|
before do
|
data/spec/musical_spec.rb
CHANGED
@@ -37,6 +37,11 @@ describe Musical do
|
|
37
37
|
it { expect(setup.artist).to eq("artist!") }
|
38
38
|
end
|
39
39
|
|
40
|
+
context 'when argument `year` is given' do
|
41
|
+
before { stub_const('ARGV', ['--year=2000']) }
|
42
|
+
it { expect(setup.year).to eq(2000) }
|
43
|
+
end
|
44
|
+
|
40
45
|
context 'when argument `output` is given' do
|
41
46
|
before { stub_const('ARGV', ['--output=/tmp']) }
|
42
47
|
it { expect(setup.output).to eq('/tmp') }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: musical
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryo katsuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.1.
|
187
|
+
version: 0.1.4
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.1.
|
194
|
+
version: 0.1.4
|
195
195
|
description: musical is a simple tool for your favorite DVD. You can rip vob file
|
196
196
|
by DVD chapter, convert it to wav file and add it to your iTunes library.
|
197
197
|
email:
|