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.
Files changed (3) hide show
  1. data/README +2 -0
  2. data/lib/mp3filename.rb +10 -8
  3. metadata +1 -1
data/README CHANGED
@@ -4,9 +4,11 @@ http://www.github.com/railsfreak/mp3filename
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
+ Mp3FileName is a utility to rename all mp3 files in a directory to their title.
7
8
 
8
9
  == FEATURES/PROBLEMS:
9
10
 
11
+ % mp3filename <directory_path>
10
12
 
11
13
  == SYNOPSIS:
12
14
 
data/lib/mp3filename.rb CHANGED
@@ -10,16 +10,18 @@ class Mp3FileName
10
10
  end
11
11
 
12
12
  def change
13
- begin
14
- Dir["#{@path}/*.mp3"].each do |file|
15
- Mp3Info.open(file) do |mp3|
16
- title = mp3.tag.title.strip
17
- title.empty? ? file.gsub!(/^\d*_*/,'') : FileUtils.mv("#{file}", "#{title}.mp3")
18
- puts "Title changed to : #{title == file ? file : title}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mp3filename
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: