From 5696f5d649cb847c17abbc56c9169498d020ac54 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Thu, 30 Aug 2007 22:34:22 +0000 Subject: [PATCH] Improve robustness --- Filters/VLMusicXMLType.writer | 16 ++++++++++------ Filters/plistReader.rb | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Filters/VLMusicXMLType.writer b/Filters/VLMusicXMLType.writer index 876b1f5..7d0e9e4 100755 --- a/Filters/VLMusicXMLType.writer +++ b/Filters/VLMusicXMLType.writer @@ -35,10 +35,14 @@ def _identification poet.add_attribute('type', 'poet') ident.add_element(poet) encoding = REXML::Element.new('encoding') - date = newTextElement('encoding-date', INPUT['saved'].strftime("%Y-%m-%d")) - encoding.add_element(date) - software = newTextElement('software', INPUT['software']) - encoding.add_element(software) + if INPUT['saved'] + date = newTextElement('encoding-date', INPUT['saved'].strftime("%Y-%m-%d")) + encoding.add_element(date) + end + if INPUT['software'] + software = newTextElement('software', INPUT['software']) if INPUT['software'] + encoding.add_element(software) + end ident.add_element(encoding) return ident @@ -215,7 +219,7 @@ def _melody end meas['melody'].each do |note| dur = (note['durNum'] * $DIVISIONS * 4) / note['durDenom'] - n = _note(note['pitch'], dur, note['tied']) + n = _note(note['pitch'], dur, note['tied'] || 0) stanza = 1 note['lyrics'].each do |syll| if syll['text'] @@ -226,7 +230,7 @@ def _melody n.add_element(lyr) end stanza += 1 - end + end if note['lyrics'] m.add_element(n) end if r = meas['end-repeat'] diff --git a/Filters/plistReader.rb b/Filters/plistReader.rb index fee4754..d48ff50 100644 --- a/Filters/plistReader.rb +++ b/Filters/plistReader.rb @@ -47,7 +47,7 @@ class PlistListener def text(text) case @kind when "string", "key" then - @obj = text + @obj += text when "data" then @obj = Base64.decode(text) when "date" then