forked from openlp/openlp
Make zionwork imported work with python3
Fixes: https://launchpad.net/bugs/1510282
This commit is contained in:
parent
50ceb568e5
commit
85f034abdd
@ -75,7 +75,7 @@ class ZionWorxImport(SongImport):
|
|||||||
"""
|
"""
|
||||||
Receive a CSV file (from a ZionWorx database dump) to import.
|
Receive a CSV file (from a ZionWorx database dump) to import.
|
||||||
"""
|
"""
|
||||||
with open(self.import_source, 'rb') as songs_file:
|
with open(self.import_source, 'rt') as songs_file:
|
||||||
field_names = ['SongNum', 'Title1', 'Title2', 'Lyrics', 'Writer', 'Copyright', 'Keywords',
|
field_names = ['SongNum', 'Title1', 'Title2', 'Lyrics', 'Writer', 'Copyright', 'Keywords',
|
||||||
'DefaultStyle']
|
'DefaultStyle']
|
||||||
songs_reader = csv.DictReader(songs_file, field_names)
|
songs_reader = csv.DictReader(songs_file, field_names)
|
||||||
@ -123,8 +123,7 @@ class ZionWorxImport(SongImport):
|
|||||||
|
|
||||||
def _decode(self, str):
|
def _decode(self, str):
|
||||||
"""
|
"""
|
||||||
Decodes CSV input to unicode, stripping all control characters (except new lines).
|
Strips all control characters (except new lines).
|
||||||
"""
|
"""
|
||||||
# This encoding choice seems OK. ZionWorx has no option for setting the
|
# ZionWorx has no option for setting the encoding for its songs, so we assume encoding is always the same.
|
||||||
# encoding for its songs, so we assume encoding is always the same.
|
return str.translate(CONTROL_CHARS_MAP)
|
||||||
return str(str, 'cp1252').translate(CONTROL_CHARS_MAP)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user