musk 0.0.4 → 0.0.5

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: de4f097d74a73c706373689095573eede025a309
4
- data.tar.gz: 3dfe5fff8e66130a94c826d582456159e75ee8ce
3
+ metadata.gz: c48bd0abea6550bac7abce80fefe2fc03352273d
4
+ data.tar.gz: 1cf2a874737ff755d2e6763f5397fd64152ce2cc
5
5
  SHA512:
6
- metadata.gz: 8fbef5b662def26e868f5b81032e90606f3b014a2dcc448b5086f46c014b83b94151b0d8e6da214c04a2348d3a5a4a4016b922f994fb5848eb595e2c4d52d340
7
- data.tar.gz: 034fb77607002b90a4c8bf10c36a704e0a7bf85762ef37c5019ad2bc077d552b53e50ab337b3a86c95c4ee39e8405839909347c96189271056bc7f70031d7de9
6
+ metadata.gz: 9a48cca700249f4f7ff71394942abefed2b3e5dbce2f45f1da6812ace1f0eb14b8c53e51b901a00adbe4eb8d1505d46121901a82d7f4beb02b46e8612a787665
7
+ data.tar.gz: 9aa0bf6b59e6f9a39ea0f41f68bf7be53209dff9a61c72600d823418e49d6fe33908a67e656002af6070205ebd9ab772023b5ca9e9a4ed130714031b44676cdb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- musk (0.0.4)
4
+ musk (0.0.5)
5
5
  gli (~> 2.9)
6
6
  taglib-ruby (~> 0.6)
7
7
 
data/LICENSE CHANGED
@@ -1,6 +1,4 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2014
1
+ Copyright (c) 2014 Eugene Pempel
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
19
+ SOFTWARE.
data/README.md CHANGED
@@ -1,2 +1,98 @@
1
- musk
2
- ====
1
+ ## Musk
2
+
3
+ Use musk to impart the demonic scent of musk to your music.
4
+ Musk allows you to extract tags from MP3 files and perfume MP3 files
5
+ with fragrant tags.
6
+
7
+ ## Installation
8
+
9
+ Manually from RubyGems.org:
10
+
11
+ gem install musk
12
+
13
+ ## Command Reference
14
+
15
+ Like `git`, the `musk` command delegates to subcommands based on its
16
+ first argument. The most common subcommands are:
17
+
18
+ ### musk extract
19
+
20
+ To extract tags from an MP3 file, run `musk extract` with the path to
21
+ the MP3 file. For example,
22
+
23
+ musk extract ~/tracks/bonobo/jets.mp3
24
+
25
+ Path: jets.mp3
26
+ Title: Jets
27
+ Position: 6/13
28
+ Artist: Bonobo
29
+ Release: The North Borders
30
+ Genre: Electronic
31
+ Year: 2013
32
+ Comment: -
33
+
34
+ To extract tags from MP3 files in a directory and its subdirectories,
35
+ run `musk extract` with the path to the directory. For example,
36
+
37
+ musk extract ~/tracks
38
+
39
+ Path: bonobo/jets.mp3
40
+ Title: Jets
41
+ Position: 6/13
42
+ Artist: Bonobo
43
+ Release: The North Borders
44
+ Genre: Electronic
45
+ Year: 2013
46
+ Comment: -
47
+
48
+ Path: emancipator/kamakura.mp3
49
+ Title: Kamakura
50
+ Position: 4/14
51
+ Artist: Emancipator
52
+ Release: Safe In The Steep Cliffs
53
+ Genre: Electronic
54
+ Year: 2010
55
+ Comment: -
56
+
57
+ To see the output in the csv format, run `musk extract --format csv`.
58
+ For example,
59
+
60
+ musk extract --format csv ~/tracks
61
+
62
+ bonobo/jets.mp3,Jets,6/13,Bonobo,The North Borders,Electronic,2013,-
63
+ emancipator/kamakura.mp3,Kamakura,4/14,Emancipator,Safe In The Steep Cliffs,Electronic,2010,-
64
+
65
+ The `--format csv` option prints MP3 tags in the following order:
66
+ path, title, position, artist, release, genre, year, comment.
67
+
68
+ The `--format csv` option allows you to effectively combine
69
+ several commands together. For example,
70
+
71
+ musk extract --format csv ~/tracks | cut -d',' -f2
72
+
73
+ Jets
74
+ Kamakura
75
+
76
+ ## License
77
+
78
+ (The MIT license)
79
+
80
+ Copyright (c) 2014 Eugene Pempel
81
+
82
+ Permission is hereby granted, free of charge, to any person obtaining a copy
83
+ of this software and associated documentation files (the "Software"), to deal
84
+ in the Software without restriction, including without limitation the rights
85
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
+ copies of the Software, and to permit persons to whom the Software is
87
+ furnished to do so, subject to the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be included in all
90
+ copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
+ SOFTWARE.
data/bin/musk CHANGED
@@ -5,7 +5,9 @@ require "musk"
5
5
 
