number_tunes 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 61fd56598721c1f088e2c3abc757fe83ff5688ed64cb5bd3c01c587adb98befc
4
- data.tar.gz: 377d2e11b65f43f6aff83bd647756e9b92ec49eea52176dad613d1a4cb7eb99e
3
+ metadata.gz: 8b265f10bd878f4881341883ec21a2d12f2f2ae2a5a265fd28a349b9e71e6472
4
+ data.tar.gz: e1a3842510f5cdb798c4c3d041dafba74fe4ded9c3125d04be513793831932b7
5
5
  SHA512:
6
- metadata.gz: 4b74ac690ea23aa3ca55d386c6c9e045455d68c2c1664d2e68254daa89778a2e815d09e53255387cb88b7f14967e4e3861bde5b5523f6729c2d57d31f88fddac
7
- data.tar.gz: a66b7118e2aa33e460292b017143ca52bab791d7238b3bf05cf05e3853336ba65118d0180d68ea8371540fec0b4794c2f0db255b73cb56fd1e5dc1f74c10c864
6
+ metadata.gz: 78e59d36c78cd4331baf8708156deb23b9838afaeccdc77ae3dd32ce96148c3eb1b51a79f5712d4cdd5357e65d58ffc954c9225a494ee58e2890aba6331c234b
7
+ data.tar.gz: 651fbe0754b7c7b1e92c2dbeb9ba27d1900535515733904ea69c7b882d26c478e12a18bf175e87fec5e70ecdffed06412b5a79802a5f07152e0319acdf893989
@@ -12,18 +12,21 @@ Dir.glob("#{dir}/**/*.{mp3,m4a}") do |path|
12
12
  TagLib::FileRef.open(path) do |fileref|
13
13
  next if fileref.null?
14
14
  tag = fileref.tag
15
+ changed = false
15
16
  if tag.title && tag.track > 0
16
17
  prefix = format("%02d ", tag.track)
17
18
  if !tag.title.start_with?(prefix)
18
19
  tag.title = prefix + tag.title
20
+ changed = true
19
21
  end
20
22
  end
21
23
  if tag.album && tag.year > 0
22
24
  prefix = format("%04d ", tag.year)
23
25
  if !tag.album.start_with?(prefix)
24
26
  tag.album = prefix + tag.album
27
+ changed = true
25
28
  end
26
29
  end
27
- fileref.save
30
+ fileref.save if changed
28
31
  end
29
32
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "number_tunes"
3
- spec.version = "0.0.1"
3
+ spec.version = "0.0.2"
4
4
  spec.authors = ["Shugo Maeda"]
5
5
  spec.email = ["shugo@ruby-lang.org"]
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: number_tunes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-28 00:00:00.000000000 Z
11
+ date: 2020-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: taglib-ruby