Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. from mutagen.mp4 import MP4
  2. from mutagen.easyid3 import EasyID3
  3. import os
  4.  
  5. albums = next(os.walk('.'))[1]
  6.  
  7. for album in albums:
  8.     songs = [f for f in os.listdir(album) if f.endswith(".mp3") or f.endswith(".m4a")]
  9.     for song in songs:
  10.         print("Albumizing {}/{}...".format(album, song))
  11.         try:
  12.             if song.endswith(".mp3"):
  13.                 song = EasyID3("{}/{}".format(album, song))
  14.                 song["album"] = album
  15.                 song.save()
  16.                 # print(song)
  17.             elif song.endswith(".m4a"):
  18.                 song = MP4("{}/{}".format(album, song))
  19.                 song["\xa9alb"] = [album]
  20.                 song.save()
  21.                 # print(song)
  22.         except:
  23.             print("Failed to albumize, fuck :(")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement