Skip to content

Instantly share code, notes, and snippets.

@antont
Last active June 18, 2023 13:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antont/63c1478b57b49fc60de23086a82e92e2 to your computer and use it in GitHub Desktop.
Save antont/63c1478b57b49fc60de23086a82e92e2 to your computer and use it in GitHub Desktop.
Serato History CSV to Mixcloud compatible CUE converter, with time offset
import csv
import datetime
session_start_time = datetime.datetime(2018, 8, 31, 22, 57, 27)
print("FILE \"swingit_vol1.mp3\" MP3")
with open('edit-31.8.2018.csv') as csvfile:
reader = csv.reader(csvfile)
for idx, row in enumerate(reader):
#print(', '.join(row))
#print("row: %s, %d" % (row, len(row)))
name, start, end, dur, deck, notes, _ = row
try:
artist, song = name.split(' - ')
except ValueError:
print(name)
raise
#print("%s\t%s\t%s\t " % (start, artist, song))
hour, minute, sec = map(int, start.split('.'))
if hour > 22:
day = 31
month = 8
else:
day = 1
month = 9
start_time = datetime.datetime(2018, month, day, hour, minute, sec)
start_in_set = start_time - session_start_time
minute = start_in_set.seconds / 60
second = start_in_set.seconds % 60
print(
"""TRACK %d AUDIO
\tTITLE "%s"
\tPERFORMER "%s"
\tINDEX 01 %d:%d:%s""" %
(idx, song, artist, minute, second, "00")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment