def Run(fname): parser = MxmlParser.MxmlParser() try: pieceObj = parser.parse(fname) except BaseException as e: return [fname, str(e)] render = LilypondOutput.LilypondRenderer(pieceObj, fname) try: render.run() except Exception as e: return [render.lyfile, str(e)] if not os.path.exists(render.pdf): return render.lyfile
def startRenderingTask(self, fname): """ method which parses a piece, then runs the renderer class on it which takes the lilypond output, runs lilypond on it and gets the pdf. This is not generally called directly, but rather called by a thread class in thread_classes.py * Parameter fname: xml filename * Return value: list of problems encountered """ errorList = [] parser = MxmlParser.MxmlParser() piece_obj = None path_to_file = os.path.join(self.folder, fname) try: piece_obj = parser.parse(path_to_file) except Exceptions.DrumNotImplementedException as e: errorList.append( "Drum tab found in piece: this application does not handle drum tab.") logger.exception( "Drum tab found in piece:{} - {}".format(fname, str(e))) except Exceptions.TabNotImplementedException as e: errorList.append( "Guitar tab found in this piece: this application does not handle guitar tab.") logger.exception( "Guitar tab found in piece:{} - {}".format(fname, str(e))) except SAXParseException as e: errorList.append( "Sax parser had a problem with this file:" + str(e)) logger.exception( "Exception SAX parsing file:{} - {}".format(fname, str(e))) try: loader = LilypondOutput.LilypondRenderer( piece_obj, os.path.join( self.folder, fname)) loader.run() except BaseException as e: errorList.append(str(e)) logger.exception( "Exception rendering lilypond with file:{} - {}".format(fname, str(e))) return errorList
def setUp(self): self.parser = MxmlParser.MxmlParser() self.tag_list = [] self.attrs = [] self.parser.piece.addPart(Part.Part(), index="P1") self.parser.tags.append("part") self.parser.attribs["part"] = {"id": "P1"} self.parser.StartTag("measure", {"number": "1"}) self.parser.StartTag("divisions", {}) self.parser.NewData("8") self.parser.EndTag("divisions") self.parser.StartTag("note", {}) self.parser.StartTag("duration", {}) self.parser.NewData("16") self.parser.EndTag("duration") self.parser.EndTag("note") self.parser.StartTag("note", {}) self.parser.StartTag("duration", {}) self.parser.NewData("16") self.parser.EndTag("duration") self.parser.EndTag("note") self.parser.data["staff_id"] = 2 self.parser.StartTag("note", {}) self.parser.StartTag("divisions", {}) self.parser.NewData("8") self.parser.EndTag("divisions") self.parser.StartTag("note", {}) self.parser.StartTag("duration", {}) self.parser.NewData("16") self.parser.EndTag("duration") self.parser.EndTag("note") self.parser.StartTag("note", {}) self.parser.StartTag("duration", {}) self.parser.NewData("16") self.parser.EndTag("duration") self.parser.EndTag("note") self.parser.data["staff_id"] = 1 self.measure = self.parser.piece.getPart("P1").getMeasure(1, 1)
def setUp(self): self.file = os.path.join(folder, "arpeggiosAndGlissandos.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) self.dontcleanup = True testRun.setUp(self)
def testRun(self): with self.assertRaises(Exceptions.DrumNotImplementedException): parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file)
def setUp(self): self.file = os.path.join(folder, "accidentals.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "two_staves_one_part.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "TrillsFermataOrnaments.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) self.dontcleanup = True testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "multiple_parts.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "fingering.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "duration_and_stem_direction.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.parser = MxmlParser.MxmlParser() self.tag_list = [] self.attrs = []
def parsePiece(name): parser = MxmlParser.MxmlParser() return parser.parse(name)
def setUp(self): self.fname = "" self.note_num = 0 self.parser = MxmlParser.MxmlParser() self.folder = "/Users/charlottegodley/PycharmProjects/FYP/implementation/primaries/SampleMusicXML/testcases"
def setUp(self): self.file = os.path.join(folder, "repeat-barlines.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "breathMarks.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) self.dontcleanup = True testRun.setUp(self)
def setUp(self): self.file = os.path.join(folder, "keySignatures.xml") parser = MxmlParser.MxmlParser() self.item = parser.parse(self.file) testRun.setUp(self)