unitf-tag 0.1.9 → 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: 3349c41222239a0d71175ea75b37345f768376f08d7b6621f5b28afc599804b9
4
- data.tar.gz: 57ee77221f0b63bc6238d889fe2cf5b6c1de899a02f082b6443c49ccbfe5d1de
3
+ metadata.gz: 3cd6b6ef13a18bcf331971fcb6c93f5d3f093954e4f5881e864e794eef19ea84
4
+ data.tar.gz: baab06a10e951d55341521b3bcadfdf7737ae94e34f6fa625e67df2eb5a73f6f
5
5
  SHA512:
6
- metadata.gz: 8aa4cc77d47945d7b8a5b53f2e5d979038ae2279e82f7cb4a31482f9f8e7205aab31249f17c8bccb30a6b260a3406c849059b56c399210eae22d61683eae0fe1
7
- data.tar.gz: c6fd219e909d0baaa167902e7032109af3f164c522ed113c1c5fa109572342339b3efcf6549cc7133f9ec39c3a2764966b8350b1ef554a23f361dc14827d862d
6
+ metadata.gz: 1883d756f5ec860097a4335e432855f12370c7dbce7a3f6c7b1ab3f3cf59cc51189235ca0c475719c1dafac2961d3c7cdf8388539323289c3842fdbf4869e6b4
7
+ data.tar.gz: e909cca15e818791efa99c7c52bfd4689a1a8aa891c63d787a92fd653b2896d4c526d9340fd0fbc539dd7f6cbb0d345d2150e61243c196b3dfd8cebd572bd87d
data/bin/test.rb CHANGED
@@ -4,7 +4,8 @@ require 'unitf/tag'
4
4
 
5
5
  UnitF::Log.to_console
6
6
 
7
- UnitF::Tag::File.update('/Users/mbaron/tmp/foo.mp3') do |tag|
8
- tag.artist = 'bar123'
9
- tag.year = 1972
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!
10
11
  end
@@ -11,20 +11,6 @@ module UnitF
11
11
  super(::File.absolute_path(file_path.to_s))
12
12
  end
13
13
 
14
- def update
15
- open do |file|
16
- yield file.tag
17
- file.save || (raise UnitF::Tag::Error, "Failed to save file #{@file}")
18
- end
19
- end
20
-
21
- def self.update(file_path)
22
- UnitF::Tag::File.new(file_path).open do |file|
23
- yield file.tag
24
- file.save || (raise UnitF::Tag::Error, "Failed to save file #{file_path}")
25
- end
26
- end
27
-
28
14
  def tag
29
15
  @file.tag
30
16
  end
@@ -88,7 +74,7 @@ module UnitF
88
74
  end
89
75
 
90
76
  def auto_cover!
91
- cover!(cover_path)
77
+ cover!(cover_path) if cover_available?
92
78
  end
93
79
 
94
80
  def manual_auto_tags
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Unitf
4
4
  module Tag
5
- VERSION = "0.1.9"
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.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Baron