unitf-tag 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68404fe4f09503662b8fa2f52479ce65d14f5c9eea0d6928e99a10599c468be8
4
- data.tar.gz: 398a8ea66bcfa0dcc33d3fafb1e51f6fcd305c4377644df6a3d5ad94f3786647
3
+ metadata.gz: 3cd6b6ef13a18bcf331971fcb6c93f5d3f093954e4f5881e864e794eef19ea84
4
+ data.tar.gz: baab06a10e951d55341521b3bcadfdf7737ae94e34f6fa625e67df2eb5a73f6f
5
5
  SHA512:
6
- metadata.gz: 94f7d7c34b182095ea849846ebbb811e2f964d50d74aff54a8e9648193b366ada30028216440f53a96ce3b7133a4d40e9cdf2ee565479df5b07a15958b174a0b
7
- data.tar.gz: 0475211c72702358a985acece10e4af18ac3f36c2d3869807f329a03391d80b16e64968d2aa852b4c55a70776c3ec149aec091fd7336cf77ae076858617fe04c
6
+ metadata.gz: 1883d756f5ec860097a4335e432855f12370c7dbce7a3f6c7b1ab3f3cf59cc51189235ca0c475719c1dafac2961d3c7cdf8388539323289c3842fdbf4869e6b4
7
+ data.tar.gz: e909cca15e818791efa99c7c52bfd4689a1a8aa891c63d787a92fd653b2896d4c526d9340fd0fbc539dd7f6cbb0d345d2150e61243c196b3dfd8cebd572bd87d
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  Gemfile.lock
10
+ *.gem
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
data/bin/test.rb CHANGED
@@ -4,7 +4,8 @@ require 'unitf/tag'
4
4
 
5
5
  UnitF::Log.to_console
6
6
 
7
- file = UnitF::Tag::File.new('/Users/mbaron/tmp/WFMU/BJ/bj211119.mp3')
8
- file.open do |o|
9
- puts o.auto_tags
10
- end
7
+ UnitF::Tag.update('/Users/mbaron/tmp/foo.mp3') do |file|
8
+ file.tag.artist = 'bar123'
9
+ file.tag.year = 1972
10
+ file.auto_cover!
11
+ end
@@ -74,7 +74,7 @@ module UnitF
74
74
  end
75
75
 
76
76
  def auto_cover!
77
- cover!(cover_path)
77
+ cover!(cover_path) if cover_available?
78
78
  end
79
79
 
80
80
  def manual_auto_tags
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Unitf
4
4
  module Tag
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.10"
6
6
  end
7
7
  end
data/lib/unitf/tag.rb CHANGED
@@ -21,6 +21,13 @@ module UnitF
21
21
  @logger
22
22
  end
23
23
 
24
+ def self.update(file_path)
25
+ UnitF::Tag::File.new(file_path).open do |file|
26
+ yield file
27
+ file.save || (raise UnitF::Tag::Error, "Failed to save file #{file_path}")
28
+ end
29
+ end
30
+
24
31
  def self.valid_file?(file_path)
25
32
  ::File.file?(file_path) && file_path.encode.match(/\.(flac|mp3)$/i)
26
33
  rescue ArgumentError => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unitf-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Baron
@@ -67,8 +67,6 @@ files:
67
67
  - lib/unitf/tag/flac.rb
68
68
  - lib/unitf/tag/mp3.rb
69
69
  - lib/unitf/tag/version.rb
70
- - tag
71
- - test.rb
72
70
  - unitf-tag.gemspec
73
71
  homepage: https://github.com/mattbaron/unitf-tag
74
72
  licenses:
data/tag DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/local/bin/ruby
2
-
data/test.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'find'
2
-
3
- require 'unitf/tagger'
4
-
5
- file_str = '../../tag/music/If\'n/01-Sometimes.mp3'
6
- file_str = '/Users/mbaron/tmp/foo-bar.txt'
7
-
8
- # begin
9
- # file = File.new(file_str)
10
- # rescue Errno::ENOENT => e
11
- # puts "No such file #{file_str}"
12
- # end
13
-
14
- #puts Dir.glob('/Users/mbaron/google-cloud-sdk/**/*')
15
-
16
- Find.find('../../tag/music') do |path|
17
- next unless File.file?(path)
18
- file = UnitF::Tagger::AudioFile.new(path)
19
- puts file.cover_path
20
- end