SHARE
TWEET

Untitled

a guest Oct 21st, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 :(")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top