#!/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;
