This commit is contained in:
Jonathan Corwin 2011-03-28 21:56:36 +01:00
commit d220669e9b
10 changed files with 237 additions and 193 deletions

View File

@ -1,112 +1,112 @@
@ECHO OFF @ECHO OFF
REM Command file for Sphinx documentation REM Command file for Sphinx documentation
set SPHINXBUILD=sphinx-build set SPHINXBUILD=sphinx-build
set ALLSPHINXOPTS=-d build/doctrees %SPHINXOPTS% source set ALLSPHINXOPTS=-d build/doctrees %SPHINXOPTS% source
if NOT "%PAPER%" == "" ( if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
) )
if "%1" == "" goto help if "%1" == "" goto help
if "%1" == "help" ( if "%1" == "help" (
:help :help
echo.Please use `make ^<target^>` where ^<target^> is one of echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories echo. dirhtml to make HTML files named index.html in directories
echo. pickle to make pickle files echo. pickle to make pickle files
echo. json to make JSON files echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project echo. qthelp to make HTML files and a qthelp project
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. changes to make an overview over all changed/added/deprecated items echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled echo. doctest to run all doctests embedded in the documentation if enabled
goto end goto end
) )
if "%1" == "clean" ( if "%1" == "clean" (
for /d %%i in (build\*) do rmdir /q /s %%i for /d %%i in (build\*) do rmdir /q /s %%i
del /q /s build\* del /q /s build\*
goto end goto end
) )
if "%1" == "html" ( if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html %SPHINXBUILD% -b html %ALLSPHINXOPTS% build/html
echo. echo.
echo.Build finished. The HTML pages are in build/html. echo.Build finished. The HTML pages are in build/html.
goto end goto end
) )
if "%1" == "dirhtml" ( if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% build/dirhtml %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% build/dirhtml
echo. echo.
echo.Build finished. The HTML pages are in build/dirhtml. echo.Build finished. The HTML pages are in build/dirhtml.
goto end goto end
) )
if "%1" == "pickle" ( if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% build/pickle %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% build/pickle
echo. echo.
echo.Build finished; now you can process the pickle files. echo.Build finished; now you can process the pickle files.
goto end goto end
) )
if "%1" == "json" ( if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% build/json %SPHINXBUILD% -b json %ALLSPHINXOPTS% build/json
echo. echo.
echo.Build finished; now you can process the JSON files. echo.Build finished; now you can process the JSON files.
goto end goto end
) )
if "%1" == "htmlhelp" ( if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% build/htmlhelp %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% build/htmlhelp
echo. echo.
echo.Build finished; now you can run HTML Help Workshop with the ^ echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in build/htmlhelp. .hhp project file in build/htmlhelp.
goto end goto end
) )
if "%1" == "qthelp" ( if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% build/qthelp %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% build/qthelp
echo. echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^ echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in build/qthelp, like this: .qhcp project file in build/qthelp, like this:
echo.^> qcollectiongenerator build\qthelp\OpenLP.qhcp echo.^> qcollectiongenerator build\qthelp\OpenLP.qhcp
echo.To view the help file: echo.To view the help file:
echo.^> assistant -collectionFile build\qthelp\OpenLP.ghc echo.^> assistant -collectionFile build\qthelp\OpenLP.ghc
goto end goto end
) )
if "%1" == "latex" ( if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% build/latex %SPHINXBUILD% -b latex %ALLSPHINXOPTS% build/latex
echo. echo.
echo.Build finished; the LaTeX files are in build/latex. echo.Build finished; the LaTeX files are in build/latex.
goto end goto end
) )
if "%1" == "changes" ( if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% build/changes %SPHINXBUILD% -b changes %ALLSPHINXOPTS% build/changes
echo. echo.
echo.The overview file is in build/changes. echo.The overview file is in build/changes.
goto end goto end
) )
if "%1" == "linkcheck" ( if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% build/linkcheck %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% build/linkcheck
echo. echo.
echo.Link check complete; look for any errors in the above output ^ echo.Link check complete; look for any errors in the above output ^
or in build/linkcheck/output.txt. or in build/linkcheck/output.txt.
goto end goto end
) )
if "%1" == "doctest" ( if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% build/doctest %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% build/doctest
echo. echo.
echo.Testing of doctests in the sources finished, look at the ^ echo.Testing of doctests in the sources finished, look at the ^
results in build/doctest/output.txt. results in build/doctest/output.txt.
goto end goto end
) )
:end :end

