summaryrefslogtreecommitdiffstats
path: root/bin/create_genre
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-09 16:34:40 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-09 16:34:40 +0000
commitbcad40a05ab2dc2a341a3227e30b96668bce4500 (patch)
tree6fca27588d53a1b24705bd2834e9e643bb729bd1 /bin/create_genre
downloadampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.tar.gz
ampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.tar.bz2
ampache-bcad40a05ab2dc2a341a3227e30b96668bce4500.zip
New Import
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;