From c6bd7e96ec39019dc1202c8cb4f984fe19df5b7d Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Sun, 10 Apr 2011 11:42:06 -0700 Subject: [PATCH] archive.py: also merge the metadata Perform the metadata merge step at the end of archive.py, to reduce the number of separate scripts users must run. --- src/archive.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/archive.py b/src/archive.py index 1715fbf..b0e74c1 100755 --- a/src/archive.py +++ b/src/archive.py @@ -7,7 +7,9 @@ from amass import archive from amass import cddb +from amass import file_util from amass import mb +from amass import metadata def main(argv): @@ -27,16 +29,25 @@ def main(argv): print >> sys.stderr, 'trailing arguments: %s' % (args,) return 1 + # Save the data off the physical CD archiver = archive.Archiver(options.device) dir = archiver.archive() if options.archive_only: return os.EX_OK + # Fetch metadata information from CDDB and MusicBrainz toc = dir.album.toc cddb.fetch_cddb(toc, dir) mb.fetch_mb(toc, dir) + # Merge the metadata information + metadata.merge.automerge(dir) + chooser = metadata.merge.CliChooser(dir, 100) + chooser.choose() + with file_util.open_new(dir.layout.getMetadataInfoPath()) as f: + dir.album.writeTracks(f) + if __name__ == '__main__': rc = main(sys.argv)