Bulk session metadata editing

I have a number of Ardour sessions - for the sake of the argument, let’s say I have about 100 sessions. I’d like to review metadata of these sessions. There are too many for me to open each session individually. I also need to compare certain fields across sessions. For example:

  • Is the album name exactly the same in all the tracks of said album?
  • Are the track numbers correct?
  • Is the artist name correct in all the tracks?

I’d like to see an overall view, something like many id3 tag editors offer; a tabular view. Does anything like that exist?

I’m imagining, since Ardour session format is transparent, it should be possible to write a program that does something like that. Has this been done before?

Or is there a better way of reviewing and updating metadata of a large number of Ardour sessions?

Not that I am aware of.

You are correct in that it is certainly possible, and is in fact part of the reason why Ardour sticks with that format is because it is transparent so that you are never truly locked away from your data.

This particular use case has not been done before that I know of, no.

   Seablade
1 Like

Given the straightforward XML format of the .ardour session file, the query part is a “simple matter of programming” (LOL). E.g., this Python script runs on my Ardour sessions just fine, given that my system Python already has the lxml package installed:

#/usr/bin/python3
import pathlib
import sys

from lxml.etree import parse


def parse_ardour_metadata(fn):

    fqn = pathlib.Path(fn).absolute()

    if not fqn.is_file():
        raise ValueError(f"Not a file: {fn}")

    tree = parse(fn)

    for metadata in tree.xpath("/Session/Metadata/*"):
        print(f"{metadata.tag}: {metadata.text}")
    

def main(argv):
    for arg in argv:
        print("=" * 60)
        print(arg)
        print("=" * 60)
        parse_ardour_metadata(arg)
        print()


if __name__ == "__main__":
    main(sys.argv[1:])

Running it like so:

$ python3 /path/to/query_ardour_metadata.py  all-modern-cons/*.ardour
============================================================
all-modern-cons/all-modern-cons.ardour
============================================================
album: Febrile (FAWM 2018)
album_artist: Tres Seaver
arranger: Tres Seaver
artist: Tres Seaver
composer: Tres Seaver
copyright: 2018
engineer: Tres Seaver
lyricist: Tres Seaver
mixer: Tres Seaver
producer: Tres Seaver
year: 2018
1 Like

Hey, that’s very cool!

I guess you could imagine a process where you first extract metadata from a set of Ardour sessions, then edit them together (like in a spreadsheet or something), and then put them back.

Or you might imagine a CLI tool that would set a certain metadata entry to a certain value in bulk. I guess that would be the first things I’d try to do as far as writing metadata. Then I could set the album name across all the album tracks - Ardour sessions.