Timeline: Update ardour session importer to work with ardour3 sessions.

This commit is contained in:
Jonathan Moore Liles 2013-04-29 23:50:05 -07:00
parent a162876025
commit 2f730acefb
1 changed files with 17 additions and 4 deletions

View File

@ -56,7 +56,7 @@ if root.tag != "Session":
sys.exit(1) sys.exit(1)
print "Ardour session file version is " + root.attrib["version"] 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"] ProjectName = root.attrib["name"]
@ -77,6 +77,11 @@ for node in root.findall( "./Sources/Source" ):
Sources[node.attrib["id"]] = node; Sources[node.attrib["id"]] = node;
# print "\tFound source " + node.attrib["name"] # 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." print "Gathering version 2 diskstreams."
for node in root.findall( "./DiskStreams/AudioDiskstream" ): for node in root.findall( "./DiskStreams/AudioDiskstream" ):
DiskStreams[node.attrib["id"]] = node; DiskStreams[node.attrib["id"]] = node;
@ -105,7 +110,12 @@ for node in root.findall("./TempoMap/Tempo"):
for node in root.findall("./TempoMap/Meter"): for node in root.findall("./TempoMap/Meter"):
TimeID = NewID() 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." print "Processing playlists."
@ -114,8 +124,11 @@ for node in root.findall( "./Playlists/Playlist" ):
try: try:
Track = DiskStreams[node.attrib["orig_diskstream_id"]] Track = DiskStreams[node.attrib["orig_diskstream_id"]]
except: except:
print "\tSkipping playlist " + node.attrib["name"] + " for unknown diskstream" try:
continue 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"]: if node.attrib["name"] == Track.attrib["playlist"]: