-
Notifications
You must be signed in to change notification settings - Fork 0
/
findtracks.pl
executable file
·49 lines (41 loc) · 1 KB
/
findtracks.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /usr/bin/perl
#
# Find and print ardour tracks
#
# Usage: findtracks.pl [ardour session file]
use strict;
use warnings;
use XML::LibXML;
my $session_file;
my $session;
my $track;
my $root;
my $value;
my @nodelist;
my $i;
my $numargs = @ARGV;
if ( $numargs > 0 ) {
$session_file = $ARGV[0];
}
else {
die "Usage: findtracks [ardour session file]\n";
}
if ( defined($session_file) ) {
$session = XML::LibXML->load_xml( location => $session_file );
$root = $session->documentElement();
$value = $root->nodeName;
if ( $value ne "Session" ) { die "This is not an Ardour session"; }
$value = $root->getAttribute("version");
if ( $value ne "3001" && $value ne "3002" ) {
die "This Ardour session version is not supported";
}
@nodelist = $root->findnodes("/Session/Routes/Route");
foreach $track (@nodelist) {
$value = $track->getAttribute("name");
print($value);
print(" ");
}
}
else {
print "Usage: findtracks [ardour session file]\n";
}