fancy_audio 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -2
- data/bin/fancy_audio +16 -1
- data/fancy_audio.gemspec +1 -1
- data/lib/fancy_audio.rb +9 -0
- data/lib/fancy_audio/version.rb +1 -1
- data/spec/fancy_audio_spec.rb +11 -0
- data/spec/resources/song1.mp3 +0 -0
- data/spec/resources/song2.mp3 +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80fedb8613e46477859d2df5c6c830b9b78c2233
|
4
|
+
data.tar.gz: a80ac13626109e46070fbf38c51497337fb9d696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd99945171f13b79fa7c800f2409cd91674f8ea14095789a335d91e7036eea4324cd59c943e3ca5957fb41e7bf579002931e123fd1eb113c5729fb415b81faf
|
7
|
+
data.tar.gz: 394029de7c7507041a1e28cca91ff0965584333ffb306ef113a7bc810293ff5fb8f6cde26021397a42a34ea03ce899dd9099248c205e0e66dac9c68afb126c2d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
# fancy_audio
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/fancy_audio.svg)](http://badge.fury.io/rb/fancy_audio)
|
3
|
+
|
2
4
|
A gem to add album cover to audio file
|
3
5
|
|
4
6
|
##Documentation
|
5
|
-
http://www.singhajit.com/
|
7
|
+
http://www.singhajit.com/add-album-cover-to-mp3-file/
|
6
8
|
|
7
9
|
## Contributing
|
8
10
|
|
9
11
|
1. Fork it ( http://github.com/ajitsing/fancy_audio )
|
10
12
|
2. Create your feature branch
|
11
|
-
3.
|
13
|
+
3. add feature
|
14
|
+
4. add tests
|
15
|
+
4. Run tests using 'rake' or 'rake spec'
|
12
16
|
4. Push to the branch
|
13
17
|
5. Create new Pull Request
|
data/bin/fancy_audio
CHANGED
@@ -6,6 +6,7 @@ include FancyAudio::PrettyPrinter
|
|
6
6
|
|
7
7
|
def print_help
|
8
8
|
help = <<-info
|
9
|
+
fancy_audio --all /path/to/songs image_file #=> attach image_file to all audio_files.(default songs path is current directory)
|
9
10
|
fancy_audio audio_file image_file #=> attach image_file to audio_file
|
10
11
|
fancy_audio #=> attach all audio and images with same name(default current dir) e.g song1.mp3 and song1.jpg
|
11
12
|
fancy_audio path/to/files #=> attach all audio and images with same name(cutom path to dir) e.g song1.mp3 and song1.jpg
|
@@ -17,6 +18,17 @@ def print_help
|
|
17
18
|
print_info help
|
18
19
|
end
|
19
20
|
|
21
|
+
def add_image_to_all_songs
|
22
|
+
second = ARGV[1]
|
23
|
+
third = ARGV[2]
|
24
|
+
|
25
|
+
if ARGV.size == 2
|
26
|
+
add_image_to_all second
|
27
|
+
elsif ARGV.size == 3
|
28
|
+
add_image_to_all second, third
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
20
32
|
def execute
|
21
33
|
first = ARGV[0]
|
22
34
|
second = ARGV[1]
|
@@ -24,6 +36,9 @@ def execute
|
|
24
36
|
if first == '--h' && ARGV.size == 1
|
25
37
|
print_help
|
26
38
|
|
39
|
+
elsif first == '--all'
|
40
|
+
add_image_to_all_songs
|
41
|
+
|
27
42
|
elsif !first.nil? && !second.nil? && ARGV.size == 2
|
28
43
|
add_image first, second
|
29
44
|
|
@@ -43,7 +58,7 @@ begin
|
|
43
58
|
rescue
|
44
59
|
error_msg = <<-error
|
45
60
|
Something went wrong! Or usages is incorrect
|
46
|
-
To understand the
|
61
|
+
To understand the correct usages visit - http://www.singhajit.com/fancyaudio-gem-to-add-album-cover-to-audio-file/
|
47
62
|
error
|
48
63
|
|
49
64
|
print_error error_msg
|
data/fancy_audio.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'fancy_audio/version'
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'fancy_audio'
|
8
8
|
s.version = FancyAudio::VERSION
|
9
|
-
s.date = '2015-07-
|
9
|
+
s.date = '2015-07-25'
|
10
10
|
s.summary = 'Gem to add an album cover to the audio'
|
11
11
|
s.description = s.summary
|
12
12
|
s.authors = ['Ajit Singh']
|
data/lib/fancy_audio.rb
CHANGED
@@ -17,6 +17,15 @@ module FancyAudio
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def add_image_to_all(dir = `pwd`.chop, image)
|
21
|
+
audio_files = Dir[dir + "/*.mp3"]
|
22
|
+
|
23
|
+
audio_files.each do |audio_file|
|
24
|
+
add_image(audio_file, image)
|
25
|
+
end
|
26
|
+
print_info "done!"
|
27
|
+
end
|
28
|
+
|
20
29
|
def add_image_smartly(dir = `pwd`.chop)
|
21
30
|
unavialble_images = []
|
22
31
|
changed_audio_files = {}
|
data/lib/fancy_audio/version.rb
CHANGED
data/spec/fancy_audio_spec.rb
CHANGED
@@ -45,5 +45,16 @@ describe :FancyAudio do
|
|
45
45
|
assert_audio_has_image audio_file
|
46
46
|
end
|
47
47
|
end
|
48
|
+
|
49
|
+
it 'should add image to all songs' do
|
50
|
+
current_dir = File.expand_path File.dirname __FILE__
|
51
|
+
audio_file_1 = current_dir + '/resources/song1.mp3'
|
52
|
+
audio_file_2 = current_dir + '/resources/song2.mp3'
|
53
|
+
image_file = current_dir + '/resources/song1.jpg'
|
54
|
+
|
55
|
+
add_image_to_all(current_dir + '/resources/', image_file)
|
56
|
+
assert_audio_has_image audio_file_1
|
57
|
+
assert_audio_has_image audio_file_2
|
58
|
+
end
|
48
59
|
end
|
49
60
|
|
data/spec/resources/song1.mp3
CHANGED
Binary file
|
data/spec/resources/song2.mp3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancy_audio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ajit Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-mp3info
|