Skip to content

Instantly share code, notes, and snippets.

@dav1dnix
Last active March 27, 2020 13:57
Show Gist options
  • Save dav1dnix/69f871a91ff1e5102ce5f1fe471d075c to your computer and use it in GitHub Desktop.
Save dav1dnix/69f871a91ff1e5102ce5f1fe471d075c to your computer and use it in GitHub Desktop.
Add ID3 metadata to audio files
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