rupeepeethree 0.0.2 → 0.0.3

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: 8a450031362f3b4380a5b4eb206ef6e07e4ae00d
4
- data.tar.gz: 8428d40a564e5f8f7677db2b53511568a53c8f2f
3
+ metadata.gz: c246d6bf55b54ae1c32dc4859aa1f4c359a985e3
4
+ data.tar.gz: bcc7b3d8a968f9c6e8ab7a7bf73b2617a7c56198
5
5
  SHA512:
6
- metadata.gz: d447565e107b1f67da337362b80f7be5e0aff0a157dd5a9ba298fc767de3f4d44969c50fb9e13e2be7a5993adc83946f1487a148f40b8fedafe63371667a955a
7
- data.tar.gz: 9690d3c8af091fe809b7e27110b5128ad1d62c100fc21e17d249606e9cc3594fb9c24dcf330d9f637ef0c5df461942ab76fef733c822a29c21343cf2d5f58ca2
6
+ metadata.gz: 47f8c56abde949079168870ab8daf4c49cef89579516670825948baeb518ae1683a843eb10f165d7c23ffd0412c020c4171658566b468f065a6943922ef07dda
7
+ data.tar.gz: 332bb70f0f688daeae19d6fa18bc821592db91245232becb0ea044bccb916a6a481b0007bcf87319f1549223839562c7b4b406a6879e1314736a1cfe9df44c53
data/lib/rupeepeethree.rb CHANGED
@@ -17,6 +17,7 @@ You thought your mp3s were cool. Turns out you were wrong. Your mp3s have no tag
17
17
  opt :title, "title", type: String, short: 't'
18
18
  opt :artist, "artist", type: String, short: 'a'
19
19
  opt :year, "track year", type: String, short: 'Y'
20
+ opt :track, "track number", type: String, short: 'n'
20
21
  opt :album, "album title", type: String, short: 'A'
21
22
  opt :picture, "artwork", type: String, short: 'p'
22
23
  opt :clear, "clear all tags!"
@@ -27,15 +28,17 @@ You thought your mp3s were cool. Turns out you were wrong. Your mp3s have no tag
27
28
  p.parse ARGV
28
29
  end
29
30
 
30
- mp3 = ARGV[0]
31
- if mp3.nil?
31
+ mp3s = ARGV
32
+ if mp3s.empty?
32
33
  abort("no mp3 specified...")
33
34
  end
34
- if opts[:clear]
35
- Tagger.clear(mp3)
36
- else
37
- Tagger.tag(mp3,opts)
38
- puts Tagger.print_tags(mp3)
35
+ mp3s.each do |mp3|
36
+ if opts[:clear]
37
+ Tagger.clear(mp3)
38
+ else
39
+ Tagger.tag(mp3,opts)
40
+ puts Tagger.print_tags(mp3)
41
+ end
39
42
  end
40
43
  end
41
44
  end
@@ -17,6 +17,9 @@ class Tagger
17
17
  if tags[:year]
18
18
  t.year = tags[:year].to_i
19
19
  end
20
+ if tags[:track]
21
+ t.track = tags[:track].to_i
22
+ end
20
23
  if tags[:picture]
21
24
  image_file = File.expand_path(tags[:picture])
22
25
  # delete old frame if it exists
@@ -49,17 +52,26 @@ class Tagger
49
52
  result << "title: #{t.title}\n"
50
53
  result << "artist: #{t.artist}\n"
51
54
  result << "album: #{t.album}\n"
55
+ result << "track number: #{t.track}\n"
52
56
  result << "year: #{t.year}\n"
53
57
 
54
58
  t.frame_list('APIC').each do |cover|
55
59
  result << "image: [#{cover.mime_type}] [#{cover.picture.length} bytes]\n"
56
60
  end
61
+
62
+ prop = f.audio_properties
63
+ if prop
64
+ result << "Bitrate: #{prop.bitrate}\n"
65
+ result << "Channels: #{prop.channels}\n"
66
+ result << "Sample Rate: #{prop.sample_rate}\n"
67
+ result << "Length: #{sprintf("%.2f", prop.length/60.0)}\n"
68
+ end
57
69
  end
58
70
  return result
59
71
  end
60
72
 
61
73
  private
62
74
  def self.mime_type(file)
63
- MIME::Types.type_for(file).to_s
75
+ MIME::Types.type_for(file).first.simplified.to_s
64
76
  end
65
77
  end
@@ -1,3 +1,3 @@
1
1
  class Rupeepeethree
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
Binary file
@@ -7,7 +7,7 @@ describe Tagger do
7
7
  end
8
8
  it "edits the existing cover art frame instead of creating a new one" do
9
9
  tags = {picture: "spec/fixtures/cover_art.jpg"}
10
- image_string = /image: \[\[image\/jpeg\]\] \[59562 bytes\]\n/
10
+ image_string = /image: \[image\/jpeg\] \[59562 bytes\]\n/
11
11
  Tagger.tag(mp3, tags)
12
12
  result = Tagger.print_tags(mp3)
13
13
  result.should match(image_string)
@@ -23,17 +23,22 @@ describe Rupeepeethree do
23
23
  it "sets an album tag" do
24
24
  line = Cocaine::CommandLine.new(@rp3, "-A :album :mp3")
25
25
  result = line.run(album: "purplerain", mp3: "spec/fixtures/test.mp3")
26
- result.should match(/purplerain/)
26
+ result.should match(/purplerain/)
27
27
  end
28
28
  it "sets a year tag" do
29
29
  line = Cocaine::CommandLine.new(@rp3, "-Y :year :mp3")
30
30
  result = line.run(year: "1987", mp3: "spec/fixtures/test.mp3")
31
- result.should match(/1987/)
31
+ result.should match(/1987/)
32
32
  end
33
33
  it "sets album art tag" do
34
34
  line = Cocaine::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/)
36
+ result.should match(/image\/jpeg/)
37
37
  result.should match(/59562 bytes/)
38
38
  end
39
+ it "sets track number" do
40
+ line = Cocaine::CommandLine.new(@rp3, "-n :num :mp3")
41
+ result = line.run(num: "3", mp3: "spec/fixtures/test.mp3")
42
+ result.should match(/track number: 3/)
43
+ end
39
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rupeepeethree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Miller