Skip to content

Instantly share code, notes, and snippets.

@diracdeltas
Last active June 28, 2025 21:22
Show Gist options
  • Select an option

  • Save diracdeltas/7e81285a361f1a3717b777d1e2da0c02 to your computer and use it in GitHub Desktop.

Select an option

Save diracdeltas/7e81285a361f1a3717b777d1e2da0c02 to your computer and use it in GitHub Desktop.
copy all your rekordbox hotcues to memory cues
# usage: python3 hotcues-to-memory-cues.py $XML_FILENAME
# see https://djfile.com/how-import-beatgrids-cue-points-and-tags-using-rekordbox-xml for XML export/import instructions
import xml.etree.ElementTree as ET
import sys
print('converting ' + sys.argv[1])
tree = ET.parse(sys.argv[1])
root = tree.getroot()
for track in root.findall('./COLLECTION/TRACK'):
for position in track.findall('POSITION_MARK'):
child = ET.Element('POSITION_MARK')
child.set('Name', '')
child.set('Type', '0')
child.set('Num', '-1')
child.set('Start', position.get('Start'))
track.append(child)
tree.write('output.xml')
@diracdeltas
Copy link
Author

fixed some bugs and moved this to https://github.com/diracdeltas/rekordbox-scripts

@Tripppdnb
Copy link

Thanks alot for this tool! Saved me hours of work :)

@diracdeltas
Copy link
Author

diracdeltas commented Aug 16, 2019 via email

@rarefakt
Copy link

Thanks for this. I had a specific use-case where thousands of tracks had a single hot cue around the first beat of the track that I wanted to convert to memory cues and used your program as a base. Posting this here in case anyone has a similar problem.

# usage: python3 1hot2memory.py $RB_XML_INPUT $RB_XML_OUTPUT

# Finds all tracks in rekordbox.xml with a single hot cue named '1.1Bars', and converts it to a memory cue.

# https://forums.pioneerdj.com/hc/en-us/community/posts/205639093-Convert-Hot-Cues-to-Memory-Cues
# See https://djfile.com/how-import-beatgrids-cue-points-and-tags-using-rekordbox-xml for XML export/import instructions
# Inspired by https://gist.github.com/diracdeltas/7e81285a361f1a3717b777d1e2da0c02

import xml.etree.ElementTree as ET
import sys

print(f'converting {sys.argv[1]} to {sys.argv[2]}')

tree = ET.parse(sys.argv[1])
root = tree.getroot()

for track in root.findall('./COLLECTION/TRACK'):
    position_marks = track.findall('POSITION_MARK')
    if len(position_marks) == 1:
        # Found track with single cue point.
        child = position_marks[0]

        # If single cue point is a memory cue, do nothing.
        if child.get('Num') == '-1':
            continue
        # If single cue point is not named "1.1Bars" by Rekordbox analysis, do nothing.
        if child.get('Name') != '1.1Bars':
            continue

        print('converting single hot cue to memory cue for:', track.get('Artist'), ' - ', track.get('Name'))

        child_new = ET.Element('POSITION_MARK')
        child_new.set('Name', child.get('Name'))
        child_new.set('Type', '0')
        child_new.set('Num', '-1')
        child_new.set('Start', child.get('Start'))
        #Ensure there's a newline on the new <POSITION_MARK /> element.
        child_new.tail = child.tail

        # Swap previous and new <POSITION_MARK /> elements.
        track.remove(child)
        track.append(child_new)

tree.write(sys.argv[2], encoding='utf-8', xml_declaration=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment