summaryrefslogtreecommitdiff
path: root/omptagger
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2007-08-14 00:19:48 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2010-10-05 21:57:29 -0700
commit72754f8d5213e1202c14d18ead53142601ae833f (patch)
tree4f38ad52d0c728b880134b40a2484d66c651c0a7 /omptagger
parent8b2c1370688bde804c673fd728c5a36b9db2206f (diff)
downloadomptagger-72754f8d5213e1202c14d18ead53142601ae833f.tar.gz
omptagger-72754f8d5213e1202c14d18ead53142601ae833f.tar.xz
Import version 0.2.2 into git history.
Diffstat (limited to 'omptagger')
-rwxr-xr-xomptagger12
1 files changed, 9 insertions, 3 deletions
diff --git a/omptagger b/omptagger
index 2d29371..71e7784 100755
--- a/omptagger
+++ b/omptagger
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
#
-# omptagger [version 0.2.1]
+# omptagger [version 0.2.2]
# http://dev.gentoo.org/~omp/omptagger/
#
# Copyright 2007 David Shakaryan <omp@gentoo.org>
@@ -244,9 +244,12 @@ class VorbisComments
# Method for generating new tags based on filename.
def generate
+ # Use only the basename of the file.
+ value = File.basename(@file)
# Substitute all underscores with a space and remove the file extension.
+ value = value.gsub('_', ' ').sub(/\.(flac|ogg)$/, '')
# Split the filename into an array with a maximum length of three elements.
- value = @file.gsub('_', ' ').sub(/\.(flac|ogg)$/, '').split(' - ', 3)
+ value = value.split(' - ', 3)
# Determine which naming format the file uses.
if value.length == 2
@@ -419,9 +422,12 @@ class ID3
# Method for generating new tags based on filename.
def generate
+ # Use only the basename of the file.
+ value = File.basename(@file)
# Substitute all underscores with a space and remove the file extension.
+ value = value.gsub('_', ' ').sub(/\.mp3$/, '')
# Split the filename into an array with a maximum length of three elements.
- value = @file.gsub('_', ' ').sub(/\.mp3$/, '').split(' - ', 3)
+ value = value.split(' - ', 3)
# Determine which naming format the file uses.
if value.length == 2