got_mp3 0.2.0 → 0.2.1

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: 94d8fc924be742f45265ce5ced2836859ad920e2813294107861e9530ce00ab0
4
- data.tar.gz: c60a80063c720c5a97a6cd0dc994688e9c6227c462c4bd857dc51307af2143c4
3
+ metadata.gz: 2ec37a296a75bda0bea9d2ce9b7b40534fa6425e7cddfc29d1002cd067f5cddb
4
+ data.tar.gz: de3b11e29c23e10f1a920f96e82e40c2073de1ff1d25b32761f2e92cdc2dafd3
5
5
  SHA512:
6
- metadata.gz: dc555a1313236f60e25892afbee007b6a2953b35c7a7c36ceeb0acf36865315b181a70d748c243b3c7385e2d5bb547a36742884465877bfc3796bd16a11b00af
7
- data.tar.gz: e07d01081c5002073e8f147559cc19022ce326d438698808d004eaff62bd35c1095139e3ccd0a91971caeade73993b6f5505ed967561458e3d660fed2edc0f86
6
+ metadata.gz: 6cc885998b65f09146163ef5d68ed3c261a3046ecea177b4b61d2ae64827784a9bf7924bd0d14f6209ede86631e693a31d23aaebcd938b2010bff68f5bc14901
7
+ data.tar.gz: b92b911b2d1f4696a21df1800b4c9047e8ca6e03f8cbac8df6a066c9f399b3ba8a4ffe87870b151d2d09018d3cb72bc625a86bfae75b5464bf3974f0d1da2150
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/got_mp3.rb CHANGED
@@ -22,6 +22,8 @@ class GotMP3
22
22
  def add_jpg()
23
23
 
24
24
  find_by_ext('.jpg').each do |directory, img_filename|
25
+
26
+ puts 'add_jpg to directory: ' + directory.inspect if @debug
25
27
  add_image directory, img_filename
26
28
  end
27
29
 
@@ -43,8 +45,15 @@ class GotMP3
43
45
 
44
46
  def each_mp3_file(directory='.', &blk)
45
47
 
48
+ puts 'each_mp3 - directory: ' + directory.inspect if @debug
46
49
  found = Dir[File.join(directory, "*.mp3")].sort_by { |x| File.mtime(x) }
47
- found.each.with_index do |mp3_filepath, i|
50
+ puts 'each_mp3 - found: ' + found.inspect if @debug
51
+
52
+ found.reverse.each.with_index do |mp3_filepath, i|
53
+
54
+ puts 'each_mp3 - mp3_filepath: ' + mp3_filepath.inspect if @debug
55
+
56
+ next unless File.exists? mp3_filepath
48
57
 
49
58
  blk.call(mp3_filepath, i )
50
59
 
@@ -60,6 +69,7 @@ class GotMP3
60
69
 
61
70
  # find the image file
62
71
  img_filename = Dir[File.join(directory, '*.jpg')].first
72
+ puts 'img_filename: ' + img_filename.inspect if @debug
63
73
 
64
74
  # find the text file
65
75
  txt_filename = Dir[File.join(directory, '*.txt')].first
@@ -93,8 +103,15 @@ class GotMP3
93
103
 
94
104
  def write_titles()
95
105
 
106
+ puts 'inside write_titles()' if @debug
107
+
96
108
  find_by_ext('.mp3').each do |directory, _ |
97
109
 
110
+ puts 'write_titles() - directory: ' + directory.inspect if @debug
111
+ txt_filename = Dir[File.join(directory, '*.txt')].first
112
+
113
+ next if txt_filename
114
+
98
115
  tracks = []
99
116
 
100
117
  each_mp3_track(directory) do |mp3, trackno, mp3_filepath|
@@ -139,6 +156,7 @@ class GotMP3
139
156
  #
140
157
  def add_image(directory, img_filename)
141
158
 
159
+ puts 'inside add_image - directory: ' + directory.inspect if @debug
142
160
  puts 'img_filename: ' + img_filename.inspect if @debug
143
161
  image_file = File.new(File.join(directory, img_filename),'rb')
144
162
  img = image_file.read
@@ -199,7 +217,7 @@ class GotMP3
199
217
 
200
218
  def each_mp3_track(directory, &blk)
201
219
 
202
- each_mp3_file do |mp3_filepath, i|
220
+ each_mp3_file(directory) do |mp3_filepath, i|
203
221
 
204
222
  Mp3Info.open(mp3_filepath) {|mp3| blk.call(mp3, i+1, mp3_filepath) }
205
223
 
@@ -209,6 +227,7 @@ class GotMP3
209
227
 
210
228
  def find_by_ext(extension)
211
229
 
230
+ puts 'find_by_ext() - @dir' + @dir.inspect if @debug
212
231
  a = Dir[File.join(@dir, "**", "*" + extension)]
213
232
  puts 'a: ' + a.inspect if @debug
214
233
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: got_mp3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  RFrZsrDO1Cwk4v03qCUvuZ8H/nCojYYJGMrJE1JhBBJNJXCAULivh/zlOYcDhG69
36
36
  uPtZOD7YKrG45OftX8aNxlNv
37
37
  -----END CERTIFICATE-----
38
- date: 2021-11-25 00:00:00.000000000 Z
38
+ date: 2021-11-26 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ruby-mp3info
@@ -88,5 +88,5 @@ rubygems_version: 2.7.10
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: A ruby-mp3info wrapper to make it convenient to update the album art and
91
- track titles of multiple MP3 files as a batch process.
91
+ track titles of multiple MP3 files in a batch process.
92
92
  test_files: []
metadata.gz.sig CHANGED
Binary file