• strict warning: Non-static method view::load() should not be called statically in /home/saturn/public_html/blog/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/ on line 159.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/ on line 134.

This is a quick, simple and easy script to convert a Luminous database to version 1.0

#!/usr/bin/env python
lum2olp 0.1 for 1.0
This is a quick, simple and easy script to convert a Luminous database to version 1.0
Written by Raoul Snyman [raoul.snyman AT saturnlaboratories DOT co DOT za]
Copyright (c) 2009 Raoul Snyman. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
import os
import sys
import codecs
import sqlite
import sqlite3
from exceptions import Exception
from optparse import OptionParser
def split_authors(author_list):
    This takes a string list of authors and splits them up:
        "Marty Sampson, Matt Crocker & Scott Ligertwood"
        ['Marty Sampson', 'Matt Crocker', 'Scott Ligertwood']
    temp_authors = []
    comma_authors = author_list.split(',')
    all_authors = []
    for author in temp_authors:
    return all_authors
def sort_sections(section_list):
    This pulls the sections out of the tuples from the DB, and returns a list
    of verses in one string, the way expects it.
    sections = []
    for sect in section_list:
    lyrics = u'\n\n'.join(sections)
    return lyrics.replace(u'"', u'""').replace(u'\u2019', u'\'').replace(u'\u2018', u'\'')
def main():
    This is the main function.
    sys.stdout = codecs.getwriter('utf8')(sys.stdout)
    version = u'lum2olp 0.1 for 1.0\nCopyright (c) 2009 Raoul Snyman\nThis program is licensed under the GNU General Public License'
    usage = u'%prog [options]'
    parser = OptionParser(version=version, usage=usage)
    parser.add_option('-s', '--source', dest='source', metavar='SOURCE',
        help='Specify the Luminous source file to be used. If no file is specified, "database.lued" in the current directory will be used.')
    parser.add_option('-d', '--destination', dest='destination', metavar='DESTINATION',
        help='Specify the songs database to be used. If no database is specified, "songs.olp" in the current directory will be used.')
    (options, args) = parser.parse_args()
    lum_connection = sqlite3.connect(os.path.abspath(options.source))
    olp_connection = sqlite.connect(os.path.abspath(options.destination))
    lum_cursor = lum_connection.cursor()
    olp_cursor = olp_connection.cursor()
        lum_cursor.execute(u'SELECT SongId, Title, Author, CopyrightNotice FROM SongInfo')
    except Exception, e:
        print u'An error occurred: %s' % e.message
        return 1
    lum_songs = lum_cursor.fetchall()
    if len(lum_songs) == 0:
        print u'No songs found! Exiting...'
        return 1
    for lum_song in lum_songs:
        print u'Processing: "%s"...' % lum_song[1]
        lum_authors = split_authors(lum_song[2])
        author_ids = []
        for lum_author in lum_authors:
            olp_cursor.execute(u'SELECT authorid FROM authors WHERE authorname LIKE "%s"' % lum_author)
            olp_author = olp_cursor.fetchone()
            if olp_author is not None:
                olp_cursor.execute(u'INSERT INTO authors (authorname) VALUES ("%s")', lum_author)
                olp_cursor.execute(u'SELECT MAX(authorid) FROM authors')
        lum_cursor.execute(u'SELECT Section FROM SongLyricSection WHERE SongId = ? ORDER BY SectionIndex',
        lum_sections = lum_cursor.fetchall()
        insert_sql = u'INSERT INTO songs (songtitle, lyrics, copyrightinfo, settingsid) VALUES ("%s", "%s", "%s", 1)' % \
            (lum_song[1], sort_sections(lum_sections), lum_song[3])
        song_id = olp_connection.insert_id()
        for author_id in author_ids:
            insert_sql = u'INSERT INTO songauthors (songid, authorid) VALUES (%s, %s)' % (str(song_id), str(int(author_id[0])))
    print 'Done.'
if __name__ == u'__main__':