View File

@ -42,7 +42,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'OpenLP' project = u'OpenLP'
copyright = u'2010, Raoul Snyman' copyright = u'2004 - 2011, Raoul Snyman'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -92,19 +92,30 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' if sys.argv[2] == 'qthelp' or sys.argv[2] == 'htmlhelp':
html_theme = 'openlp_qthelp'
else:
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
#html_theme_options = {} if sys.argv[2] == 'html':
html_theme_options = {
'sidebarbgcolor': '#3a60a9',
'relbarbgcolor': '#203b6f',
'footerbgcolor': '#26437c',
'headtextcolor': '#203b6f',
'linkcolor': '#26437c',
'sidebarlinkcolor': '#ceceff'
}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] html_theme_path = [os.path.join(os.path.abspath('..'), 'themes')]
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
#html_title = None html_title = u'OpenLP 2.0 Reference Manual'
# A shorter title for the navigation bar. Default is the same as html_title. # A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None #html_short_title = None
@ -125,7 +136,7 @@ html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y' html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
@ -165,7 +176,7 @@ html_static_path = ['_static']
#html_file_suffix = None #html_file_suffix = None
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'OpenLPdoc' htmlhelp_basename = 'OpenLP'
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output --------------------------------------------------
@ -179,7 +190,7 @@ htmlhelp_basename = 'OpenLPdoc'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('index', 'OpenLP.tex', u'OpenLP Documentation', ('index', 'OpenLP.tex', u'OpenLP Reference Manual',
u'Wesley Stout', 'manual'), u'Wesley Stout', 'manual'),
] ]
@ -212,6 +223,6 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'openlp', u'OpenLP Documentation', ('index', 'openlp', u'OpenLP Reference Manual',
[u'Wesley Stout'], 1) [u'Wesley Stout'], 1)
] ]

View File

@ -82,9 +82,8 @@ class OpenLP(QtGui.QApplication):
""" """
Override exec method to allow the shared memory to be released on exit Override exec method to allow the shared memory to be released on exit
""" """
return QtGui.QApplication.exec_() QtGui.QApplication.exec_()
self.sharedMemory.detach() self.sharedMemory.detach()
return i
def run(self): def run(self):
""" """

View File

@ -91,7 +91,7 @@ class LanguageManager(object):
""" """
Retrieve a saved language to use from settings Retrieve a saved language to use from settings
""" """
settings = QtCore.QSettings(u'OpenLP', u'OpenLP') settings = QtCore.QSettings()
language = unicode(settings.value( language = unicode(settings.value(
u'general/language', QtCore.QVariant(u'[en]')).toString()) u'general/language', QtCore.QVariant(u'[en]')).toString())
log.info(u'Language file: \'%s\' Loaded from conf file' % language) log.info(u'Language file: \'%s\' Loaded from conf file' % language)

View File

@ -45,7 +45,7 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.splitButton, QtCore.QObject.connect(self.splitButton,
QtCore.SIGNAL(u'pressed()'), self.onSplitButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed)
def setText(self, text): def setText(self, text):
""" """

View File

