Browse Source

Make SongbookBuilder.logger optional

pull/25/head
Louis 11 years ago
parent
commit
106a00efbd
  1. 5
      songbook_core/build.py

5
songbook_core/build.py

@ -152,7 +152,7 @@ class SongbookBuilder(object):
# are function; values are return values of functions. # are function; values are return values of functions.
_called_functions = {} _called_functions = {}
def __init__(self, raw_songbook, basename, logger): def __init__(self, raw_songbook, basename, logger=None):
# Representation of the .sb songbook configuration file. # Representation of the .sb songbook configuration file.
self.songbook = Songbook(raw_songbook, basename) self.songbook = Songbook(raw_songbook, basename)
# Basename of the songbook to be built. # Basename of the songbook to be built.
@ -237,7 +237,8 @@ class SongbookBuilder(object):
"""Make index""" """Make index"""
sxd_files = glob.glob("%s_*.sxd" % self.basename) sxd_files = glob.glob("%s_*.sxd" % self.basename)
for sxd_file in sxd_files: for sxd_file in sxd_files:
self.logger.info("processing " + sxd_file) if self.logger:
self.logger.info("processing " + sxd_file)
idx = process_sxd(sxd_file) idx = process_sxd(sxd_file)
with open(sxd_file[:-3] + "sbx", "w") as index_file: with open(sxd_file[:-3] + "sbx", "w") as index_file:
index_file.write(idx.entries_to_str().encode('utf8')) index_file.write(idx.entries_to_str().encode('utf8'))

Loading…
Cancel
Save