Last active
March 13, 2025 15:26
-
-
Save diracdeltas/7e81285a361f1a3717b777d1e2da0c02 to your computer and use it in GitHub Desktop.
copy all your rekordbox hotcues to memory cues
This file contains hidden or 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
# 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') |
fixed some bugs and moved this to https://github.com/diracdeltas/rekordbox-scripts
Thanks alot for this tool! Saved me hours of work :)
🖤
…On Fri, Aug 16, 2019 at 03:03 Tripppdnb ***@***.***> wrote:
Thanks alot for this tool! Saved me hours of work :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/7e81285a361f1a3717b777d1e2da0c02?email_source=notifications&email_token=AAEGGFSZTNRWOLY252NNYW3QEZ3ODA5CNFSM4HVZKRNKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAFXDVU#gistcomment-3000154>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEGGFXG23JR4RBD65N7AJDQEZ3ODANCNFSM4HVZKRNA>
.
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
Exporting collection to XML:
Importing output.xml back into Rekordbox: