Added support for keeping leading 0s in metadata
This commit is contained in:
parent
7f26f287c1
commit
5dddb1f08e
|
@ -4,23 +4,29 @@
|
|||
# usage: vcfromfilename [options] <files>
|
||||
# options:
|
||||
# -n: Only set the track number
|
||||
# -0: Leading 0s in track number are preserved
|
||||
#
|
||||
# Adds Vorbiscomment data to ogg vorbis and flac files based on the filename.
|
||||
# Files should be in darkside's arbitrary file name standard, which is:
|
||||
# album/artist-tracknum-title.(ogg|flac)
|
||||
# Files should be in Patrick's arbitrary file name standard, which is:
|
||||
# artist/album/artist-tracknum-title.(ogg|flac)
|
||||
#
|
||||
# The top-level directory (artist) is optional. Filenames should contain no
|
||||
# spaces; underscores in the filename are converted to spaces in the resulting
|
||||
# metadata
|
||||
#
|
||||
# Requires vorbiscomment and metaflac
|
||||
#
|
||||
# Changelog:
|
||||
# 0.2.2: added flac support
|
||||
# 0.2.3: added documentation, -0 command-line option
|
||||
# 0.2.2: added flac support, documentation
|
||||
# 0.2.1: fixed version in help message
|
||||
# fixed handling of dashes in artist name and title
|
||||
# 0.2: aligned version with ds-audiotools
|
||||
# 0.1.1: added version variable
|
||||
# 0.1: initial implementation
|
||||
|
||||
$VERSION = "0.2.2";
|
||||
$HELP_MSG = "Vorbiscomment from Filename $VERSION\n\tusage: vcfromfilename [options] <files>\n";
|
||||
$VERSION = "0.2.3";
|
||||
$HELP_MSG = "Vorbiscomment from Filename $VERSION\n\tusage: vcfromfilename [options] <files>\n\nValid options:\n\t-n\tOnly set the track numbers\n\t-0\tPreserve leading 0s in track numbers";
|
||||
|
||||
chomp($COMMENTFILENAME = '/tmp/vcfromfilename-' . `whoami`);
|
||||
|
||||
|
@ -29,6 +35,7 @@ foreach (@ARGV)
|
|||
{
|
||||
if (/^(-h)|(--help)$/) { die $HELP_MSG; }
|
||||
if (/^-n$/) { $tracknumonly = true; s/.*//g; }
|
||||
if (/^-0$/) { $extrazero = true; s/.*//g; }
|
||||
}
|
||||
|
||||
# Set the album name
|
||||
|
@ -88,7 +95,7 @@ foreach (@ARGV)
|
|||
# Now get the track number
|
||||
my $tracknum = $_;
|
||||
$tracknum =~ s/.*-(\d{2})-.*/\1/;
|
||||
$tracknum =~ s/\b0*//; # removing leading zeros
|
||||
if (!$extrazeros) { $tracknum =~ s/\b0*//; } # removing leading zeros
|
||||
$tracknum = formatName($tracknum, 'tracknumber=');
|
||||
print COMMENTFILE $tracknum;
|
||||
|
||||
|
|
Reference in New Issue
Block a user