forked from openlp/openlp
Merged (not redundant) parts of documentation/SongFormat.txt into the songs/lib/db module and removed it. Added the media_files and media_files_songs tables (although the doc is not complete there).
bzr-revno: 1265
This commit is contained in:
commit
f80edf2092
@ -1,124 +0,0 @@
|
||||
openlp.org 2.x Song Database Structure
|
||||
========================================================================
|
||||
|
||||
Introduction
|
||||
------------
|
||||
The song database in openlp.org 2.x is similar to the 1.x format. The
|
||||
biggest differences are the addition of extra tables, and the use of
|
||||
SQLite version 3.
|
||||
|
||||
The song database contains the following tables:
|
||||
- authors
|
||||
- authors_songs
|
||||
- song_books
|
||||
- songs
|
||||
- songs_topics
|
||||
- topics
|
||||
|
||||
|
||||
"authors" Table
|
||||
---------------
|
||||
This table holds the names of all the authors. It has the following
|
||||
columns:
|
||||
|
||||
* id
|
||||
* first_name
|
||||
* last_name
|
||||
* display_name
|
||||
|
||||
|
||||
"authors_songs" Table
|
||||
---------------------
|
||||
This is a bridging table between the "authors" and "songs" tables, which
|
||||
serves to create a many-to-many relationship between the two tables. It
|
||||
has the following columns:
|
||||
|
||||
* author_id
|
||||
* song_id
|
||||
|
||||
|
||||
"song_books" Table
|
||||
------------------
|
||||
The "song_books" table holds a list of books that a congregation gets
|
||||
their songs from, or old hymnals now no longer used. This table has the
|
||||
following columns:
|
||||
|
||||
* id
|
||||
* name
|
||||
* publisher
|
||||
|
||||
|
||||
"songs" Table
|
||||
-------------
|
||||
This table contains the songs, and each song has a list of attributes.
|
||||
The "songs" table has the following columns:
|
||||
|
||||
* id
|
||||
* song_book_id
|
||||
* title
|
||||
* lyrics
|
||||
* verse_order
|
||||
* copyright
|
||||
* comments
|
||||
* ccli_number
|
||||
* song_number
|
||||
* theme_name
|
||||
* search_title
|
||||
* search_lyrics
|
||||
|
||||
|
||||
"songs_topics" Table
|
||||
--------------------
|
||||
This is a bridging table between the "songs" and "topics" tables, which
|
||||
serves to create a many-to-many relationship between the two tables. It
|
||||
has the following columns:
|
||||
|
||||
* song_id
|
||||
* topic_id
|
||||
|
||||
|
||||
"topics" Table
|
||||
--------------
|
||||
The topics table holds a selection of topics that songs can cover. This
|
||||
is useful when a worship leader wants to select songs with a certain
|
||||
theme. This table has the following columns:
|
||||
|
||||
* id
|
||||
* name
|
||||
|
||||
|
||||
The lyrics definition (more or less similar to interformat to/from ChangingSong
|
||||
The tags <i></i><b></b><u></u> can also be used within the lyrics test.
|
||||
|
||||
! Please note that this format has been checked at http://validator.w3.org/#validate_by_upload
|
||||
|
||||
<lyrics lang="en_US">
|
||||
<title>Amazing Grace</title>
|
||||
<verse name="v1">
|
||||
<theme>name of verse specific theme (optional)</theme>
|
||||
<comment>any text (optional)</comment>
|
||||
<part name="men">
|
||||
Amazing grace, how ...
|
||||
</part>
|
||||
<part name="women">
|
||||
A b c
|
||||
D e f
|
||||
</part>
|
||||
...
|
||||
</verse>
|
||||
<verse name="c">
|
||||
<theme>name of verse specific theme (optional)</theme>
|
||||
<comment>any text (optional)</comment>
|
||||
...
|
||||
</verse>
|
||||
</lyrics>
|
||||
<lyrics lang="de_DE">
|
||||
<title>Erstaunliche Anmut</title>
|
||||
<verse name="v1">
|
||||
Erstaunliche Anmut, wie
|
||||
...
|
||||
</verse>
|
||||
<verse name="c">
|
||||
...
|
||||
</verse>
|
||||
</lyrics>
|
@ -77,9 +77,9 @@ def parse_reference(reference):
|
||||
- After a verse reference all further single values are treat as verse in
|
||||
the last selected chapter.
|
||||
``John 3:16-18`` refers to John chapter 3 verses 16 to 18
|
||||
- After a list separator it is possible to refer to additional verses. They
|
||||
are build analog to the first ones. This way it is possible to define
|
||||
each number of verse references. It is not possible to refer to verses in
|
||||
- After a list separator it is possible to refer to additional verses. They
|
||||
are build analog to the first ones. This way it is possible to define each
|
||||
number of verse references. It is not possible to refer to verses in
|
||||
additional books.
|
||||
``John 3:16,18`` refers to John chapter 3 verses 16 and 18
|
||||
``John 3:16-18,20`` refers to John chapter 3 verses 16 to 18 and 20
|
||||
@ -91,7 +91,7 @@ def parse_reference(reference):
|
||||
``range_string`` is a regular expression which matches for verse range
|
||||
declarations:
|
||||
|
||||
1. ``(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?'
|
||||
1. ``(?:(?P<from_chapter>[0-9]+)%(sep_v)s)?``
|
||||
It starts with a optional chapter reference ``from_chapter`` followed by
|
||||
a verse separator.
|
||||
2. ``(?P<from_verse>[0-9]+)``
|
||||
@ -105,7 +105,7 @@ def parse_reference(reference):
|
||||
5. ``(?P<to_verse>[0-9]+)``
|
||||
The ``to_verse`` reference is equivalent to group 2.
|
||||
|
||||
The full reference is matched against get_reference_match(u'full'). This
|
||||
The full reference is matched against get_reference_match(u'full'). This
|
||||
regular expression looks like this:
|
||||
|
||||
1. ``^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*``
|
||||
@ -113,7 +113,7 @@ def parse_reference(reference):
|
||||
are optional leading digits followed by non-digits. The group ends
|
||||
before the whitspace in front of the next digit.
|
||||
2. ``(?P<ranges>(?:`` + range_string + ``(?:%(sep_l)s|(?=\s*$)))+)\s*$``
|
||||
The second group contains all ``ranges``. This can be multiple
|
||||
The second group contains all ``ranges``. This can be multiple
|
||||
declarations of a range_string separated by a list separator.
|
||||
|
||||
The reference list is a list of tuples, with each tuple structured like
|
||||
|
@ -484,19 +484,19 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||
|
||||
def onAuthorsListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *authorsListWidget*s current row has changed.
|
||||
Called when the *authorsListWidget*'s current row has changed.
|
||||
"""
|
||||
self.__rowChange(row, self.authorsEditButton, self.authorsDeleteButton)
|
||||
|
||||
def onTopicsListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *topicsListWidget*s current row has changed.
|
||||
Called when the *topicsListWidget*'s current row has changed.
|
||||
"""
|
||||
self.__rowChange(row, self.topicsEditButton, self.topicsDeleteButton)
|
||||
|
||||
def onBooksListRowChanged(self, row):
|
||||
"""
|
||||
Called when the *booksListWidget*s current row has changed.
|
||||
Called when the *booksListWidget*'s current row has changed.
|
||||
"""
|
||||
self.__rowChange(row, self.booksEditButton, self.booksDeleteButton)
|
||||
|
||||
|
@ -39,6 +39,7 @@ class Author(BaseModel):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Book(BaseModel):
|
||||
"""
|
||||
Book model
|
||||
@ -47,30 +48,115 @@ class Book(BaseModel):
|
||||
return u'<Book id="%s" name="%s" publisher="%s" />' % (
|
||||
str(self.id), self.name, self.publisher)
|
||||
|
||||
|
||||
class MediaFile(BaseModel):
|
||||
"""
|
||||
MediaFile model
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Song(BaseModel):
|
||||
"""
|
||||
Song model
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Topic(BaseModel):
|
||||
"""
|
||||
Topic model
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def init_schema(url):
|
||||
|
||||
"""
|
||||
Setup the songs database connection and initialise the database schema
|
||||
Setup the songs database connection and initialise the database schema.
|
||||
|
||||
``url``
|
||||
The database to setup
|
||||
|
||||
The song database contains the following tables:
|
||||
|
||||
* authors
|
||||
* authors_songs
|
||||
* media_files
|
||||
* media_files_songs
|
||||
* song_books
|
||||
* songs
|
||||
* songs_topics
|
||||
* topics
|
||||
|
||||
**authors** Table
|
||||
This table holds the names of all the authors. It has the following
|
||||
columns:
|
||||
|
||||
* id
|
||||
* first_name
|
||||
* last_name
|
||||
* display_name
|
||||
|
||||
**authors_songs Table**
|
||||
This is a bridging table between the *authors* and *songs* tables, which
|
||||
serves to create a many-to-many relationship between the two tables. It
|
||||
has the following columns:
|
||||
|
||||
* author_id
|
||||
* song_id
|
||||
|
||||
**media_files Table**
|
||||
* id
|
||||
* file_name
|
||||
* type
|
||||
|
||||
**media_files_songs Table**
|
||||
* media_file_id
|
||||
* song_id
|
||||
|
||||
**song_books Table**
|
||||
The *song_books* table holds a list of books that a congregation gets
|
||||
their songs from, or old hymnals now no longer used. This table has the
|
||||
following columns:
|
||||
|
||||
* id
|
||||
* name
|
||||
* publisher
|
||||
|
||||
**songs Table**
|
||||
This table contains the songs, and each song has a list of attributes.
|
||||
The *songs* table has the following columns:
|
||||
|
||||
* id
|
||||
* song_book_id
|
||||
* title
|
||||
* alternate_title
|
||||
* lyrics
|
||||
* verse_order
|
||||
* copyright
|
||||
* comments
|
||||
* ccli_number
|
||||
* song_number
|
||||
* theme_name
|
||||
* search_title
|
||||
* search_lyrics
|
||||
|
||||
**songs_topics Table**
|
||||
This is a bridging table between the *songs* and *topics* tables, which
|
||||
serves to create a many-to-many relationship between the two tables. It
|
||||
has the following columns:
|
||||
|
||||
* song_id
|
||||
* topic_id
|
||||
|
||||
**topics Table**
|
||||
The topics table holds a selection of topics that songs can cover. This
|
||||
is useful when a worship leader wants to select songs with a certain
|
||||
theme. This table has the following columns:
|
||||
|
||||
* id
|
||||
* name
|
||||
"""
|
||||
session, metadata = init_db(url)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user