Last active
March 27, 2020 13:57
-
-
Save dav1dddd/69f871a91ff1e5102ce5f1fe471d075c to your computer and use it in GitHub Desktop.
Add ID3 metadata to audio files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eyed3 | |
import os | |
import chalk | |
mp3list = [] | |
prompt = chalk.magenta('> ') | |
def func(): | |
dir = os.listdir("./") | |
for file in dir: | |
if file.endswith(".mp3"): | |
mp3list.append(file) | |
print(f"mp3 files in current directory: {chalk.cyan(mp3list)}") | |
try: | |
load = eyed3.load(input(f"{prompt}Enter a song on your local file system: ")) | |
load.tag.title = input(f"{prompt}Enter a title for this song: ") | |
load.tag.artist = input(f"{prompt}Enter the artist: ") | |
load.tag.album = input(f"{prompt}Enter the album: ") | |
load.tag.track_num = input(f"{prompt}Enter the track number: ") | |
load.tag.save() | |
except (OSError, ValueError) as e: | |
if OSError: | |
print(f"mp3 {e}") | |
else: | |
return | |
func() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment