# Path: webapp/model.py
# class Song(SQLObject):
# class Songbook(SQLObject):
# class Visit(SQLObject):
#     class sqlmeta:
# class VisitIdentity(SQLObject):
# class Group(SQLObject):
#     class sqlmeta:
# class User(SQLObject):
#     class sqlmeta:
# class Permission(SQLObject):
#     def lookup_visit(cls, visit_key):
#     def _get_permissions(self):
#     def _set_password(self, cleartext_password):
#     def set_password_raw(self, password):
# def bootstrap_model(clean=False, user=None):
# def create_tables(drop_all=False):
# def create_default_user(user_name):


from webapp.model import Song, Songbook, hub
from posixpath import *
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
import xml.parsers.expat
import webapp.c_utilities as c
import turbogears
import glob
import sys
import os
import re
#!/usr/bin/env python
try: # try c version for speed then fall back to python
except ImportError:

if exists('song.db'):
  os.system('rm song.db')
  print '\nREMOVED EXISTING DATABASE\n'
 
os.system('tg-admin -c prod.cfg sql create')

if exists(join(dirname(__file__), "setup.py")):
  turbogears.update_config(configfile="dev.cfg",
    modulename="webapp.config")

# grab all songs and songbooks from directories
songlist = glob.glob('songs/*')
songbooklist = glob.glob('songbooks/*')

# enter songs into database

# Path: webapp/model.py
# class Song(SQLObject):
# class Songbook(SQLObject):
# class Visit(SQLObject):
#     class sqlmeta:
# class VisitIdentity(SQLObject):
# class Group(SQLObject):
#     class sqlmeta:
# class User(SQLObject):
#     class sqlmeta:
# class Permission(SQLObject):
#     def lookup_visit(cls, visit_key):
#     def _get_permissions(self):
#     def _set_password(self, cleartext_password):
#     def set_password_raw(self, password):
# def bootstrap_model(clean=False, user=None):
# def create_tables(drop_all=False):
# def create_default_user(user_name):


# Path: regen_db.py
from webapp.model import Song, Songbook, hub
from posixpath import *
  import xml.etree.cElementTree as ET
  import xml.etree.ElementTree as ET
import xml.parsers.expat
import webapp.c_utilities as c
import turbogears
import glob
import sys
import os
import re

#!/usr/bin/env python
try: # try c version for speed then fall back to python
except ImportError:

if exists('song.db'):
  os.system('rm song.db')
  print '\nREMOVED EXISTING DATABASE\n'
 
os.system('tg-admin -c prod.cfg sql create')

if exists(join(dirname(__file__), "setup.py")):
  turbogears.update_config(configfile="dev.cfg",
    modulename="webapp.config")

# grab all songs and songbooks from directories
songlist = glob.glob('songs/*')
songbooklist = glob.glob('songbooks/*')

# enter songs into database

hub.begin() #open connection to database