Created
April 16, 2019 21:12
-
-
Save Mohamedemad4/bc9db80f2fa4a0b6aa0c24ffab1756ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
Switch_command="""ffmpeg -i {0}.noMdata.mp3 -i {1} -map 0:0 -map 1:0 -c copy -id3v2_version 3 | |
-metadata:s:v title='{2}' {0}.mp3""" | |
work_dir=sys.argv[1] | |
splice="Kaleo - " | |
artist="Kaleo" | |
album_name="Kaleo Singles" | |
cover="uis/cover.jpg" | |
os.chdir(work_dir) | |
def spliceAll(): | |
for song in os.listdir("."): | |
os.rename(song,song.replace(splice,'')) | |
print(song.replace(splice,'')) | |
def addMetadata(artist,cover,album_name): | |
for song in os.listdir("."): | |
print(song) | |
if song.endswith(".mp3")==False: | |
continue | |
os.rename(song,song+".noMdata") | |
Switch_command.format(song,cover,album_name) | |
def clean(): | |
for song in os.listdir("."): | |
os.rename(song,song.replace(".mp3.noMdata",".mp3")) | |
spliceAll() | |
addMetadata(artist,cover,album_name) | |
clean() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment