From: Reinhold Kainhofer Date: Sat, 4 Apr 2009 13:18:38 +0000 (+0200) Subject: MusicXML: If work-title is empty (but exists), use movement-title instead X-Git-Tag: release/2.13.1-1~56^2~19 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=32d0927f44af08231143eeb216c381b323472c2b;p=lilypond.git MusicXML: If work-title is empty (but exists), use movement-title instead --- diff --git a/input/regression/musicxml/51d-EmptyTitle.xml b/input/regression/musicxml/51d-EmptyTitle.xml new file mode 100644 index 0000000000..49a089bf7a --- /dev/null +++ b/input/regression/musicxml/51d-EmptyTitle.xml @@ -0,0 +1,36 @@ + + + + + + + + + Empty work-title, non-empty movement-title + + + A piece with an empty (but + existing) work-title, but a non-empty movement-title. In this case + the movement-title should be chosen, even though the work-title + exists. + + + + + MusicXML Part + + + + + + + + 4 + 1 + whole + + + + + diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 5a8896c1b0..33c0aca039 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -273,15 +273,15 @@ def extract_score_information (tree): if value: header.set_field (field, musicxml.escape_ly_output_string (value)) + movement_title = tree.get_maybe_exist_named_child ('movement-title') + if movement_title: + set_if_exists ('title', movement_title.get_text ()) work = tree.get_maybe_exist_named_child ('work') if work: + # Overwrite the title from movement-title with work->title set_if_exists ('title', work.get_work_title ()) set_if_exists ('worknumber', work.get_work_number ()) set_if_exists ('opus', work.get_opus ()) - else: - movement_title = tree.get_maybe_exist_named_child ('movement-title') - if movement_title: - set_if_exists ('title', movement_title.get_text ()) identifications = tree.get_named_children ('identification') for ids in identifications: