Skip to content

Instantly share code, notes, and snippets.

@gsuberland
Created September 24, 2025 01:25
Show Gist options
  • Save gsuberland/eb2e762595e9abb72a569f46089efa33 to your computer and use it in GitHub Desktop.
Save gsuberland/eb2e762595e9abb72a569f46089efa33 to your computer and use it in GitHub Desktop.
script to find tracks that have skewed cue positions in rekordbox
from pyrekordbox import Rekordbox6Database
from pyrekordbox.db6 import tables
import sqlalchemy
from uuid import uuid4
import datetime
db = Rekordbox6Database(key='this is not actually the key you will need this from somewhere else *ahem*')
query = db.query(tables.DjmdContent)
results = query.all()
tracks = {}
for track in results:
tracks[track.ID] = track
query = db.query(tables.DjmdCue)
cueTable = tables.DjmdCue
countFn = sqlalchemy.func.count
results = query.order_by(cueTable.InMsec).all()
contentCues = {}
for cue in results:
if (cue.ContentID not in contentCues):
contentCues[cue.ContentID] = []
contentCues[cue.ContentID].append(cue)
print("Found", len(contentCues), "tracks.")
for contentID in contentCues:
cues = contentCues[contentID]
prevTime = None
bpm = tracks[contentID].BPM / 100
bpmScale = bpm / 60000.0
#print("Track", tracks[contentID].ArtistName, "-", tracks[contentID].Title, "is", bpm, "bpm, and has", len(cues), "cues")
for cue in cues:
if prevTime is None:
prevTime = cue.InMsec
continue
delta = cue.InMsec - prevTime
deltaBeats = delta * bpmScale
deltaBeats = round(deltaBeats)
#print("Gap is", deltaBeats, "beats")
if deltaBeats % 4 != 0:
print("Cue on track", tracks[contentID].ArtistName, "-", tracks[contentID].Title, "has cue with gap of", deltaBeats)
#exit()
prevTime = cue.InMsec
print("Done.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment