Lets see how badly yuku will screw up code. This code hasn't been tested and assumes a mysql database. change the config as needed, especialy the SQL query. I assume you know how to run and modify perl scripts?
#!/usr/bin/perl
use strict;
use MP3::Tag;
use DBI;
#Start Configuration
my $database = "robdb";
my $hostname = "server";
my $port = "7";
my $user = "rob";
my $password = "kelk";
my $dir = $ARGV[0];
#setup database connection, not really config, but nessesary to prepare the sql statement.
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn, $user, $password) or die "Cannot connect to database. Commiting harakiri.";
my $sqlStatement = $dbh->prepare("INSERT INTO foo (filename, title, track, artist, album, comment, year, genre) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
#End Configuration
#read all files in the specified directory.
opendir DIR, $dir or die "cannot open dir $dir: $!";
my @files = readdir DIR;
closedir DIR;
# loop over all files specified in the 2files array.
foreach my $filename (@files) {
print "Processing: "$filename"
";
#Possibly add a check to see if it's an mp3 file...
my $mp3 = MP3::Tag->new($filename);
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
$sqlStatement->execute($filename, $title, $track, $artist, $album, $comment, $year, $genre);
}
$sqlStatement->finish();
# Disconnect from the database.
$dbh->disconnect();
E: "Did they... did they just endorse the combination of the JSDF and US Army by showing them as two lesbian lolicons moving in together and holding hands and talking about how 'intimate' they were?"
B: "Have you forgotten so soon? They're phasing out Don't Ask, Don't Tell."
#!/usr/bin/perl
use strict;
use MP3::Tag;
use DBI;
#Start Configuration
my $database = "robdb";
my $hostname = "server";
my $port = "7";
my $user = "rob";
my $password = "kelk";
my $dir = $ARGV[0];
#setup database connection, not really config, but nessesary to prepare the sql statement.
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn, $user, $password) or die "Cannot connect to database. Commiting harakiri.";
my $sqlStatement = $dbh->prepare("INSERT INTO foo (filename, title, track, artist, album, comment, year, genre) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
#End Configuration
#read all files in the specified directory.
opendir DIR, $dir or die "cannot open dir $dir: $!";
my @files = readdir DIR;
closedir DIR;
# loop over all files specified in the 2files array.
foreach my $filename (@files) {
print "Processing: "$filename"
";
#Possibly add a check to see if it's an mp3 file...
my $mp3 = MP3::Tag->new($filename);
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
$sqlStatement->execute($filename, $title, $track, $artist, $album, $comment, $year, $genre);
}
$sqlStatement->finish();
# Disconnect from the database.
$dbh->disconnect();
E: "Did they... did they just endorse the combination of the JSDF and US Army by showing them as two lesbian lolicons moving in together and holding hands and talking about how 'intimate' they were?"
B: "Have you forgotten so soon? They're phasing out Don't Ask, Don't Tell."