got_mp3 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/got_mp3.rb +48 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c046df30aa09ee8f417c5151a511c16a55758cb324b64c9b8bb376f68b14ac
|
4
|
+
data.tar.gz: d6b18ee2753e965126a74218816625f48c36bdb09ca3b0b91b822236934f4158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b8136cf7e4e913de207514afbe0c24295e95a18131c64aa49c57a5ce8c554cb9411ac638626c840aa3a0653f01391fd7e43f5d1aabafc0c090521a7dd58cffa
|
7
|
+
data.tar.gz: db25f65976be5cccda5a2ef7a56a194ae08577c56e916fdcd368de15cc8a5b70e563e6e5792ce7179a4f70a0df1fdc5074e6bb334636257b9f6590500c15aa79
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/got_mp3.rb
CHANGED
@@ -43,6 +43,54 @@ class GotMP3
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
+
# copy all MP3 directories through the category file-directory stucture
|
47
|
+
#
|
48
|
+
def compile(source_directory: '', target_directory: '')
|
49
|
+
|
50
|
+
raise 'target_directory cannot be empty' if target_directory.empty?
|
51
|
+
|
52
|
+
find_by_ext('.txt').each do |directory, _ |
|
53
|
+
|
54
|
+
Dir[File.join(directory, '*.txt')].each do |txt_filename|
|
55
|
+
|
56
|
+
album = File.join(source_directory,
|
57
|
+
File.basename(txt_filename).sub(/\.txt$/,''))
|
58
|
+
library_dir = File.join(target_directory, File.basename(directory))
|
59
|
+
FileUtils.mkdir_p library_dir
|
60
|
+
|
61
|
+
if @debug then
|
62
|
+
puts 'copying from:' + album.inspect
|
63
|
+
puts 'copying to: ' + library_dir.inspect
|
64
|
+
end
|
65
|
+
|
66
|
+
puts 'copying ' + album + ' ...'
|
67
|
+
FileUtils.cp_r album, library_dir, remove_destination: true
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
def consolidate_txt(target_directory: '')
|
75
|
+
|
76
|
+
raise 'target_directory cannot be empty' if target_directory.empty?
|
77
|
+
|
78
|
+
find_by_ext('.mp3').each do |directory, _ |
|
79
|
+
|
80
|
+
puts 'write_titles() - directory: ' + directory.inspect if @debug
|
81
|
+
txt_filename = Dir[File.join(directory, '*.txt')].first
|
82
|
+
|
83
|
+
next unless txt_filename
|
84
|
+
|
85
|
+
target_file = File.basename(directory)
|
86
|
+
|
87
|
+
FileUtils.cp txt_filename, File.join(target_directory,
|
88
|
+
target_file + '.txt')
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
46
94
|
def each_mp3_file(directory='.', &blk)
|
47
95
|
|
48
96
|
puts 'each_mp3 - directory: ' + directory.inspect if @debug
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|