Some people asked me how I convert djay csv files to a more univerally compatible m3u playlist, so I decided to post my solution here.
The Bad News:
This solution, is not end-user friendly. It’s written in Python, so you have to know, or be willing to learn, how to run the code. I created this in macOS, it should work in Windows. I’m not sure about iOS.
The Good News:
It works. You can quickly produce m3u playlists that are easy to backup and import into other software (like iTunes, Serato, Rekordbox, Virtual DJ, Traktor, MP3Tag etc.).
How It Works:
Give the program a .csv file from djay and it will create an .m3u playlist file. For example:
- export a djay playlist as hip-hop.csv
- the code will create an m3u playlist called hip-hop.m3u, that can be dragged directly into iTunes, Serato etc… FYI - double-clicking a .m3u file on a Mac will automatically load it into iTunes.
STEPS TO RUN THE CODE:
Copy/Paste the code into a plain-text file. Give the file a .py extension. For example, createplaylist.py note: I over-documented the code, so you can see what every line does.
# python modules import os # command line utilities import csv # file utilties import urllib.parse # decode URL to File Path from tkinter import filedialog # graphical interface # Main Function Definition def createM3U(): # Set Files and Directories csvFile = filedialog.askopenfilename() # ask user for csv file m3uFile = csvFile.rstrip(".csv") + ".m3u" # m3u playlist name dirName = os.path.dirname(csvFile) # set export directory # Transfer Playlist Data with open(csvFile, 'r') as file: # open csv file csvData = csv.reader(file, delimiter=',') # get csv data with open(m3uFile, 'w') as file: # create m3u file header = next(csvData) # skip header row for row in csvData: # for each audio track # decode URL audioTrack = "/" + urllib.parse.unquote(row.lstrip('file://')) + "\n" file.write(audioTrack) # add track to m3u playlist # Show Files to User (only tested on Mac) os.system('open ' + dirName) # Run Main Function createM3U()
- Running The Code
Command Line Terminal
or python3 createplaylist.py
Python Launcher (GUI)
right-click on the Python file, select Open With > Python Launcher
VS Code (IDE)
For those who are savvy, you can run the python code in an IDE like VS Code.