@ -30,15 +30,16 @@ import chardet
import codecs import codecs
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import VerseType
from songimport import SongImport from songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class CCLIFileImport(SongImport): class CCLIFileImport(SongImport):
""" """
The :class:`CCLIFileImport` class provides OpenLP with the ability to The :class:`CCLIFileImport` class provides OpenLP with the ability to import
import CCLI SongSelect song files in both .txt and .usr formats. CCLI SongSelect song files in both .txt and .usr formats. See
See http://www.ccli.com/ for more details. `<http://www.ccli.com/>`_ for more details.
""" """
def __init__(self, manager, **kwargs): def __init__(self, manager, **kwargs):
@ -55,7 +56,7 @@ class CCLIFileImport(SongImport):
def do_import(self): def do_import(self):
""" """
Import either a .usr or a .txt SongSelect file Import either a ``.usr`` or a ``.txt`` SongSelect file.
""" """
log.debug(u'Starting CCLI File Import') log.debug(u'Starting CCLI File Import')
song_total = len(self.import_source) song_total = len(self.import_source)
@ -67,6 +68,7 @@ class CCLIFileImport(SongImport):
(song_count, song_total)) (song_count, song_total))
filename = unicode(filename) filename = unicode(filename)
log.debug(u'Importing CCLI File: %s', filename) log.debug(u'Importing CCLI File: %s', filename)
self.set_defaults()
lines = [] lines = []
if os.path.isfile(filename): if os.path.isfile(filename):
detect_file = open(filename, u'r') detect_file = open(filename, u'r')
@ -81,12 +83,10 @@ class CCLIFileImport(SongImport):
lines = infile.readlines() lines = infile.readlines()
ext = os.path.splitext(filename)[1] ext = os.path.splitext(filename)[1]
if ext.lower() == u'.usr': if ext.lower() == u'.usr':
log.info(u'SongSelect .usr format file found %s: ', log.info(u'SongSelect .usr format file found: %s', filename)
filename)
self.do_import_usr_file(lines) self.do_import_usr_file(lines)
elif ext.lower() == u'.txt': elif ext.lower() == u'.txt':
log.info(u'SongSelect .txt format file found %s: ', log.info(u'SongSelect .txt format file found: %s', filename)
filename)
self.do_import_txt_file(lines) self.do_import_txt_file(lines)
else: else:
log.info(u'Extension %s is not valid', filename) log.info(u'Extension %s is not valid', filename)
@ -97,9 +97,8 @@ class CCLIFileImport(SongImport):
def do_import_usr_file(self, textList): def do_import_usr_file(self, textList):
""" """
The :func:`do_import_usr_file` method provides OpenLP The :func:`do_import_usr_file` method provides OpenLP with the ability
with the ability to import CCLI SongSelect songs in to import CCLI SongSelect songs in *USR* file format.
*USR* file format
``textList`` ``textList``
An array of strings containing the usr file content. An array of strings containing the usr file content.
@ -108,35 +107,46 @@ class CCLIFileImport(SongImport):
``[File]`` ``[File]``
USR file format first line USR file format first line
``Type=`` ``Type=``
Indicates the file type Indicates the file type
e.g. *Type=SongSelect Import File* e.g. *Type=SongSelect Import File*
``Version=3.0`` ``Version=3.0``
File format version File format version
``[S A2672885]`` ``[S A2672885]``
Contains the CCLI Song number e.g. *2672885* Contains the CCLI Song number e.g. *2672885*
``Title=`` ``Title=``
Contains the song title (e.g. *Title=Above All*) Contains the song title (e.g. *Title=Above All*)
``Author=`` ``Author=``
Contains a | delimited list of the song authors Contains a | delimited list of the song authors
e.g. *Author=LeBlanc, Lenny | Baloche, Paul* e.g. *Author=LeBlanc, Lenny | Baloche, Paul*
``Copyright=`` ``Copyright=``
Contains a | delimited list of the song copyrights Contains a | delimited list of the song copyrights
e.g. Copyright=1999 Integrity's Hosanna! Music | e.g. Copyright=1999 Integrity's Hosanna! Music |
LenSongs Publishing (Verwaltet von Gerth Medien LenSongs Publishing (Verwaltet von Gerth Medien
Musikverlag) Musikverlag)
``Admin=`` ``Admin=``
Contains the song administrator Contains the song administrator
e.g. *Admin=Gerth Medien Musikverlag* e.g. *Admin=Gerth Medien Musikverlag*
``Themes=`` ``Themes=``
Contains a /t delimited list of the song themes Contains a /t delimited list of the song themes
e.g. *Themes=Cross/tKingship/tMajesty/tRedeemer* e.g. *Themes=Cross/tKingship/tMajesty/tRedeemer*
``Keys=`` ``Keys=``
Contains the keys in which the music is played?? Contains the keys in which the music is played??
e.g. *Keys=A* e.g. *Keys=A*
``Fields=`` ``Fields=``
Contains a list of the songs fields in order /t delimited Contains a list of the songs fields in order /t delimited
e.g. *Fields=Vers 1/tVers 2/tChorus 1/tAndere 1* e.g. *Fields=Vers 1/tVers 2/tChorus 1/tAndere 1*
``Words=`` ``Words=``
Contains the songs various lyrics in order as shown by the Contains the songs various lyrics in order as shown by the
*Fields* description *Fields* description
@ -144,57 +154,60 @@ class CCLIFileImport(SongImport):
""" """
log.debug(u'USR file text: %s', textList) log.debug(u'USR file text: %s', textList)
self.set_defaults() song_author = u''
song_topics = u''
for line in textList: for line in textList:
if line.startswith(u'Title='): if line.startswith(u'Title='):
song_name = line[6:].strip() self.title = line[6:].strip()
elif line.startswith(u'Author='): elif line.startswith(u'Author='):
song_author = line[7:].strip() song_author = line[7:].strip()
elif line.startswith(u'Copyright='): elif line.startswith(u'Copyright='):
song_copyright = line[10:].strip() self.copyright = line[10:].strip()
elif line.startswith(u'Themes='):
song_topics = line[7:].strip()
elif line.startswith(u'[S A'): elif line.startswith(u'[S A'):
song_ccli = line[4:-3].strip() self.ccli_number = line[4:-3].strip()
elif line.startswith(u'Fields='): elif line.startswith(u'Fields='):
#Fields contain single line indicating verse, chorus, etc, # Fields contain single line indicating verse, chorus, etc,
#/t delimited, same as with words field. store seperately # /t delimited, same as with words field. store seperately
#and process at end. # and process at end.
song_fields = line[7:].strip() song_fields = line[7:].strip()
elif line.startswith(u'Words='): elif line.startswith(u'Words='):
song_words = line[6:].strip() song_words = line[6:].strip()
#Unhandled usr keywords:Type,Version,Admin,Themes,Keys # Unhandled usr keywords: Type, Version, Admin, Keys
#Process Fields and words sections # Process Fields and words sections.
check_first_verse_line = False check_first_verse_line = False
field_list = song_fields.split(u'/t') field_list = song_fields.split(u'/t')
words_list = song_words.split(u'/t') words_list = song_words.split(u'/t')
for counter in range(0, len(field_list)): for counter in range(0, len(field_list)):
if field_list[counter].startswith(u'Ver'): if field_list[counter].startswith(u'Ver'):
verse_type = u'V' verse_type = VerseType.Tags[VerseType.Verse]
elif field_list[counter].startswith(u'Ch'): elif field_list[counter].startswith(u'Ch'):
verse_type = u'C' verse_type = VerseType.Tags[VerseType.Chorus]
elif field_list[counter].startswith(u'Br'): elif field_list[counter].startswith(u'Br'):
verse_type = u'B' verse_type = VerseType.Tags[VerseType.Bridge]
else: #Other else:
verse_type = u'O' verse_type = VerseType.Tags[VerseType.Other]
check_first_verse_line = True check_first_verse_line = True
verse_text = unicode(words_list[counter]) verse_text = unicode(words_list[counter])
verse_text = verse_text.replace(u'/n', u'\n') verse_text = verse_text.replace(u'/n', u'\n')
verse_lines = verse_text.split(u'\n', 1) verse_lines = verse_text.split(u'\n', 1)
if check_first_verse_line: if check_first_verse_line:
if verse_lines[0].startswith(u'(PRE-CHORUS'): if verse_lines[0].startswith(u'(PRE-CHORUS'):
verse_type = u'P' verse_type = VerseType.Tags[VerseType.PreChorus]
log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0]) log.debug(u'USR verse PRE-CHORUS: %s', verse_lines[0])
verse_text = verse_lines[1] verse_text = verse_lines[1]
elif verse_lines[0].startswith(u'(BRIDGE'): elif verse_lines[0].startswith(u'(BRIDGE'):
verse_type = u'B' verse_type = VerseType.Tags[VerseType.Bridge]
log.debug(u'USR verse BRIDGE') log.debug(u'USR verse BRIDGE')
verse_text = verse_lines[1] verse_text = verse_lines[1]
elif verse_lines[0].startswith(u'('): elif verse_lines[0].startswith(u'('):
verse_type = u'O' verse_type = VerseType.Tags[VerseType.Other]
verse_text = verse_lines[1] verse_text = verse_lines[1]
if len(verse_text) > 0: if len(verse_text) > 0:
self.add_verse(verse_text, verse_type) self.add_verse(verse_text, verse_type)
check_first_verse_line = False check_first_verse_line = False
#Handle multiple authors # Handle multiple authors
author_list = song_author.split(u'/') author_list = song_author.split(u'/')
if len(author_list) < 2: if len(author_list) < 2:
author_list = song_author.split(u'|') author_list = song_author.split(u'|')
@ -204,16 +217,13 @@ class CCLIFileImport(SongImport):
self.add_author(u' '.join(reversed(separated))) self.add_author(u' '.join(reversed(separated)))
else: else:
self.add_author(author) self.add_author(author)
self.title = song_name self.topics = [topic.strip() for topic in song_topics.split(u'/t')]
self.copyright = song_copyright
self.ccli_number = song_ccli
self.finish() self.finish()
def do_import_txt_file(self, textList): def do_import_txt_file(self, textList):
""" """
The :func:`do_import_txt_file` method provides OpenLP The :func:`do_import_txt_file` method provides OpenLP with the ability
with the ability to import CCLI SongSelect songs in to import CCLI SongSelect songs in *TXT* file format.
*TXT* file format
``textList`` ``textList``
An array of strings containing the txt file content. An array of strings containing the txt file content.
@ -243,12 +253,10 @@ class CCLIFileImport(SongImport):
""" """
log.debug(u'TXT file text: %s', textList) log.debug(u'TXT file text: %s', textList)
self.set_defaults()
line_number = 0 line_number = 0
check_first_verse_line = False check_first_verse_line = False
verse_text = u'' verse_text = u''
song_comments = u'' song_author = u''
song_copyright = u''
verse_start = False verse_start = False
for line in textList: for line in textList:
clean_line = line.strip() clean_line = line.strip()
@ -258,12 +266,12 @@ class CCLIFileImport(SongImport):
elif verse_start: elif verse_start:
if verse_text: if verse_text:
self.add_verse(verse_text, verse_type) self.add_verse(verse_text, verse_type)
verse_text = '' verse_text = u''
verse_start = False verse_start = False
else: else:
#line_number=0, song title #line_number=0, song title
if line_number == 0: if line_number == 0:
song_name = clean_line self.title = clean_line
line_number += 1 line_number += 1
#line_number=1, verses #line_number=1, verses
elif line_number == 1: elif line_number == 1:
@ -271,37 +279,37 @@ class CCLIFileImport(SongImport):
if clean_line.startswith(u'CCLI'): if clean_line.startswith(u'CCLI'):
line_number += 1 line_number += 1
ccli_parts = clean_line.split(' ') ccli_parts = clean_line.split(' ')
song_ccli = ccli_parts[len(ccli_parts)-1] self.ccli_number = ccli_parts[len(ccli_parts) - 1]
elif not verse_start: elif not verse_start:
# We have the verse descriptor # We have the verse descriptor
verse_desc_parts = clean_line.split(' ') verse_desc_parts = clean_line.split(u' ')
if len(verse_desc_parts) == 2: if len(verse_desc_parts) == 2:
if verse_desc_parts[0].startswith(u'Ver'): if verse_desc_parts[0].startswith(u'Ver'):
verse_type = u'V' verse_type = VerseType.Tags[VerseType.Verse]
elif verse_desc_parts[0].startswith(u'Ch'): elif verse_desc_parts[0].startswith(u'Ch'):
verse_type = u'C' verse_type = VerseType.Tags[VerseType.Chorus]
elif verse_desc_parts[0].startswith(u'Br'): elif verse_desc_parts[0].startswith(u'Br'):
verse_type = u'B' verse_type = VerseType.Tags[VerseType.Bridge]
else: else:
#we need to analyse the next line for # we need to analyse the next line for
#verse type, so set flag # verse type, so set flag
verse_type = u'O' verse_type = VerseType.Tags[VerseType.Other]
check_first_verse_line = True check_first_verse_line = True
verse_number = verse_desc_parts[1] verse_number = verse_desc_parts[1]
else: else:
verse_type = u'O' verse_type = VerseType.Tags[VerseType.Other]
verse_number = 1 verse_number = 1
verse_start = True verse_start = True
else: else:
#check first line for verse type # check first line for verse type
if check_first_verse_line: if check_first_verse_line:
if line.startswith(u'(PRE-CHORUS'): if line.startswith(u'(PRE-CHORUS'):
verse_type = u'P' verse_type = VerseType.Tags[VerseType.PreChorus]
elif line.startswith(u'(BRIDGE'): elif line.startswith(u'(BRIDGE'):
verse_type = u'B' verse_type = VerseType.Tags[VerseType.Bridge]
# Handle all other misc types # Handle all other misc types
elif line.startswith(u'('): elif line.startswith(u'('):
verse_type = u'O' verse_type = VerseType.Tags[VerseType.Other]
else: else:
verse_text = verse_text + line verse_text = verse_text + line
check_first_verse_line = False check_first_verse_line = False
@ -313,24 +321,19 @@ class CCLIFileImport(SongImport):
#line_number=2, copyright #line_number=2, copyright
if line_number == 2: if line_number == 2:
line_number += 1 line_number += 1
song_copyright = clean_line self.copyright = clean_line
#n=3, authors #n=3, authors
elif line_number == 3: elif line_number == 3:
line_number += 1 line_number += 1
song_author = clean_line song_author = clean_line
#line_number=4, comments lines before last line #line_number=4, comments lines before last line
elif (line_number == 4) and \ elif line_number == 4 and not clean_line.startswith(u'CCL'):
(not clean_line.startswith(u'CCL')): self.comments += clean_line
song_comments = song_comments + clean_line
# split on known separators # split on known separators
author_list = song_author.split(u'/') author_list = song_author.split(u'/')
if len(author_list) < 2: if len(author_list) < 2:
author_list = song_author.split(u'|') author_list = song_author.split(u'|')
#Clean spaces before and after author names # Clean spaces before and after author names.
for author_name in author_list: for author_name in author_list:
self.add_author(author_name.strip()) self.add_author(author_name.strip())
self.title = song_name
self.copyright = song_copyright
self.ccli_number = song_ccli
self.comments = song_comments
self.finish() self.finish()

View File

@ -394,10 +394,7 @@ if __name__ == '__main__':
--template Info.plist.master \ --template Info.plist.master \
--expandto %(target_directory)s/Info.plist' \ --expandto %(target_directory)s/Info.plist' \
% { 'config_file' : options.config, 'target_directory' : os.getcwd() }) % { 'config_file' : options.config, 'target_directory' : os.getcwd() })
os.system('python expander.py --config %(config_file)s \ os.system('python get_version.py > .version')
--template version.master \
--expandto %(target_directory)s/.version' \
% { 'config_file' : options.config, 'target_directory' : os.getcwd() })
# prepare variables # prepare variables
app_name_lower = settings['openlp_appname'].lower() app_name_lower = settings['openlp_appname'].lower()

View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from bzrlib.branch import Branch
def get_version(path):
b = Branch.open_containing(path)[0]
b.lock_read()
result = '0.0.0'
try:
# Get the branch's latest revision number.
revno = b.revno()
# Convert said revision number into a bzr revision id.
revision_id = b.dotted_revno_to_revision_id((revno,))
# Get a dict of tags, with the revision id as the key.
tags = b.tags.get_reverse_tag_dict()
# Check if the latest
if revision_id in tags:
result = tags[revision_id][0]
else:
result = '%s-bzr%s' % (sorted(b.tags.get_tag_dict().keys())[-1], revno)
finally:
b.unlock()
return result
def get_path():
if len(sys.argv) > 1:
return os.path.abspath(sys.argv[1])
else:
return os.path.abspath('.')
if __name__ == u'__main__':
path = get_path()
print get_version(path)

View File

@ -2,7 +2,6 @@
openlp_appname = OpenLP openlp_appname = OpenLP
openlp_dmgname = OpenLP-1.9.4-bzrXXXX openlp_dmgname = OpenLP-1.9.4-bzrXXXX
openlp_version = XXXX openlp_version = XXXX
openlp_full_version = 1.9.4-latest
openlp_basedir = /Users/openlp/trunk openlp_basedir = /Users/openlp/trunk
openlp_icon_file = openlp-logo-with-text.icns openlp_icon_file = openlp-logo-with-text.icns
openlp_dmg_icon_file = openlp-logo-420x420.png openlp_dmg_icon_file = openlp-logo-420x420.png

View File

@ -1 +0,0 @@
%(openlp_full_version)s