traktorBeetsIntegration
                                
                                
                                
                                    traktorBeetsIntegration copied to clipboard
                            
                            
                            
                        Beet + Traktor integration: sync custom tags and import utils
Traktor custom tags: Beets Integration
This project is an integration between Beets and Traktor that helps manage Traktor libraries.
Warning: this was developped and used only on MacOs, I doubt this project is compatible with Windows. This project comes with no guarantees: I recommend backing-up your files.

Core features (detailed in Features):
- enable usage of custom tags in Traktor through auto-generated playlists
 - auto-generate comments on Traktor tracks to help you visualize custom tags
 - sync tags between Traktor and Beets
 - utils to easily import your Traktor library into Beets' library
 - utils to prompt pre-configured custom tags to easily tag your tracks
 - auto-import "m3u" playlists folders in Traktor (useful when using the 
smartPlaylistsBeets plugin) 
Planned features:
- multi-value metadata support
 - create an issue if you have a feature request ;)
 
Feel free to contribute with PRs/issues !
See it in action !
Created a quick Youtube video in addition to this doc to show the workflow: here's the link.
Install
This projects was developed pipenv + python 3.8.
git clone https://github.com/16pierre/traktorPlaylistExport
cd traktorPlaylistExport
pipenv install
Configuration
cp locations.json.template locations.json
cp scanner_tags.json.template scanner_tags.json
- Edit 
locations.jsonto specify where yourTraktorcollection.nmlfile is etc. - Edit 
scanner_tags.jsonto specify the different custom tags you want to use & playlists you want to generate - For import utils: edit 
Beetsconfig: setimport.link: yes(see below) 
Usage
Sync Traktor<->Beets
pipenv run sync
Utils: tag scanner
Helps you scan your tracks with tags specified in scanner_tags.json.
You can also use beet modify, but most of the time I find it more convenient to use the scanner to avoid typos.
pipenv run scan
pipenv run scan artist:Daft Punk
etc.
Utils: import helper
Helps you import your Traktor library inside Beets. See below for more explanation, this is not trivial.
pipenv run import
Features
Sync Beets<->Traktor
In this section, let's assume that tracks are imported in both Beets and Traktor,
and that they both use the same file paths.
The core idea here is the link between Traktor's playlists and Beets metadata. Let's take a few examples.
Say I configured scanner_tags.json with:
{
    "_playlists": [
        ["mood"],
        ["energy"],
        ["mood", "energy"]
    ],
    "mood": ["dark", "joyful"],
    "energy": ["1", "2", "3", "4", "5"]
} 
This will create 3 kinds of playlists in Traktor:
- one for each 
mood:mood: dark... - one for each 
energy:energy: 1... - one for each 
(mood, energy)couple:mood: dark, energy: 1 
With this system, we can unambiguously link Beets metadata to Traktor playlists;
this link is the core mechanism behind the sync:
- Editing a tag in 
Beetswill update the matchingTraktorplaylists - Adding a track to a 
Traktorplaylist will update the corresponding tags inBeets 
Extra mechanisms:
- you can use the star rating system in 
Traktor, it's synced with theratingtag inBeets. - to help you visualize the metadata in 
Traktor, the sync writes comments on the Track to list the custom tags (warning: this will override existing comments, will be fixed, issue: https://github.com/16pierre/traktorPlaylistExport/issues/1) 
Help import Traktor library into Beets
Configuration required
Note: this util requires using beet import with symlinks. You therefore need to configure Beets like this:
import:
    link: yes
For more details, see Beets docs.
Why add utils for imports
In order for the sync to work properly, you need to have imported the tracks in both Traktor and Beets.
Importing Beets' library in Traktor is easy: you can simply setup the Traktor
default music directories to include Beets' folder.
The issue is rather importing Traktor's library in Beets:
- if you copy the files to 
Beets, you'd end up with useless duplicates - if you move the files to 
Beets, you'd need to relocate all the tracks - running 
beet importis not easy if the files in yourTraktorlibrary are not centralized 
That's why I implemented some utils for this use case.
How these utils work
Let's see what happens step by step when running pipenv run import
(this also happens when running pipenv run sync):
- Import whatever you want in 
Traktor, you can also sort your tracks in playlists like explained above: this will be tagged later even if your tracks are not imported inbeetsyet - Automatic: find all tracks imported in 
Traktorbut not inBeets - Automatic: symlink these files to a temporary directory organized by album
 - Manual action required: 
beet importin the temporary directory. Warning: you need to configureimport.link = yesinBeetsconfig - Manual action required: close Traktor if opened.
 - At this point, we have a double symlink: 
beet_library -> temporary folder -> original track - Automatic: detects that tracks have been imported in 
Beetsthanks to the symlinks. - Automatic: delete symlinks, move the original files to 
beet_library, and updateTraktorlibrary to point tobeet_libraryinstead of the original files. - You can reopen Traktor now :)