From 960afe03af277d4575af06a0a904e8bb8ec79e81 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Fri, 18 Nov 2022 09:10:18 -0500 Subject: [PATCH] Create tag_opus.py --- root/scripts/tag_opus.py | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 root/scripts/tag_opus.py 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!');