Here's a little trivial patch to musicxml2ly.  The attached MusicXML file 
triggers the fixed problem and was generated by Sibelius' internal MusicXML 
export functionality (not Dolet).

Best,
Thomas Weber
>From 12576c27e26693832659602bf883a3d08b04fa78 Mon Sep 17 00:00:00 2001
From: Thomas Weber <t...@notabit.eu>
Date: Sun, 13 Dec 2015 17:12:57 +0100
Subject: [PATCH] musicxml2ly: Make sure movement_title exists before using it

---
 scripts/musicxml2ly.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py
index dda374d..5cf5333 100644
--- a/scripts/musicxml2ly.py
+++ b/scripts/musicxml2ly.py
@@ -178,7 +178,7 @@ def extract_score_information (tree):
     if work:
         work_title = work.get_work_title ()
         set_if_exists ('title', work_title)
-        if work_title == '':
+        if work_title == '' and movement_title :
             set_if_exists ('title', movement_title.get_text ())
         elif movement_title:
             set_if_exists ('subtitle', movement_title.get_text ())
-- 
1.9.1

<?xml version="1.0" encoding='UTF-8' standalone='no' ?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd";>
<score-partwise version="3.0">
 <work>
  <work-title />
 </work>
 <identification>
  <rights>Copyright © </rights>
  <encoding>
   <encoding-date>2015-12-13</encoding-date>
   <encoder>tom</encoder>
   <software>Sibelius 8.0.0</software>
   <software>Direct export, not from Dolet</software>
   <encoding-description>Sibelius / MusicXML 3.0</encoding-description>
   <supports element="print" type="yes" value="yes" attribute="new-system" />
   <supports element="print" type="yes" value="yes" attribute="new-page" />
   <supports element="accidental" type="yes" />
   <supports element="beam" type="yes" />
   <supports element="stem" type="yes" />
  </encoding>
 </identification>
 <defaults>
  <scaling>
   <millimeters>210</millimeters>
   <tenths>1200</tenths>
  </scaling>
  <page-layout>
   <page-height>1697</page-height>
   <page-width>1200</page-width>
   <page-margins type="both">
    <left-margin>72</left-margin>
    <right-margin>72</right-margin>
    <top-margin>72</top-margin>
    <bottom-margin>72</bottom-margin>
   </page-margins>
  </page-layout>
  <system-layout>
   <system-margins>
    <left-margin>22</left-margin>
    <right-margin>0</right-margin>
   </system-margins>
   <system-distance>92</system-distance>
  </system-layout>
  <appearance>
   <line-width type="stem">0.9375</line-width>
   <line-width type="beam">5</line-width>
   <line-width type="staff">0.9375</line-width>
   <line-width type="light barline">1.5625</line-width>
   <line-width type="heavy barline">5</line-width>
   <line-width type="leger">1.5625</line-width>
   <line-width type="ending">1.5625</line-width>
   <line-width type="wedge">1.25</line-width>
   <line-width type="enclosure">0.9375</line-width>
   <line-width type="tuplet bracket">1.25</line-width>
   <line-width type="bracket">5</line-width>
   <line-width type="dashes">1.5625</line-width>
   <line-width type="extend">0.9375</line-width>
   <line-width type="octave shift">1.5625</line-width>
   <line-width type="pedal">1.5625</line-width>
   <line-width type="slur middle">1.5625</line-width>
   <line-width type="slur tip">0.625</line-width>
   <line-width type="tie middle">1.5625</line-width>
   <line-width type="tie tip">0.625</line-width>
   <note-size type="cue">75</note-size>
   <note-size type="grace">60</note-size>
  </appearance>
  <music-font font-family="Opus Std" font-size="19.8425" />
  <lyric-font font-family="Plantin MT Std" font-size="11.4715" />
  <lyric-language xml:lang="de" />
 </defaults>
 <part-list>
  <score-part id="P1">
   <part-name>P1</part-name>
   <score-instrument id="P1-I1">
    <instrument-name> </instrument-name>
    <virtual-instrument>
     <virtual-library>General MIDI</virtual-library>
     <virtual-name>Bright Piano</virtual-name>
    </virtual-instrument>
   </score-instrument>
  </score-part>
 </part-list>
 <part id="P1">
  <!--============== Part: P1, Measure: 1 ==============-->
  <measure number="1" width="1032">
   <print new-page="yes">
    <system-layout>
     <system-margins>
      <left-margin>22</left-margin>
      <right-margin>0</right-margin>
     </system-margins>
     <top-system-distance>218</top-system-distance>
    </system-layout>
   </print>
   <attributes>
    <divisions>256</divisions>
    <key color="#000000">
     <fifths>0</fifths>
     <mode>major</mode>
    </key>
    <time color="#000000">
     <beats>4</beats>
     <beat-type>4</beat-type>
    </time>
    <staves>1</staves>
    <clef number="1" color="#000000">
     <sign>G</sign>
     <line>2</line>
    </clef>
    <staff-details number="1" print-object="yes" />
   </attributes>
   <note default-x="43">
    <rest />
    <duration>1024</duration>
    <instrument id="P1-I1" />
    <voice>1</voice>
    <type>whole</type>
    <staff>1</staff>
   </note>
   <barline>
    <bar-style>light-heavy</bar-style>
   </barline>
  </measure>
 </part>
</score-partwise>
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to