mp3filename 1.0.1 → 1.0.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.
- data/README +2 -0
- data/lib/mp3filename.rb +10 -8
- metadata +1 -1
data/README
CHANGED
data/lib/mp3filename.rb
CHANGED
|
@@ -10,16 +10,18 @@ class Mp3FileName
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def change
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
Dir["#{@path}/*.mp3"].each do |file|
|
|
14
|
+
Mp3Info.open(file) do |mp3|
|
|
15
|
+
title = mp3.tag.title
|
|
16
|
+
title ||= ""
|
|
17
|
+
file_name = title.empty? ? file.gsub(/^\d*_*/,'') : "#{title}.mp3"
|
|
18
|
+
begin
|
|
19
|
+
FileUtils.mv("#{file}", file_name)
|
|
20
|
+
puts "File Name changed to : #{file_name}"
|
|
21
|
+
rescue
|
|
22
|
+
next
|
|
19
23
|
end
|
|
20
24
|
end
|
|
21
|
-
rescue
|
|
22
|
-
#raise Mp3Error, "An Unknown error has occured..."
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
end
|