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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09f615a99f7bd8d0966a686bbaadd5e9071d14c7
4
- data.tar.gz: 2af9c05d7737fa95d0ca4f81387efdd2e07688a1
3
+ metadata.gz: 80fedb8613e46477859d2df5c6c830b9b78c2233
4
+ data.tar.gz: a80ac13626109e46070fbf38c51497337fb9d696
5
5
  SHA512:
6
- metadata.gz: e03faa88c3fd54bd564ad9fd4f69b34feaeca10c5865349f4a9b09620af9eaafeb0a2ef41457146935a4fb09f695f18946bfe0c499e2b06b2e6bf3d271e3b79e
7
- data.tar.gz: 7afe3ba2a717a514534b82011204a2954df5a99ac87a5f0c570e5b29e75cca4e9ca13a64388b147ff276d8ee643188f8fc08ac83456a5b8ad55cdf4f6e9e1bb9
6
+ metadata.gz: 5bd99945171f13b79fa7c800f2409cd91674f8ea14095789a335d91e7036eea4324cd59c943e3ca5957fb41e7bf579002931e123fd1eb113c5729fb415b81faf
7
+ data.tar.gz: 394029de7c7507041a1e28cca91ff0965584333ffb306ef113a7bc810293ff5fb8f6cde26021397a42a34ea03ce899dd9099248c205e0e66dac9c68afb126c2d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fancy_audio (0.0.1)
4
+ fancy_audio (0.0.4)
5
5
  ruby-mp3info (~> 0.8.5)
6
6
 
7
7
  GEM
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/fancyaudio-gem-to-add-album-cover-to-audio-file/
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. Commit your changes
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
@@ -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 corrent usages visit - http://www.singhajit.com/fancyaudio-gem-to-add-album-cover-to-audio-file/
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
@@ -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-18'
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']
@@ -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 = {}
@@ -1,3 +1,3 @@
1
1
  module FancyAudio
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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
 
Binary file
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.3
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-18 00:00:00.000000000 Z
11
+ date: 2015-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-mp3info