I want to achieve below goals:
All these operations could be based on native Node.js (without browser). Is there any module provide such function or I can develop based on?
For those coming to this question through Google, there is a node module that can do this, both read and write metadata: https://www.npmjs.org/package/ffmetadata
I don't know whether there's a way to actually do the meta data manipulation in NodeJS. This is a work around way but you could do this using child_process.exec and perl:
var exec = require('child_process').exec,
child;
child = exec('perl changeTags.pl file.mp3',
function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
#!/usr/bin/perl
use MP3::Tag;
$mp3 = MP3::Tag->new(@ARGV[0]); # create object
$mp3->get_tags(); # read tags
print "Attempting to print tags for @ARGV[0]\n";
if (exists $mp3->{ID3v2}) {
print "Comments: " . $mp3->{ID3v2}->comment . "\n";
print "Zip: " . $mp3->{ID3v2}->album . "\n";
print "Tags: " . $mp3->{ID3v2}->title . "\n";
} else {
print "@ARGV[0] does not have ID3v2 tags\n";
}
$mp3->close(); # destroy object
Something like that. You'd obviously want to give more arguments for what you actually want to change the meta data to.... Good luck!