def open_rpp_project(filePath): rpp = rpp_file.parse_rpp_file(filePath) project = DawProject() project.filePath = filePath rppTracks = rpp.get_nodes_by_tag("TRACK") for rppTrack in rppTracks: track = project.create_track() track.name = rppTrack.get_node_by_tag("NAME").values[0] rppItems = rppTrack.get_nodes_by_tag("ITEM") for rppItem in rppItems: item = track.create_item() item.name = rppItem.get_node_by_tag("NAME").values[0] item.position = rppItem.get_node_by_tag("POSITION").values[0] item.length = rppItem.get_node_by_tag("LENGTH").values[0] source = rppItem.get_node_by_tag("SOURCE") if source: sourceFile = source.get_node_by_tag("FILE") if sourceFile: item.sourceFile = sourceFile.values[0] return project
def test_rpp_file(): fileName = "empty.RPP" dirPath = os.path.join("TestData", "Reaper") print("Read...") root = rpp_file.parse_rpp_file(os.path.join(dirPath, fileName)) print("Write...") rpp_file.write_rpp_file(os.path.join(dirPath, "exportTest.RPP"), root) print("Done.")