6
6
  extend GLI::App
7
7
 
8
- desc "Extract meta-data (tags) from MP3 files"
8
+ program_desc "Extract tags from MP3 files and perfume MP3 files with fragrant tags."
9
+
10
+ desc "Extract tags from MP3 files"
9
11
  arg_name "path_to_files"
10
12
  command :extract do |command|
11
13
  command.arg_name "csv|pretty"
@@ -19,7 +19,7 @@ module Musk
19
19
  end
20
20
  end
21
21
 
22
- [:title, :artist, :album, :genre].each do |method|
22
+ [:title, :artist, :release, :genre].each do |method|
23
23
  define_method(method) do
24
24
  @track.send(method) or "-"
25
25
  end
@@ -6,7 +6,7 @@ module Musk
6
6
  :title,
7
7
  :position,
8
8
  :artist,
9
- :album,
9
+ :release,
10
10
  :genre,
11
11
  :year,
12
12
  :comment,
@@ -6,7 +6,7 @@ module Musk
6
6
  :title,
7
7
  :position,
8
8
  :artist,
9
- :album,
9
+ :release,
10
10
  :genre,
11
11
  :year,
12
12
  :comment,
@@ -14,9 +14,9 @@ module Musk
14
14
 
15
15
  def self.print(tracks)
16
16
  tracks.each_with_index do |track, index|
17
+ track = Musk::Decorator::PrintableTrack.new(track)
17
18
  puts if index > 0
18
19
  ATTRIBUTES.map do |attribute|
19
- track = Musk::Decorator::PrintableTrack.new(track)
20
20
  printf("%-10s%s\n", "#{attribute.capitalize}:", track.send(attribute))
21
21
  end
22
22
  end
data/lib/musk/track.rb CHANGED
@@ -7,7 +7,7 @@ module Musk
7
7
  :position_number,
8
8
  :positions_count,
9
9
  :artist,
10
- :album,
10
+ :release,
11
11
  :genre,
12
12
  :year,
13
13
  :comment,
@@ -15,7 +15,7 @@ module Musk
15
15
  end
16
16
  end
17
17
  path = File.expand_path(path)
18
- loadpath = File.file?(path) ? File.dirname(path) : path
18
+ loadpath = "#{File.file?(path) ? File.dirname(path) : path}#{File::SEPARATOR}"
19
19
  deeppath = File.file?(path) ? path : File.join(path, "**", "*.mp3")
20
20
  Dir[deeppath].map do |fullpath|
21
21
  track = Musk::Track.new
@@ -30,7 +30,7 @@ module Musk
30
30
  end
31
31
  track.title = tag.title
32
32
  track.artist = tag.artist
33
- track.album = tag.album
33
+ track.release = tag.album
34
34
  track.genre = tag.genre
35
35
  track.year = tag.year
36
36
  track.comment = tag.comment
data/lib/musk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Musk
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/musk.gemspec CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.name = "musk"
7
7
  s.author = "Eugene Pempel"
8
8
  s.email = "eugene.pempel@gmail.com"
9
- s.summary = "Your music with the demonic scent of musk"
10
- s.description = "Your music with the demonic scent of musk."
9
+ s.summary = "Yet another MP3 tagging tool."
10
+ s.description = "Extract tags from MP3 files and perfume MP3 files with fragrant tags."
11
11
  s.homepage = "https://github.com/pempel/musk"
12
12
  s.license = "MIT"
13
13
  s.version = Musk::VERSION
