Skip to content

Instantly share code, notes, and snippets.

@utgwkk
Last active December 6, 2022 12:27
Show Gist options
  • Save utgwkk/8366805 to your computer and use it in GitHub Desktop.
Save utgwkk/8366805 to your computer and use it in GitHub Desktop.
Making m3u playlist automatically
rem Execute it in the directory which includes music files
rem It requires one argument which will become created m3u playlist file's name
for %%i in (*.mp3,*.mp4,*.m4a,*.wma,*.wav) do echo %cd%\%%i >> %1.m3u
# -*- encoding: utf-8 -*-
# Execute it in the directory which includes music files
import os.path, glob
exts = ('mp3','mp4','m4a','wma','wav')
files = []
for e in exts: files.extend(glob.glob('*.%s'%e))
output = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
with open(output+'.m3u','w') as f:
for fname in files:
f.write('%s\n'%os.path.abspath(fname))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment