diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q
index 6909a9271..82e9567a6 100644
--- a/.eric4project/openlp.org 2.0.e4q
+++ b/.eric4project/openlp.org 2.0.e4q
@@ -1,7 +1,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/.eric4project/openlp.org 2.0.e4t b/.eric4project/openlp.org 2.0.e4t
index ac9a81c5e..bf893b274 100644
--- a/.eric4project/openlp.org 2.0.e4t
+++ b/.eric4project/openlp.org 2.0.e4t
@@ -1,7 +1,7 @@
-
+
TODO: what is the tags for bridge, pre-chorus?
diff --git a/openlp.org 2.0.e4p b/openlp.org 2.0.e4p
index a67e668ae..2c31308b3 100644
--- a/openlp.org 2.0.e4p
+++ b/openlp.org 2.0.e4p
@@ -1,8 +1,8 @@
-
-
+
+
PythonQt4
@@ -95,11 +95,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
@@ -111,6 +127,11 @@
+
+
+
+
+
diff --git a/openlp/plugins/songs/lib/classes.py b/openlp/plugins/songs/lib/classes.py
new file mode 100644
index 000000000..a693641d3
--- /dev/null
+++ b/openlp/plugins/songs/lib/classes.py
@@ -0,0 +1,58 @@
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+"""
+OpenLP - Open Source Lyrics Projection
+Copyright (c) 2008 Raoul Snyman
+Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
+
+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; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+class BaseModel(object):
+ """
+ BaseModel provides a base object with a set of generic functions
+ """
+
+ @classmethod
+ def populate(cls, **kwargs):
+ """
+ Creates an instance of a class and populates it, returning the instance
+ """
+ me = cls()
+ keys = kwargs.keys()
+ for key in keys:
+ me.__setattr__(key, kwargs[key])
+ return me
+
+class Author(BaseModel):
+ """
+ Author model
+ """
+ pass
+
+class Book(BaseModel):
+ """
+ Book model
+ """
+ pass
+
+class Song(BaseModel):
+ """
+ Song model
+ """
+ pass
+
+class Topic(BaseModel):
+ """
+ Topic model
+ """
+ pass
diff --git a/openlp/plugins/songs/lib/models.py b/openlp/plugins/songs/lib/models.py
new file mode 100644
index 000000000..352b4f5e0
--- /dev/null
+++ b/openlp/plugins/songs/lib/models.py
@@ -0,0 +1,41 @@
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+"""
+OpenLP - Open Source Lyrics Projection
+Copyright (c) 2008 Raoul Snyman
+Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
+
+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; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+from sqlalchemy import create_engine
+from sqlalchemy.orm import scoped_session, sessionmaker, mapper, relation
+
+from openlp.plugins.songs.lib.tables import *
+from openlp.plugins.songs.lib.classes import *
+
+Session = None
+
+def init_models(url):
+ Session = scoped_session(sessionmaker(autoflush=True, autocommit=False,
+ bind=create_engine(url)))
+
+
+mapper(Author, authors_table)
+mapper(Book, song_books_table)
+mapper(Song, songs_table,
+ properties={'authors': relation(Author, backref='songs',
+ secondary=authors_songs_table),
+ 'book': relation(Book, backref='songs'),
+ 'topics': relation(Topic, backref='songs',
+ secondary=songs_topics_table)})
+mapper(Topic, topics_table)
diff --git a/openlp/plugins/songs/lib/tables.py b/openlp/plugins/songs/lib/tables.py
new file mode 100644
index 000000000..a5df053f6
--- /dev/null
+++ b/openlp/plugins/songs/lib/tables.py
@@ -0,0 +1,71 @@
+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
+"""
+OpenLP - Open Source Lyrics Projection
+Copyright (c) 2008 Raoul Snyman
+Portions copyright (c) 2008 Martin Thompson, Tim Bentley,
+
+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; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the 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., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+from sqlalchemy import Column, Table, MetaData, ForeignKey, types
+
+metadata = MetaData()
+
+# Definition of the "authors" table
+authors_table = Table('authors', metadata,
+ Column('id', types.Integer, primary_key=True),
+ Column('first_name', types.Unicode(128)),
+ Column('last_name', types.Unicode(128)),
+ Column('display_name', types.Unicode(255), nullable=False)
+)
+
+# Definition of the "song_books" table
+song_books_table = Table('song_books', metadata,
+ Column('id', types.Integer, primary_key=True),
+ Column('name', types.Unicode(128), nullable=False),
+ Column('publisher', types.Unicode(128))
+)
+
+# Definition of the "songs" table
+songs_table = Table('songs', metadata,
+ Column('id', types.Integer(), primary_key=True),
+ Column('song_book_id', types.Integer, ForeignKey('song_books.id'), default=0),
+ Column('title', types.Unicode(255), nullable=False),
+ Column('lyrics', types.UnicodeText, nullable=False),
+ Column('verse_order', types.Unicode(128)),
+ Column('copyright', types.Unicode(255)),
+ Column('comments', types.UnicodeText),
+ Column('ccli_number', types.Unicode(64)),
+ Column('song_number', types.Unicode(64)),
+ Column('theme_name', types.Unicode(128)),
+ Column('search_title', types.Unicode(255), index=True, nullable=False),
+ Column('search_lyrics', types.UnicodeText, index=True, nullable=False)
+)
+
+# Definition of the "topics" table
+topics_table = Table('topics', metadata,
+ Column('id', types.Integer, primary_key=True),
+ Column('name', types.Unicode(128), nullable=False)
+)
+
+# Definition of the "authors_songs" table
+authors_songs_table = Table('authors_songs', metadata,
+ Column('author_id', types.Integer, ForeignKey('authors.id'), primary_key=True),
+ Column('song_id', types.Integer, ForeignKey('songs.id'), primary_key=True)
+)
+
+# Definition of the "songs_topics" table
+songs_topics_table = Table('songs_topics', metadata,
+ Column('song_id', types.Integer, ForeignKey('songs.id'), primary_key=True),
+ Column('topic_id', types.Integer, ForeignKey('topics.id'), primary_key=True)
+)