@@ -35,7 +35,7 @@ describe Musk::Decorator::PrintableTrack do
35
35
  it_should_behave_like "the track decorator with nullable attributes", [
36
36
  :title,
37
37
  :artist,
38
- :album,
38
+ :release,
39
39
  :genre,
40
40
  ]
41
41
  end
@@ -2,26 +2,23 @@ require "spec_helper"
2
2
 
3
3
  describe Musk::Formatter::CSV do
4
4
  describe ".print(tracks)" do
5
- let(:tracks) do
6
- [build(:jets_track), build(:kamakura_track)]
7
- end
8
-
9
- let(:printable_tracks) do
10
- tracks.map {|t| Musk::Decorator::PrintableTrack.new(t)}
11
- end
12
-
13
- let(:attributes) do
14
- [:path, :title, :position, :artist, :album, :genre, :year, :comment]
15
- end
16
-
5
+ let(:tracks) {[build(:jets_track), build(:kamakura_track)]}
17
6
  let(:stdout) do
7
+ printable_tracks = tracks.map {|t| Musk::Decorator::PrintableTrack.new(t)}
18
8
  printable_tracks.map do |track|
19
- attributes.map {|a| track.send(a)}.join(",").concat("\n")
9
+ "#{track.path},"\
10
+ "#{track.title},"\
11
+ "#{track.position},"\
12
+ "#{track.artist},"\
13
+ "#{track.release},"\
14
+ "#{track.genre},"\
15
+ "#{track.year},"\
16
+ "#{track.comment}\n"
20
17
  end.join
21
18
  end
22
19
 
23
20
  it "should print tracks to STDOUT in the csv format" do
24
- capture_stdout { described_class.print(tracks) }.should eq(stdout)
21
+ capture_stdout {described_class.print(tracks)}.should eq(stdout)
25
22
  end
26
23
  end
27
24
  end
@@ -2,29 +2,23 @@ require "spec_helper"
2
2
 
3
3
  describe Musk::Formatter::Pretty do
4
4
  describe ".print(tracks)" do
5
- let(:tracks) do
6
- [build(:jets_track), build(:kamakura_track)]
7
- end
8
-
9
- let(:printable_tracks) do
10
- tracks.map {|t| Musk::Decorator::PrintableTrack.new(t)}
11
- end
12
-
5
+ let(:tracks) {[build(:jets_track), build(:kamakura_track)]}
13
6
  let(:stdout) do
7
+ printable_tracks = tracks.map {|t| Musk::Decorator::PrintableTrack.new(t)}
14
8
  printable_tracks.map do |track|
15
9
  "Path: #{track.path}\n"\
16
10
  "Title: #{track.title}\n"\
17
11
  "Position: #{track.position}\n"\
18
12
  "Artist: #{track.artist}\n"\
19
- "Album: #{track.album}\n"\
13
+ "Release: #{track.release}\n"\
20
14
  "Genre: #{track.genre}\n"\
21
15
  "Year: #{track.year}\n"\
22
- "Comment: -\n"
16
+ "Comment: #{track.comment}\n"
23
17
  end.join("\n")
24
18
  end
25
19
 
26
20
  it "should print tracks to STDOUT in the pretty format" do
27
- capture_stdout { described_class.print(tracks) }.should eq(stdout)
21
+ capture_stdout {described_class.print(tracks)}.should eq(stdout)
28
22
  end
29
23
  end
30
24
  end
@@ -18,7 +18,7 @@ describe Musk::TrackLoader do
18
18
 
19
19
  context "when path is a nonexistent directory" do
20
20
  it "should raise \"Unknown path '{path}' to a file or files\"" do
21
- path = File.join(ENV["MUSK_TRACKS_PATH"], "/nonexistent")
21
+ path = File.join(ENV["MUSK_TRACKS_PATH"], "nonexistent")
22
22
  error = "Unknown path '#{path}' to a file or files"
23
23
  expect { described_class.load!(path) }.to raise_error(error)
24
24
  end
@@ -26,8 +26,9 @@ describe Musk::TrackLoader do
26
26
 
27
27
  context "when path is an exisiting directory" do
28
28
  it "should create tracks from files in the directory and its subdirectories" do
29
- loadpath = ENV["MUSK_TRACKS_PATH"]
30
- described_class.load!(loadpath).should be_tracks([
29
+ path = ENV["MUSK_TRACKS_PATH"]
30
+ loadpath = "#{path}#{File::SEPARATOR}"
31
+ described_class.load!(path).should be_tracks([
31
32
  build(:jets_track, :loaded, loadpath: loadpath),
32
33
  build(:kamakura_track, :loaded, loadpath: loadpath),
33
34
  ])
@@ -36,7 +37,7 @@ describe Musk::TrackLoader do
36
37
 
37
38
  context "when path is a nonexistent file" do
38
39
  it "should raise \"Unknown path '{path}' to a file or files\"" do
39
- path = File.join(ENV["MUSK_TRACKS_PATH"], "/nonexistent.mp3")
40
+ path = File.join(ENV["MUSK_TRACKS_PATH"], "nonexistent.mp3")
40
41
  error = "Unknown path '#{path}' to a file or files"
41
42
  expect { described_class.load!(path) }.to raise_error(error)
42
43
  end
@@ -44,7 +45,7 @@ describe Musk::TrackLoader do
44
45
 
45
46
  context "when path is an existing file that is unsupported" do
46
47
  it "should raise \"Unknown extension '{extension}'\"" do
47
- path = File.join(ENV["MUSK_TRACKS_PATH"], "/track.bad")
48
+ path = File.join(ENV["MUSK_TRACKS_PATH"], "track.bad")
48
49
  error = "Unknown extension '.bad'"
49
50
  allow(File).to receive(:file?).with(path).and_return(true)
50
51
  expect { described_class.load!(path) }.to raise_error(error)
@@ -53,9 +54,10 @@ describe Musk::TrackLoader do
53
54
 
54
55
  context "when path is an existing file that is supported" do
55
56
  it "should create a track from the file" do
56
- loadpath = File.join(ENV["MUSK_TRACKS_PATH"], "/bonobo")
57
+ path = File.join(ENV["MUSK_TRACKS_PATH"], "bonobo", "jets.mp3")
58
+ loadpath = "#{File.dirname(path)}#{File::SEPARATOR}"
57
59
  track = build(:jets_track, :loaded, loadpath: loadpath)
58
- described_class.load!(loadpath).should be_tracks([track])
60
+ described_class.load!(path).should be_tracks([track])
59
61
  end
60
62
  end
61
63
  end
@@ -13,8 +13,8 @@ describe Musk::Track do
13
13
  it { should respond_to(:positions_count=) }
14
14
  it { should respond_to(:artist) }
15
15
  it { should respond_to(:artist=) }
16
- it { should respond_to(:album) }
17
- it { should respond_to(:album=) }
16
+ it { should respond_to(:release) }
17
+ it { should respond_to(:release=) }
18
18
  it { should respond_to(:genre) }
19
19
  it { should respond_to(:genre=) }
20
20
  it { should respond_to(:year) }
@@ -9,7 +9,7 @@ FactoryGirl.define do
9
9
  position_number 6
10
10
  positions_count 13
11
11
  artist "Bonobo"
12
- album "The North Borders"
12
+ release "The North Borders"
13
13
  genre "Electronic"
14
14
  year 2013
15
15
 
@@ -25,7 +25,7 @@ FactoryGirl.define do
25
25
  position_number 4
26
26
  positions_count 14
27
27
  artist "Emancipator"
28
- album "Safe In The Steep Cliffs"
28
+ release "Safe In The Steep Cliffs"
29
29
  genre "Electronic"
30
30
  year 2010
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Pempel
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.8'
125
- description: Your music with the demonic scent of musk.
125
+ description: Extract tags from MP3 files and perfume MP3 files with fragrant tags.
126
126
  email: eugene.pempel@gmail.com
127
127
  executables:
128
128
  - musk
@@ -185,7 +185,7 @@ rubyforge_project:
185
185
  rubygems_version: 2.2.2
186
186
  signing_key:
187
187
  specification_version: 4
188
- summary: Your music with the demonic scent of musk
188
+ summary: Yet another MP3 tagging tool.
189
189
  test_files:
190
190
  - spec/bin/musk_spec.rb
191
191
  - spec/lib/musk/decorator/printable_track_spec.rb