got_mp3 0.1.1 → 0.1.2
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 +4 -4
- checksums.yaml.gz.sig +2 -4
- data/lib/got_mp3.rb +30 -10
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03c18932de3d7bcf55555f98c7b4fc677ac64b2262e63330c3629c4bca334d60
|
|
4
|
+
data.tar.gz: 595b8aaaa06da6d1f61fefa3605f8ea446952c26e0022f1607d07ad2d2d494e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29561bc4eacd3a9a17149260c2bb4a1cf504894b09468e8eac7e99ce5a5f94cacf87bbdcd7b12d7017d5e19a157457894c4cb72b31f7cbce778a1e5276dff55f
|
|
7
|
+
data.tar.gz: 745f2418ed072cb0b22e74934d996e62daca4b726f90bed3ed7af2d8b528c6bdc3524019b49291b187b039e73cbe4014b5c509f1b9175a7ceba4e0b21bcd3ec2
|
checksums.yaml.gz.sig
CHANGED
data/lib/got_mp3.rb
CHANGED
|
@@ -40,8 +40,24 @@ class GotMP3
|
|
|
40
40
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
#
|
|
44
|
-
#
|
|
43
|
+
# Adds the album art, track title, and renames the MP3 file
|
|
44
|
+
#
|
|
45
|
+
def go()
|
|
46
|
+
|
|
47
|
+
find_by_ext('.mp3').each do |directory, _ |
|
|
48
|
+
|
|
49
|
+
# find the image file
|
|
50
|
+
img_filename = Dir[File.join(directory, '*.jpg')].first
|
|
51
|
+
|
|
52
|
+
# find the text file
|
|
53
|
+
txt_filename = Dir[File.join(directory, '*.txt')].first
|
|
54
|
+
next unless txt_filename
|
|
55
|
+
|
|
56
|
+
add_image_and_titles(directory, img_filename, txt_filename)
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
45
61
|
|
|
46
62
|
private
|
|
47
63
|
|
|
@@ -73,25 +89,29 @@ class GotMP3
|
|
|
73
89
|
end
|
|
74
90
|
end
|
|
75
91
|
|
|
76
|
-
def add_image_and_titles(directory,
|
|
92
|
+
def add_image_and_titles(directory, img_file, txt_file)
|
|
77
93
|
|
|
78
|
-
|
|
79
|
-
|
|
94
|
+
if img_file then
|
|
95
|
+
img = File.new(img_file,'rb').read
|
|
96
|
+
end
|
|
80
97
|
|
|
81
|
-
txt_file = File.join(directory, txt_filename)
|
|
82
98
|
track_titles = File.read(txt_file).lines[1..-1].map(&:strip)
|
|
83
99
|
|
|
84
100
|
found = Dir[File.join(directory, "*.mp3")].sort_by { |x| File.mtime(x) }
|
|
85
101
|
found.each.with_index do |mp3_filepath, i|
|
|
86
102
|
|
|
87
103
|
Mp3Info.open(mp3_filepath) do |mp3|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
|
|
105
|
+
if img_file then
|
|
106
|
+
mp3.tag2.remove_pictures
|
|
107
|
+
mp3.tag2.add_picture img
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
mp3.tag.title = track_titles[i]
|
|
91
111
|
end
|
|
92
112
|
|
|
93
113
|
File.rename(mp3_filepath, File.join(directory,
|
|
94
|
-
track_titles[i][/^[^\/]+/].gsub(
|
|
114
|
+
track_titles[i][/^[^\/]+/].gsub(/:/,'_').rstrip + '.mp3'))
|
|
95
115
|
end
|
|
96
116
|
|
|
97
117
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
�F2���)x70�#SO�Ze��}#�\i��a|��*�*`.-�Jo'�%��ގ֕�f��`ZU1��5��������9\��Z�) ^sYJ�(�|���� �AX9���B|��kVWic�^�Q!����.=�X��O��GC�f�"xx��S`�L�2�s�Y�����l6vձ{z0MZ*�:��3i�Kw���7��
|
|
2
|
+
��%�F;܁�g��_�� ��t�d�-�x�\
|