Last active
June 18, 2023 13:38
-
-
Save antont/63c1478b57b49fc60de23086a82e92e2 to your computer and use it in GitHub Desktop.
Serato History CSV to Mixcloud compatible CUE converter, with time offset
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 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