diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q
index 33e29a204..ac912a6e7 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 8bf1b495d..a9570b35d 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/core/lib/__init__.py b/openlp/core/lib/__init__.py
index 667c0ecfa..cd3c727ca 100644
--- a/openlp/core/lib/__init__.py
+++ b/openlp/core/lib/__init__.py
@@ -24,6 +24,7 @@ from settingstab import SettingsTab
from mediamanageritem import MediaManagerItem
from event import Event
from xmlrootclass import XmlRootClass
+from serviceitem import ServiceItem
__all__ = ['PluginConfig', 'Plugin', 'PluginUtils', 'SettingsTab', 'MediaManagerItem', 'Event',
- 'XmlRootClass']
+ 'XmlRootClass', 'ServiceItem']
diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py
index 207d7704e..c55dcd506 100644
--- a/openlp/core/lib/mediamanageritem.py
+++ b/openlp/core/lib/mediamanageritem.py
@@ -75,20 +75,22 @@ class MediaManagerItem(QtGui.QWidget):
if tooltip is not None:
ToolbarButton.setToolTip(tooltip)
if slot is not None:
- QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("triggered()"), slot)
+ QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL('triggered()'), slot)
def addToolbarSeparator(self):
"""
A very simple method to add a separator to the toolbar.
"""
self.Toolbar.addSeparator()
-
+
def getInputFile(self, dialogname, dialoglocation, dialogfilter):
- return QtGui.QFileDialog.getOpenFileName(self, dialogname,dialoglocation, dialogfilter)
+ return QtGui.QFileDialog.getOpenFileName(self, dialogname,
+ dialoglocation, dialogfilter)
def getInputFiles(self, dialogname, dialoglocation, dialogfilter):
- return QtGui.QFileDialog.getOpenFileNames(self, dialogname,dialoglocation, dialogfilter)
-
+ return QtGui.QFileDialog.getOpenFileNames(self, dialogname,
+ dialoglocation, dialogfilter)
+
def refresh(self):
self.update()
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
new file mode 100644
index 000000000..0c4084a02
--- /dev/null
+++ b/openlp/core/lib/serviceitem.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# 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 ServiceItem():
+ """
+ The service item is a base class for the plugins to use to interact with
+ the service manager, the slide controller, and the renderer.
+ """
+
+ def render(self):
+ """
+ The render method is what the plugin uses to render it's meda to the
+ screen.
+ """
+ pass
+
+ def get_parent_node(self):
+ """
+ This method returns a parent node to be inserted into the Service
+ Manager.
+ """
+ pass
diff --git a/openlp/migration/migratesongs.py b/openlp/migration/migratesongs.py
index 255e5d422..80f7d4147 100644
--- a/openlp/migration/migratesongs.py
+++ b/openlp/migration/migratesongs.py
@@ -15,7 +15,7 @@ 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
"""
-import os
+import os
import logging
import sqlite3
from openlp.core.lib import PluginConfig
@@ -37,7 +37,7 @@ mapper(Song, songs_table,
'book': relation(Book, backref='songs'),
'topics': relation(Topic, backref='songs',
secondary=songs_topics_table)})
-mapper(Topic, topics_table)
+mapper(Topic, topics_table)
class MigrateSongs():
def __init__(self, display):
@@ -51,39 +51,45 @@ class MigrateSongs():
self.display.output("Songs processing started");
for f in self.database_files:
self.v_1_9_0(f)
- self.display.output("Songs processing finished");
+ self.display.output("Songs processing finished");
def v_1_9_0(self, database):
self.display.output("Migration 1.9.0 Started for "+database);
self._v1_9_0_authors(database)
- self._v1_9_0_topics(database)
- self._v1_9_0_songbook(database)
- self._v1_9_0_songauthors(database)
+ self._v1_9_0_topics(database)
+ self._v1_9_0_songbook(database)
+ self._v1_9_0_songauthors(database)
self._v1_9_0_songtopics(database)
self._v1_9_0_songs(database)
- self._v1_9_0_songs_update(database)
-
- self.display.output("Migration 1.9.0 Finished for " + database);
+ self._v1_9_0_songs_update(database)
+
+ self.display.output("Migration 1.9.0 Finished for " + database);
def _v1_9_0_authors(self, database):
self.display.sub_output("Authors Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
+ conn.execute("""alter table authors rename to authors_temp;""")
+ conn.commit()
+
+ conn.execute("""create table authors add column display_name varchar(255);""")
+ conn.commit()
+ self.display.sub_output("first name created")
conn.execute("""alter table authors add column first_name varchar(128);""")
conn.commit()
self.display.sub_output("first name created")
conn.execute("""alter table authors add column last_name varchar(128);""")
conn.commit()
self.display.sub_output("last name created")
- conn.execute("""create index if not exists author1 on authors (display_name ASC,id ASC);""")
- conn.commit()
+ conn.execute("""create index if not exists author_display_name on authors (display_name ASC,id ASC);""")
+ conn.commit()
self.display.sub_output("index author1 created")
- conn.execute("""create index if not exists author2 on authors (last_name ASC,id ASC);""")
- conn.commit()
+ conn.execute("""create index if not exists author_last_name on authors (last_name ASC,id ASC);""")
+ conn.commit()
self.display.sub_output("index author2 created")
- conn.execute("""create index if not exists author3 on authors (first_name ASC,id ASC);""")
- conn.commit()
- self.display.sub_output("index author3 created")
- self.display.sub_output("Author Data Migration started")
+ conn.execute("""create index if not exists author_first_name on authors (first_name ASC,id ASC);""")
+ conn.commit()
+ self.display.sub_output("index author3 created")
+ self.display.sub_output("Author Data Migration started")
c = conn.cursor()
text = c.execute("""select * from authors """) .fetchall()
for author in text:
@@ -94,14 +100,15 @@ class MigrateSongs():
afn = dispname[:pos]
aln = dispname[pos + 1:len(dispname)]
#txt = text[2]
- s = "update authors set first_name = '" + afn + "' ,last_name = '" + aln + "' where id = " +str(author[0])
+ s = "update authors set display_name = '" + dispname + "', first_name = '" + afn + "', last_name = '" + aln + "' where id = " +str(author[0])
text1 = c.execute(s)
-
+ conn.commit()
+ conn.execute("""alter table authors drop column authorname;""")
conn.commit()
conn.close()
- self.display.sub_output("Author Data Migration Completed")
+ self.display.sub_output("Author Data Migration Completed")
self.display.sub_output("Authors Completed");
-
+
def _v1_9_0_topics(self, database):
self.display.sub_output("Topics Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
@@ -114,11 +121,11 @@ class MigrateSongs():
self.display.sub_output("topicname added")
conn.execute("""create index if not exists topic1 on topics (name ASC,id ASC);""")
conn.commit()
- conn.close()
- self.display.sub_output("index topic1 created")
-
+ conn.close()
+ self.display.sub_output("index topic1 created")
+
self.display.sub_output("Topics Completed");
-
+
def _v1_9_0_songbook(self, database):
self.display.sub_output("SongBook Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
@@ -132,14 +139,14 @@ class MigrateSongs():
conn.commit()
self.display.sub_output("songbook_publisher added")
conn.execute("""create index if not exists songbook1 on song_books (name ASC,id ASC);""")
- conn.commit()
+ conn.commit()
self.display.sub_output("index songbook1 created")
conn.execute("""create index if not exists songbook2 on song_books (publisher ASC,id ASC);""")
conn.commit()
- conn.close()
- self.display.sub_output("index songbook2 created")
+ conn.close()
+ self.display.sub_output("index songbook2 created")
self.display.sub_output("SongBook Completed");
-
+
def _v1_9_0_songtopics(self, database):
self.display.sub_output("Songtopics Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
@@ -150,24 +157,24 @@ class MigrateSongs():
conn.commit()
self.display.sub_output("songtopics_topic_id added")
conn.execute("""create index if not exists songtopic1 on song_topics (topic_id ASC,song_id ASC);""")
- conn.commit()
+ conn.commit()
self.display.sub_output("index songbook1 created")
conn.execute("""create index if not exists songbook2 on song_topics (song_id ASC,topic_id ASC);""")
conn.commit()
- conn.close()
- self.display.sub_output("index songbook2 created")
+ conn.close()
+ self.display.sub_output("index songbook2 created")
self.display.sub_output("SongTopics Completed");
-
+
def _v1_9_0_songauthors(self, database):
self.display.sub_output("SongAuthors Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
conn.execute("""alter table songauthors rename to authors_songs;""")
conn.commit()
- conn.close()
- self.display.sub_output("Table Renamed")
+ conn.close()
+ self.display.sub_output("Table Renamed")
self.display.sub_output("SongAuthors Completed");
-
-
+
+
def _v1_9_0_songs(self, database):
self.display.sub_output("Songs Started for "+database);
conn = sqlite3.connect(self.data_path+os.sep+database)
@@ -188,24 +195,24 @@ class MigrateSongs():
self.display.sub_output("songs song_number added")
conn.execute("""alter table songs add theme_name varchar(128);""")
conn.commit()
- self.display.sub_output("songs theme_name added")
+ self.display.sub_output("songs theme_name added")
conn.execute("""alter table songs add search_title varchar(255);""")
conn.commit()
self.display.sub_output("songs search_title added")
conn.execute("""alter table songs add search_lyrics text;""")
conn.commit()
self.display.sub_output("songs search_lyrics added")
-
+
conn.execute("""create index if not exists songs1 on songs (search_lyrics ASC,id ASC);""")
- conn.commit()
+ conn.commit()
self.display.sub_output("index songs1 created")
conn.execute("""create index if not exists songs2 on songs (search_title ASC,id ASC);""")
conn.commit()
- conn.close()
- self.display.sub_output("index songs2 created")
+ conn.close()
+ self.display.sub_output("index songs2 created")
self.display.sub_output("Songs Completed");
-
-
+
+
def _v1_9_0_songs_update(self, database):
self.display.sub_output("Songs Started for "+database);
@@ -224,31 +231,31 @@ class MigrateSongs():
t=t.replace("'", "")
t=t.replace(",", "")
t=t.replace(";", "")
- t=t.replace(":", "")
+ t=t.replace(":", "")
t=t.replace("(", "")
t=t.replace(")", "")
- t=t.replace("{", "")
+ t=t.replace("{", "")
t=t.replace("}", "")
- t=t.replace("?", "")
+ t=t.replace("?", "")
song.search_title = t
t=song.lyrics.replace("&", "and")
t=t.replace("'", "")
t=t.replace(",", "")
t=t.replace(";", "")
- t=t.replace(":", "")
+ t=t.replace(":", "")
t=t.replace("(", "")
t=t.replace(")", "")
- t=t.replace("{", "")
+ t=t.replace("{", "")
t=t.replace("}", "")
- t=t.replace("?", "")
+ t=t.replace("?", "")
song.search_lyrics = t
song.song_book_id = 0
Session.save_or_update(song)
Session.commit()
-
+
def run_cmd(self, cmd):
f_i, f_o = os.popen4(cmd)
out = f_o.readlines()
if len(out) > 0:
for o in range (0, len(out)):
- self.display.sub_output(out[o])
+ self.display.sub_output(out[o])
diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py
index 372b3b7c0..d709e19cb 100644
--- a/openlp/plugins/songs/lib/manager.py
+++ b/openlp/plugins/songs/lib/manager.py
@@ -34,8 +34,8 @@ class SongManager():
"""
global log
- log=logging.getLogger("SongManager")
- log.info("Song manager loaded")
+ log=logging.getLogger('SongManager')
+ log.info('Song manager loaded')
def __init__(self, config):
"""
@@ -43,24 +43,22 @@ class SongManager():
don't exist.
"""
self.config = config
- log.debug( "Song Initialising")
+ log.debug('Song Initialising')
self.db_url = u''
db_type = self.config.get_config(u'db type')
if db_type == u'sqlite':
self.db_url = u'sqlite:///' + self.config.get_data_path() + \
u'/songs.sqlite'
- print self.db_url
else:
self.db_url = db_type + 'u://' + \
self.config.get_config(u'db username') + u':' + \
self.config.get_config(u'db password') + u'@' + \
self.config.get_config(u'db hostname') + u'/' + \
self.config.get_config(u'db database')
- #print self.db_url
self.session = init_models(self.db_url)
if not songs_table.exists():
metadata.create_all()
- log.debug( "Song Initialised")
+ log.debug('Song Initialised')
def process_dialog(self, dialogobject):
self.dialogobject = dialogobject
@@ -75,13 +73,13 @@ class SongManager():
"""
Searches the song title for keywords.
"""
- return self.session.query(Song).filter(search_title.like(u'%' + keywords + u'%'))
+ return self.session.query(Song).filter(Song.search_title.like(u'%' + keywords + u'%'))
def search_song_lyrics(self, keywords):
"""
Searches the song lyrics for keywords.
"""
- return self.session.query(Song).filter(search_lyrics.like(u'%' + keywords + u'%'))
+ return self.session.query(Song).filter(Song.search_lyrics.like(u'%' + keywords + u'%'))
def get_song(self, id=None):
"""