From 2f730acefb3215b79cd2524de43b198c9344b262 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 29 Apr 2013 23:50:05 -0700 Subject: [PATCH] Timeline: Update ardour session importer to work with ardour3 sessions. --- timeline/bin/import-ardour-session | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/timeline/bin/import-ardour-session b/timeline/bin/import-ardour-session index 8564949..9546479 100755 --- a/timeline/bin/import-ardour-session +++ b/timeline/bin/import-ardour-session @@ -56,7 +56,7 @@ if root.tag != "Session": sys.exit(1) print "Ardour session file version is " + root.attrib["version"] -print "This program is known to work with versions <= 2.0.0" +print "This program is known to work with versions <= 3.0.1" ProjectName = root.attrib["name"] @@ -77,6 +77,11 @@ for node in root.findall( "./Sources/Source" ): Sources[node.attrib["id"]] = node; # print "\tFound source " + node.attrib["name"] +print "Gathering version 3 diskstreams." +for node in root.findall( "./Routes/Route/Diskstream" ): + DiskStreams[node.attrib["id"]] = node; + print "\tFound diskstream " + node.attrib["name"]; + print "Gathering version 2 diskstreams." for node in root.findall( "./DiskStreams/AudioDiskstream" ): DiskStreams[node.attrib["id"]] = node; @@ -105,7 +110,12 @@ for node in root.findall("./TempoMap/Tempo"): for node in root.findall("./TempoMap/Meter"): TimeID = NewID() - History.write( "Time_Point " + TimeID + " create :start 0 :beats_per_bar " + node.attrib["beats-per-bar"] + " :beat_type " + node.attrib["note-type"] + "\n") + try: + BPB = node.attrib["beats-per-bar"] + except: + BPB = node.attrib["divisions-per-bar"] + + History.write( "Time_Point " + TimeID + " create :start 0 :beats_per_bar " + BPB + " :beat_type " + node.attrib["note-type"] + "\n") print "Processing playlists." @@ -114,8 +124,11 @@ for node in root.findall( "./Playlists/Playlist" ): try: Track = DiskStreams[node.attrib["orig_diskstream_id"]] except: - print "\tSkipping playlist " + node.attrib["name"] + " for unknown diskstream" - continue + try: + Track = DiskStreams[node.attrib["orig-track-id"]] + except: + print "\tSkipping playlist " + node.attrib["name"] + " for unknown diskstream" + continue if node.attrib["name"] == Track.attrib["playlist"]: