diff --git a/root/scripts/tag_opus.py b/root/scripts/tag_opus.py new file mode 100644 index 0000000..0129d78 --- /dev/null +++ b/root/scripts/tag_opus.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import os +import sys +import enum +import argparse +from mutagen.oggopus import OggOpus + +parser = argparse.ArgumentParser(description='Optional app description') +# Argument +parser.add_argument('--file', help='A required integer positional argument') +parser.add_argument('--songartist', help='A required integer positional argument') +parser.add_argument('--songalbumartist', help='A required integer positional argument') +args = parser.parse_args() + +filename = args.file +artist = args.songartist +albumartist = args.songalbumartist + +audio = OggOpus(filename) +try: + audio.pop('ALBUMARTIST') +except: + pass +try: + audio.pop('ALBUMARTIST_CREDIT') +except: + pass +try: + audio.pop('ALBUMARTISTSORT') +except: + pass +try: + audio.pop('ALBUM_ARTIST') +except: + pass +try: + audio.pop('ALBUM ARTIST') +except: + pass +try: + audio.pop('ARTISTSORT') +except: + pass + +audio['ARTIST'] = [artist] +audio['ALBUMARTIST'] = [albumartist] + +audio.pprint(); +audio.save(); +#print([filename]); +#print(artist); +#print(albumartist); +#print('Tagged!');