summaryrefslogtreecommitdiffstats
path: root/bin/create_genre
diff options
context:
space:
mode:
Diffstat (limited to 'bin/create_genre')
-rwxr-xr-xbin/create_genre32
1 files changed, 32 insertions, 0 deletions
diff --git a/bin/create_genre b/bin/create_genre
new file mode 100755
index 00000000..c9687e7b
--- /dev/null
+++ b/bin/create_genre
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+# Copyright (c) 2000 Kveton.com
+# All rights reserved.
+
+# $Id: create_genre,v 1.2 2003/11/24 05:53:12 vollmerk Exp $
+# $Source: /data/cvsroot/ampache/bin/create_genre,v $
+
+# Create the genres in the database for ease of use
+
+use DBI;
+
+# User, pass and database names
+my $user = '_user_';
+my $pass = '_password_';
+my $db_name = 'ampache';
+my $db_host = 'localhost';
+
+$dbh = DBI->connect("dbi:mysql:database=$db_name;host=$db_host;port=3306", $user, $pass);
+my $sql = qq{INSERT INTO genre (id,name) VALUES (?,?)};
+my $sth = $dbh->prepare($sql);
+
+open(GENRE, "< genres.txt");
+
+while ( $line = <GENRE> ) {
+ chomp $line;
+ my ($id, $name) = split(/\./, $line);
+ print "$id : $name\n";
+ $sth->execute($id,$name);
+}
+
+1;