Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import frontmatter
  4. import glob
  5. from mutagen.id3 import ID3, TIT2, TPE1, TRCK, TALB
  6. import os
  7.  
  8. try:
  9. post = frontmatter.load('podcast.yaml')
  10. except:
  11. print("podcast.yaml not found or not parseable")
  12.  
  13. if post:
  14. title = post['title']
  15. author = post['author']
  16.  
  17. for audio_file in glob.glob('*.mp3'):
  18. audio = ID3(audio_file)
  19. episode = os.path.splitext(audio_file)[0]
  20. track = [int(s) for s in episode.split() if s.isdigit()]
  21. audio.add(TIT2(encoding=3, text=episode + " - " + title))
  22. audio.add(TPE1(encoding=3, text=author))
  23. audio.add(TALB(encoding=3, text=title))
  24. audio.add(TRCK(encoding=3, text=str(track[0])))
  25. audio.save()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement