Created
April 24, 2024 21:51
-
-
Save andreanidouglas/58d74592427381396bbdd108cf3544f5 to your computer and use it in GitHub Desktop.
m3u to mp3 320
This file contains 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 shutil | |
import pathlib | |
from urllib.parse import unquote | |
FILE_PATH="E:\\a-metal1.m3u" | |
def app(): | |
lines = [] | |
with open(FILE_PATH, "r") as f: | |
lines = f.readlines() | |
with open("copy.cmd", "wb") as w1: | |
for line in lines: | |
if line.startswith("#"): | |
continue | |
src = pathlib.Path.joinpath(pathlib.Path("E:\\"), unquote(line).rstrip()) | |
dest = pathlib.Path.joinpath(pathlib.Path("E:\\"), pathlib.Path("0metal"), pathlib.Path(src).stem) | |
#shutil.copyfile(src, dest) | |
#cmd = f'copy /B /V /Y "{src}" "{dest}"\n'.encode('utf-8') | |
cmd = f'ffmpeg -i "{src}" -ab 320k "{dest}.mp3"\n'.encode('utf-8') | |
w1.write(cmd) | |
#print(cmd) | |
if __name__ == "__main__": | |
app() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment