{"id":15010287,"url":"https://github.com/hfanieng/prodjlink-to-sql","last_synced_at":"2026-03-17T07:39:28.301Z","repository":{"id":249793538,"uuid":"832575356","full_name":"hfanieng/ProDJLink-to-SQL","owner":"hfanieng","description":"This project reads data from the ProDJLink network with Beat Link Trigger, sends it via UDP to a Python script and then saves the data in a SQL database.","archived":false,"fork":false,"pushed_at":"2024-09-08T07:27:21.000Z","size":1804,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T13:25:35.678Z","etag":null,"topics":["clojure","music","python","rekordbox","sql","udp"],"latest_commit_sha":null,"homepage":"http://www.fanieng.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hfanieng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-23T09:49:29.000Z","updated_at":"2024-11-28T22:51:18.000Z","dependencies_parsed_at":"2024-11-21T01:15:48.069Z","dependency_job_id":null,"html_url":"https://github.com/hfanieng/ProDJLink-to-SQL","commit_stats":null,"previous_names":["hfanieng/prodjlink-to-sql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfanieng%2FProDJLink-to-SQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfanieng%2FProDJLink-to-SQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfanieng%2FProDJLink-to-SQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hfanieng%2FProDJLink-to-SQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hfanieng","download_url":"https://codeload.github.com/hfanieng/ProDJLink-to-SQL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243290984,"owners_count":20267825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","music","python","rekordbox","sql","udp"],"created_at":"2024-09-24T19:33:23.489Z","updated_at":"2025-12-27T10:11:16.348Z","avatar_url":"https://github.com/hfanieng.png","language":"Python","readme":"# ProDJLink Data Logger\n\n## Project description\n\nThis project utilizes [Beat Link Trigger][1] to read data from the ProDJLink network, transmits the data via UDP to a Python script, and subsequently stores it in a SQL database\n\n\u003e __Disclaimer__: This project is not affiliated with AlphaTheta/Pioneer DJ Corp. or its related companies in any way and has been developed independently. ProDJLink to SQL is licensed under the [MIT license][license-link]. The maintainers of this project are not liable for any damages to your data, as this is an experimental project.  \n\u003e__Editor’s Warning__: Using any under-development tool like this should be tested very thoroughly before relying on it for your next big DJ set. There is also always a chance that Pioneer DJ could close the loopholes that allow this to work in a future firmware update to CDJs – so update with caution.\n\n## Table of contents\n\n1. Introduction\n2. Requirements\n3. Installation\n4. Usage\n5. Configuration\n6. Database structure\n7. Troubleshooting\n8. Equipment\n\n## Introduction\n\nInspired by a part in the great manual of Beat Link Trigger about [writing played songs in a textfile][2] i want to store my played songs from the [Pioneer XDJ-XZ][3] in a database.\n\nOne further option is to show the playlist on Website that is connected to a MySQL-Database.\n\n## Requirements\n\n- Full ProDJLink compatible Hardware\n- Beat Link Trigger\n- Python 3.x\n- SQL database (e.g. MySQL, PostgreSQL)\n- UDP support\n\n\u003e Without compatible hardware, the simulation mode can be used in the Update Track Expressions of the trigger\n\n## Installation\n\nSteps to install the required software and libraries:\n\n1. clone this repository: `git clone https://github.com/hfanieng/ProDJLink-to-SQL`\n2. install the Python dependencies:  \n`pip install mysql.connector`  \n`pip install socket`  \n`pip install json`  \n`pip install threading`\n\n3. configure the SQL database (see configuration)\n\n## Usage\n\nInstructions for using the project:\n\n1. start Beat Link Trigger and configure it to send data over UDP.\n2. run the Python script: `python main.py`\n3. check the SQL database for the stored data.\n\n## Configuration\n\n1. Beat Link Trigger\n\n    - Edit Shared Functions:\n\n    ```clojure\n    (defn send-json-to-python\n    ;\"Encodes a map as JSON and sends it in a UDP packet to Python.\"\n    [globals m]\n    (let [message (str (cheshire.core/encode m) \"\\n\")  ; Encode as JSON line.\n        {:keys [py-address py-port py-socket]} @globals  ; Find where to send.\n        data (.getBytes message)  ; Get JSON as raw byte array.\n        packet (java.net.DatagramPacket. data (count data) py-address py-port)]\n    (.send py-socket packet)))\n    ```\n\n    - Edit Global Setup Expression:\n\n    ```clojure\n    ;; Create a socket for sending UDP to Python, and record the\n    ;; address and port to which such UDP messages should be sent.\n    (swap! globals assoc :py-socket (java.net.DatagramSocket.))\n    (swap! globals assoc :py-address (java.net.InetAddress/getLocalHost))\n    (swap! globals assoc :py-port 7001)\n    ```\n\n    - Set up a Trigger that is configured to watch the Master Player, and install the following Tracked Update Expression:\n\n    ![Interface][5]\n\n    ```clojure\n    (import '[java.net DatagramSocket DatagramPacket InetAddress])\n\n    (defn send-udp [host port message]\n    (let [socket (DatagramSocket.)\n        address (InetAddress/getByName host)\n        buffer (.getBytes message)\n        packet (DatagramPacket. buffer (count buffer) address port)]\n    (.send socket packet)\n    (.close socket)))\n\n    (when trigger-active?\n    (when (not= track-metadata (:last-track @locals))\n        (swap! locals assoc :last-track track-metadata)\n        (when (some? track-metadata)\n            (let [log-entry (json/write-str\n                        {:timestamp (str (java.time.LocalDateTime/now))\n                        :device device-name\n                        :artist track-artist\n                        :id rekordbox-id\n                        :title track-title\n                        :label track-label\n                        :bpm effective-tempo}\n                        :escape-slash false)\n            udp-host \"127.0.0.1\"  ; target host\n            udp-port 7001]       ; target port\n        (send-udp udp-host udp-port log-entry)))))\n    ```\n\n2. Database structure\n\n    ```mermaid\n    erDiagram\n    playlist {\n        INT track_id PK\n        VARCHAR track_artist\n        FLOAT track_bpm\n        VARCHAR track_device\n        VARCHAR track_genre\n        VARCHAR track_key\n        VARCHAR track_label\n        TIMESTAMP track_timestamp\n        VARCHAR track_title\n        INT rekordbox_id FK\n    }\n    ```\n\nThe rekordbox_id is for further use as a foreign key.\n\nExample for successful done entries in the SQL-database:\n![MySQL-Database][8]\n\n## Troubleshooting\n\nCommon problems and their solutions:\n\n- On MacOS the Python-Script works and writes the data in the table, on Windows it runs into an error due to the length of the timestamp.\n\n## Equipment used for the project\n\nAll tests runs with the old but great [Pioneer XDJ-XZ][3] with ❤️ and 🤩 at my hometown [Hagen-Wehringhausen][7].![XDJ-XZ][6]\n\n[1]:\u003chttps://github.com/Deep-Symmetry/beat-link-trigger\u003e\n[2]:\u003chttps://blt-guide.deepsymmetry.org/beat-link-trigger/7.4.1/Matching.html#writing-a-playlist\u003e\n[3]:\u003chttps://www.pioneerdj.com/en/product/all-in-one-system/xdj-xz/black/overview/\u003e\n[5]:docs/images/Beat_Link_Triggers_interface_screenshot_Software_Interface.png\n[6]:\u003chttps://www.pioneerdj.com/-/media/pioneerdj/images/products/all-in-one-system/xdj-xz/xdj-xz_prm_top.png?h=1316\u0026w=1792\u0026hash=CDDC51D731D7571112C6D6AB25B04626\u003e\n[7]: \u003chttps://de.wikipedia.org/wiki/Wehringhausen\u003e\n[8]: docs/images/Database_table_showing_playlist_Database_screenshot.png\n[license-link]: https://github.com/hfanieng/ProDJLink-to-SQL/blob/main/LICENSE\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfanieng%2Fprodjlink-to-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhfanieng%2Fprodjlink-to-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhfanieng%2Fprodjlink-to-sql/lists"}