rupeepeethree 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/Gemfile +2 -0
- data/lib/rupeepeethree/tagger.rb +11 -4
- data/lib/rupeepeethree/version.rb +1 -1
- data/lib/rupeepeethree.rb +4 -4
- data/rupeepeethree.gemspec +4 -5
- data/spec/fixtures/test.mp3 +0 -0
- data/spec/rupeepeethree/tagger_spec.rb +25 -7
- data/spec/rupeepeethree_spec.rb +15 -15
- metadata +17 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c6ea14568b197d37a53cc1c58fa9ce4fcc2a3b1af8675e7d4b51215a2a4468b3
|
4
|
+
data.tar.gz: a458bc8467ecbbe840f2157a040b43e81809c587b02333e9192681491e4653cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6dd1c3d74e3fba531f93561f71bc1009f454577aa95e1d30de1a4d64d8d149f76cfec24c3bdc8155456f4901db2405a96853b212ea0174b713b0707946a352a
|
7
|
+
data.tar.gz: 8b3a99226769a7d8f4da165622dcb5586a66b8cf9f77070b716fa74b14f64e3fe2616644913187441822c973546cbe9bb46c3478320bcee4061b71e09336ec96
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/lib/rupeepeethree/tagger.rb
CHANGED
@@ -36,7 +36,7 @@ module Rupeepeethree
|
|
36
36
|
cover.picture = File.open(image_file,"rb"){|f|f.read}
|
37
37
|
t.add_frame(cover)
|
38
38
|
end
|
39
|
-
f.save
|
39
|
+
f.save(TagLib::MPEG::File::ID3v2)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -52,7 +52,11 @@ module Rupeepeethree
|
|
52
52
|
hash[:track_number] = t.track
|
53
53
|
hash[:year] = t.year
|
54
54
|
properties = f.audio_properties
|
55
|
-
hash[:length] = properties.
|
55
|
+
hash[:length] = properties.length_in_seconds
|
56
|
+
picture = t.frame_list("APIC").first
|
57
|
+
if picture
|
58
|
+
hash[:picture] = { mime_type: picture.mime_type, data: picture.picture }
|
59
|
+
end
|
56
60
|
end
|
57
61
|
hash
|
58
62
|
end
|
@@ -86,7 +90,7 @@ module Rupeepeethree
|
|
86
90
|
result << "Bitrate: #{prop.bitrate}\n"
|
87
91
|
result << "Channels: #{prop.channels}\n"
|
88
92
|
result << "Sample Rate: #{prop.sample_rate}\n"
|
89
|
-
result << "Length: #{sprintf("%.2f", prop.
|
93
|
+
result << "Length: #{sprintf("%.2f", prop.length_in_seconds/60.0)}\n"
|
90
94
|
end
|
91
95
|
end
|
92
96
|
return result
|
@@ -94,7 +98,10 @@ module Rupeepeethree
|
|
94
98
|
|
95
99
|
private
|
96
100
|
def self.mime_type(file)
|
97
|
-
MIME::Types.type_for(file).first
|
101
|
+
mime_type = MIME::Types.type_for(file).first
|
102
|
+
if mime_type
|
103
|
+
mime_type.simplified.to_s
|
104
|
+
end
|
98
105
|
end
|
99
106
|
end
|
100
107
|
end
|
data/lib/rupeepeethree.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rupeepeethree/tagger'
|
3
3
|
require 'rupeepeethree/version'
|
4
|
-
require '
|
4
|
+
require 'optimist'
|
5
5
|
|
6
6
|
module Rupeepeethree
|
7
7
|
class Cli
|
8
8
|
def self.run(args)
|
9
|
-
p =
|
9
|
+
p = Optimist::Parser.new do
|
10
10
|
version "RP3 version #{VERSION} by Tony Miller"
|
11
11
|
banner <<-EOS
|
12
12
|
░█▀▄░█▀█░▀▀█
|
@@ -24,8 +24,8 @@ module Rupeepeethree
|
|
24
24
|
opt :clear, "clear all tags!"
|
25
25
|
end
|
26
26
|
|
27
|
-
opts =
|
28
|
-
raise
|
27
|
+
opts = Optimist::with_standard_exception_handling p do
|
28
|
+
raise Optimist::HelpNeeded if ARGV.empty? # show help screen
|
29
29
|
p.parse ARGV
|
30
30
|
end
|
31
31
|
|
data/rupeepeethree.gemspec
CHANGED
@@ -22,19 +22,18 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.licenses = ["MIT"]
|
23
23
|
s.rdoc_options = ["--main", "README.md"]
|
24
24
|
s.require_paths = ["lib"]
|
25
|
-
s.rubyforge_project = "rupeepeethree"
|
26
25
|
s.rubygems_version = "1.8.25"
|
27
26
|
s.summary = "tag your mp3 files"
|
28
27
|
|
29
|
-
s.add_dependency 'taglib-ruby', '~>
|
30
|
-
s.add_dependency '
|
28
|
+
s.add_dependency 'taglib-ruby', '~> 1.1'
|
29
|
+
s.add_dependency 'optimist'
|
31
30
|
s.add_dependency 'mime-types', '>= 1.16'
|
32
31
|
|
33
|
-
s.add_development_dependency "bundler"
|
32
|
+
s.add_development_dependency "bundler"
|
34
33
|
s.add_development_dependency "rake"
|
35
34
|
s.add_development_dependency "rspec", "~> 3.0"
|
36
35
|
s.add_development_dependency "fruity_formatter"
|
37
|
-
s.add_development_dependency "
|
36
|
+
s.add_development_dependency "terrapin"
|
38
37
|
|
39
38
|
if s.respond_to? :specification_version then
|
40
39
|
s.specification_version = 3
|
data/spec/fixtures/test.mp3
CHANGED
Binary file
|
@@ -10,11 +10,11 @@ describe Rupeepeethree::Tagger do
|
|
10
10
|
image_string = /image: \[image\/jpeg\] \[59562 bytes\]\n/
|
11
11
|
Rupeepeethree::Tagger.tag(mp3, tags)
|
12
12
|
result = Rupeepeethree::Tagger.print_tags(mp3)
|
13
|
-
result.
|
13
|
+
expect(result).to match(image_string)
|
14
14
|
|
15
15
|
Rupeepeethree::Tagger.tag(mp3, tags)
|
16
16
|
result = Rupeepeethree::Tagger.print_tags(mp3)
|
17
|
-
result.
|
17
|
+
expect(result).not_to match(/#{image_string}{2}/)
|
18
18
|
end
|
19
19
|
it "gets a hash of the tags" do
|
20
20
|
tags = {title: "foodfight",
|
@@ -28,7 +28,25 @@ describe Rupeepeethree::Tagger do
|
|
28
28
|
expect(t[:artist]).to eq("ninjaturtle")
|
29
29
|
expect(t[:album]).to eq("purplerain")
|
30
30
|
expect(t[:year]).to eq(1987)
|
31
|
+
expect(t[:picture][:mime_type]).to eq "image/jpeg"
|
31
32
|
end
|
33
|
+
|
34
|
+
it "sets field to blank" do
|
35
|
+
tags = {title: "foodfight",
|
36
|
+
artist: "ninjaturtle",
|
37
|
+
album: "purplerain",
|
38
|
+
year: "1987",
|
39
|
+
picture: "spec/fixtures/cover_art.jpg"}
|
40
|
+
Rupeepeethree::Tagger.tag(mp3, tags)
|
41
|
+
tags = {title: "",
|
42
|
+
artist: "ninjaturtle",
|
43
|
+
album: "purplerain",
|
44
|
+
year: "1987",
|
45
|
+
picture: "spec/fixtures/cover_art.jpg"}
|
46
|
+
Rupeepeethree::Tagger.tag(mp3, tags)
|
47
|
+
expect(Rupeepeethree::Tagger.tags(mp3)[:title]).to eq ""
|
48
|
+
end
|
49
|
+
|
32
50
|
it "clears the tags" do
|
33
51
|
tags = {title: "foodfight",
|
34
52
|
artist: "ninjaturtle",
|
@@ -38,11 +56,11 @@ describe Rupeepeethree::Tagger do
|
|
38
56
|
Rupeepeethree::Tagger.tag(mp3, tags)
|
39
57
|
Rupeepeethree::Tagger.clear(mp3)
|
40
58
|
result = Rupeepeethree::Tagger.print_tags(mp3)
|
41
|
-
result.
|
42
|
-
result.
|
43
|
-
result.
|
44
|
-
result.
|
45
|
-
result.
|
59
|
+
expect(result).to match(/title: \n/)
|
60
|
+
expect(result).to match(/artist: \n/)
|
61
|
+
expect(result).to match(/album: \n/)
|
62
|
+
expect(result).to match(/year: 0\n/)
|
63
|
+
expect(result).not_to match(/image:/)
|
46
64
|
end
|
47
65
|
|
48
66
|
it "returns track length" do
|
data/spec/rupeepeethree_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rupeepeethree"
|
2
|
-
require "
|
2
|
+
require "terrapin"
|
3
3
|
|
4
4
|
describe 'integration test' do
|
5
5
|
before :all do
|
@@ -7,38 +7,38 @@ describe 'integration test' do
|
|
7
7
|
end
|
8
8
|
before :each do
|
9
9
|
# clear tags
|
10
|
-
line =
|
10
|
+
line = Terrapin::CommandLine.new(@rp3, "-c :mp3")
|
11
11
|
line.run(mp3: "spec/fixtures/test.mp3")
|
12
12
|
end
|
13
13
|
it "sets a title tag" do
|
14
|
-
line =
|
14
|
+
line = Terrapin::CommandLine.new(@rp3, "-t :title :mp3")
|
15
15
|
result = line.run(title: "foodfight", mp3: "spec/fixtures/test.mp3")
|
16
|
-
result.
|
16
|
+
expect(result).to match(/foodfight/)
|
17
17
|
end
|
18
18
|
it "sets an artist tag" do
|
19
|
-
line =
|
19
|
+
line = Terrapin::CommandLine.new(@rp3, "-a :artist :mp3")
|
20
20
|
result = line.run(artist: "ninjaturtle", mp3: "spec/fixtures/test.mp3")
|
21
|
-
result.
|
21
|
+
expect(result).to match(/ninjaturtle/)
|
22
22
|
end
|
23
23
|
it "sets an album tag" do
|
24
|
-
line =
|
24
|
+
line = Terrapin::CommandLine.new(@rp3, "-A :album :mp3")
|
25
25
|
result = line.run(album: "purplerain", mp3: "spec/fixtures/test.mp3")
|
26
|
-
result.
|
26
|
+
expect(result).to match(/purplerain/)
|
27
27
|
end
|
28
28
|
it "sets a year tag" do
|
29
|
-
line =
|
29
|
+
line = Terrapin::CommandLine.new(@rp3, "-Y :year :mp3")
|
30
30
|
result = line.run(year: "1987", mp3: "spec/fixtures/test.mp3")
|
31
|
-
result.
|
31
|
+
expect(result).to match(/1987/)
|
32
32
|
end
|
33
33
|
it "sets album art tag" do
|
34
|
-
line =
|
34
|
+
line = Terrapin::CommandLine.new(@rp3, "-p :pic :mp3")
|
35
35
|
result = line.run(pic: "spec/fixtures/cover_art.jpg", mp3: "spec/fixtures/test.mp3")
|
36
|
-
result.
|
37
|
-
result.
|
36
|
+
expect(result).to match(/image\/jpeg/)
|
37
|
+
expect(result).to match(/59562 bytes/)
|
38
38
|
end
|
39
39
|
it "sets track number" do
|
40
|
-
line =
|
40
|
+
line = Terrapin::CommandLine.new(@rp3, "-n :num :mp3")
|
41
41
|
result = line.run(num: "3", mp3: "spec/fixtures/test.mp3")
|
42
|
-
result.
|
42
|
+
expect(result).to match(/track number: 3/)
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rupeepeethree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Miller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2013-03-14 00:00:00.000000000 Z
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: optimist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mime-types
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: terrapin
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -181,7 +181,7 @@ homepage: http://github.com/datafruits/rupeepeethree
|
|
181
181
|
licenses:
|
182
182
|
- MIT
|
183
183
|
metadata: {}
|
184
|
-
post_install_message:
|
184
|
+
post_install_message:
|
185
185
|
rdoc_options:
|
186
186
|
- "--main"
|
187
187
|
- README.md
|
@@ -198,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
- !ruby/object:Gem::Version
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
|
-
|
202
|
-
|
203
|
-
signing_key:
|
201
|
+
rubygems_version: 3.4.10
|
202
|
+
signing_key:
|
204
203
|
specification_version: 3
|
205
204
|
summary: tag your mp3 files
|
206
205
|
test_files:
|
@@ -208,4 +207,3 @@ test_files:
|
|
208
207
|
- spec/fixtures/test.mp3
|
209
208
|
- spec/rupeepeethree/tagger_spec.rb
|
210
209
|
- spec/rupeepeethree_spec.rb
|
211
|
-
has_rdoc:
|