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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3a69a46fdb054ddc2941e941cedeb321d10905f5
4
- data.tar.gz: f520929c64b43c02dfe77a9867309fa6c2509c8a
2
+ SHA256:
3
+ metadata.gz: c6ea14568b197d37a53cc1c58fa9ce4fcc2a3b1af8675e7d4b51215a2a4468b3
4
+ data.tar.gz: a458bc8467ecbbe840f2157a040b43e81809c587b02333e9192681491e4653cd
5
5
  SHA512:
6
- metadata.gz: d31938cffc53559a4ce12ccc46740dd7f8fdf7ec9d86a93263f1562926a8639ea1bea21cbb9d89418623c894ba9f906165a6d62d1234d1244204837ab23bec09
7
- data.tar.gz: 2bcd05aa59dcda4de7a0ceca2eac6907a3be7ca5a7d49b699dbe4c5ee41232010aef221cafbe37c6cc9919918aee9e1b76987f5dae473c43bcd785ab14aa9d96
6
+ metadata.gz: c6dd1c3d74e3fba531f93561f71bc1009f454577aa95e1d30de1a4d64d8d149f76cfec24c3bdc8155456f4901db2405a96853b212ea0174b713b0707946a352a
7
+ data.tar.gz: 8b3a99226769a7d8f4da165622dcb5586a66b8cf9f77070b716fa74b14f64e3fe2616644913187441822c973546cbe9bb46c3478320bcee4061b71e09336ec96
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  *.gem
2
2
  Gemfile.lock
3
+ .byebug_history
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem 'byebug'
@@ -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.length
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.length/60.0)}\n"
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.simplified.to_s
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
@@ -1,3 +1,3 @@
1
1
  module Rupeepeethree
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  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 'trollop'
4
+ require 'optimist'
5
5
 
6
6
  module Rupeepeethree
7
7
  class Cli
8
8
  def self.run(args)
9
- p = Trollop::Parser.new do
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 = Trollop::with_standard_exception_handling p do
28
- raise Trollop::HelpNeeded if ARGV.empty? # show help screen
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
 
@@ -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', '~> 0.7.0'
30
- s.add_dependency 'trollop', '~> 2.0'
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", "~> 1.3"
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 "cocaine"
36
+ s.add_development_dependency "terrapin"
38
37
 
39
38
  if s.respond_to? :specification_version then
40
39
  s.specification_version = 3
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.should match(image_string)
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.should_not match(/#{image_string}{2}/)
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.should match(/title: \n/)
42
- result.should match(/artist: \n/)
43
- result.should match(/album: \n/)
44
- result.should match(/year: 0\n/)
45
- result.should_not match(/image:/)
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
@@ -1,5 +1,5 @@
1
1
  require "rupeepeethree"
2
- require "cocaine"
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 = Cocaine::CommandLine.new(@rp3, "-c :mp3")
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 = Cocaine::CommandLine.new(@rp3, "-t :title :mp3")
14
+ line = Terrapin::CommandLine.new(@rp3, "-t :title :mp3")
15
15
  result = line.run(title: "foodfight", mp3: "spec/fixtures/test.mp3")
16
- result.should match(/foodfight/)
16
+ expect(result).to match(/foodfight/)
17
17
  end
18
18
  it "sets an artist tag" do
19
- line = Cocaine::CommandLine.new(@rp3, "-a :artist :mp3")
19
+ line = Terrapin::CommandLine.new(@rp3, "-a :artist :mp3")
20
20
  result = line.run(artist: "ninjaturtle", mp3: "spec/fixtures/test.mp3")
21
- result.should match(/ninjaturtle/)
21
+ expect(result).to match(/ninjaturtle/)
22
22
  end
23
23
  it "sets an album tag" do
24
- line = Cocaine::CommandLine.new(@rp3, "-A :album :mp3")
24
+ line = Terrapin::CommandLine.new(@rp3, "-A :album :mp3")
25
25
  result = line.run(album: "purplerain", mp3: "spec/fixtures/test.mp3")
26
- result.should match(/purplerain/)
26
+ expect(result).to match(/purplerain/)
27
27
  end
28
28
  it "sets a year tag" do
29
- line = Cocaine::CommandLine.new(@rp3, "-Y :year :mp3")
29
+ line = Terrapin::CommandLine.new(@rp3, "-Y :year :mp3")
30
30
  result = line.run(year: "1987", mp3: "spec/fixtures/test.mp3")
31
- result.should match(/1987/)
31
+ expect(result).to match(/1987/)
32
32
  end
33
33
  it "sets album art tag" do
34
- line = Cocaine::CommandLine.new(@rp3, "-p :pic :mp3")
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.should match(/image\/jpeg/)
37
- result.should match(/59562 bytes/)
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 = Cocaine::CommandLine.new(@rp3, "-n :num :mp3")
40
+ line = Terrapin::CommandLine.new(@rp3, "-n :num :mp3")
41
41
  result = line.run(num: "3", mp3: "spec/fixtures/test.mp3")
42
- result.should match(/track number: 3/)
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.6
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: 0.7.0
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: 0.7.0
26
+ version: '1.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: trollop
28
+ name: optimist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
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: '2.0'
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: '1.3'
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: '1.3'
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: cocaine
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
- rubyforge_project: rupeepeethree
202
- rubygems_version: 2.5.1
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: