Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import frontmatter
- import glob
- from mutagen.id3 import ID3, TIT2, TPE1, TRCK, TALB
- import os
- try:
- post = frontmatter.load('podcast.yaml')
- except:
- print("podcast.yaml not found or not parseable")
- if post:
- title = post['title']
- author = post['author']
- for audio_file in glob.glob('*.mp3'):
- audio = ID3(audio_file)
- episode = os.path.splitext(audio_file)[0]
- track = [int(s) for s in episode.split() if s.isdigit()]
- audio.add(TIT2(encoding=3, text=episode + " - " + title))
- audio.add(TPE1(encoding=3, text=author))
- audio.add(TALB(encoding=3, text=title))
- audio.add(TRCK(encoding=3, text=str(track[0])))
- audio.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement