/usr/bin/editcomment is in crip 3.9-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/perl
# Written to suppliment crip with a tag editor.
# Supports both .ogg and .flac files.
# Put preferred editor here
$editor = "sensible-editor";
$file = $ARGV[0];
unless (-e "$file") {
die "File \"$file\" does not exist.\n";
}
use File::Temp;
$tempdir = File::Temp::tempdir(CLEANUP => 1);;
if (-e "$file.tag.tmp") {
die "WTF is \"$file.tag.tmp\" already doing in $tempdir?!\n";
}
# Escape certain characters from $file
# code taken directly from crip actually (crip does the same
# sort of thing 3 different times in its code)
# (don't ask me why it worked above but doesn't work below without escapes)
$file =~ s/\(/\\(/g; $file =~ s/\)/\\)/g;
$file =~ s/'/\\'/g; $file =~ s/`/\\`/g;
$file =~ s/\"/\\\"/g; $file =~ s/ /\\ /g;
$file =~ s/\;/\\\;/g; $file =~ s/,/\\,/g;
$file =~ s/&/\\&/g; $file =~ s/\$/\\\$/g;
if ($file =~ m/\.ogg$/) {
# First check for vorbiscomment existence:
$out = `which vorbiscomment`;
if ($out eq "") {
die "Cannot find `vorbiscomment` for tagging the Ogg Vorbis files!\n";
}
system "vorbiscomment -l $file > $tempdir/$file.tag.tmp";
system "$editor $tempdir/$file.tag.tmp";
print "Writing new tag info...\n";
system "vorbiscomment -w -c $tempdir/$file.tag.tmp $file";
print "Done.\n";
print "Deleting temporary file $tempdir/$file.tag.tmp\n";
system "rm $tempdir/$file.tag.tmp";
print "\nTag info now reads:\n";
system "vorbiscomment -l $file";
} elsif ($file =~ m/\.flac$/) {
# First check for metaflac existence:
$out = `which metaflac`;
if ($out eq "") {
die "Cannot find `metaflac` for tagging the flac files!\n";
} else {
# metaflac exists, get its version number
$mfver = `metaflac --version`; chop $mfver;
$mfver =~ m/(\d+\..+)/; $mfver = $1;
}
if ($mfver lt "1.1.1") {
system "metaflac --export-vc-to=$tempdir/$file.tag.tmp $file";
} else {
system "metaflac --export-tags-to=$tempdir/$file.tag.tmp $file";
}
system "$editor $tempdir/$file.tag.tmp";
print "Writing new tag info...\n";
if ($mfver lt "1.1.1") {
system "metaflac --remove-vc-all --import-vc-from=$tempdir/$file.tag.tmp $file";
} else {
system "metaflac --remove-all-tags --import-tags-from=$tempdir/$file.tag.tmp $file";
}
print "Done.\n";
print "Deleting temporary file $tempdir/$file.tag.tmp\n";
system "rm $tempdir/$file.tag.tmp";
print "\nTag info now reads:\n";
if ($mfver lt "1.1.1") {
system "metaflac --export-vc-to=- $file";
} else {
system "metaflac --export-tags-to=- $file";
}
} else {
die "File \"$file\" does not have the .ogg or .flac extension.\n";
}
print "\n";
|