iTunes & Traktor Collection

Patch's Avatar

Patch

11 Jan, 2018 06:24 PM

I’m using BeaTunes and love it.

I’ve been searching for a long time for a way to manipulate the metadata that Traktor creates and stores in iTunes.

For example - I’d love to create an iTunes smart playlist that is based on the number of times a track has been played in Traktor.

It would mean comparing the Traktor Collection .xml with the iTunes Library .xml, and updating the iTunes .nml with the Traktor playcount from the Collection .xml.

Could BeaTunes be the bridge that sits between Traktor and iTunes, to allow us to manipulate the Traktor metadata in iTunes???

Showing page 2 out of 4. View the first page

  1. Support Staff 31 Posted by hendrik on 28 Jan, 2019 07:03 AM

    hendrik's Avatar

    I don't think collection.nml contains comments, does it?

    I often update teh "Comments" tag in-line in Traktor as I'm playing, and, obviously, those comments don't show up in iTunes until I "Get Info" in iTunes, or re-import the tracks with updated comments.

    Have you tried to select the files in question in beaTunes and then File -> Refresh Metadata? That should re-read info from the file itself (but does not update/refresh iTunes).

  2. 32 Posted by Patch on 28 Jan, 2019 08:31 AM

    Patch's Avatar

    Ah - good point re: Comments in the .nml. I don’t think it does.

    BUT - there is a Traktor ONLY “tag” called Comments2 which does sit in the .nml.

    Could we copy from the .mp3 Comments tag, to Traktor .nml Comments2, then from the Traktor .nml to the iTunes .xml?

    The whole point is to get info that I have typed into Traktor available to me in iTunes to allow me to create Smart Playlists...

  3. Support Staff 33 Posted by hendrik on 28 Jan, 2019 08:40 AM

    hendrik's Avatar

    Could we copy from the .mp3 Comments tag, to Traktor .nml Comments2, then from the Traktor .nml to the iTunes .xml?

    iTunes never reads the iTunes Library.xml file. You'd need to pick it up from the .nml file and write it to the beaTunes AudioSong object.

    Feel free to fork https://github.com/beatunes/beaTlet-samples/blob/master/groovy/Impo... make the necessary changes and send a pull request!

  4. 34 Posted by Patch on 28 Jan, 2019 09:47 AM

    Patch's Avatar

    Thanks for the response, but, honestly, I don’t know what a fork is, how to request a “pull”, nor do I understand the code at github... (Zero programming knowledge here!).

    I want to automate getting the comments info out of an .mp3 (where the info was added in Traktor), and into iTunes so that I can create smart playlists based on that info.

  5. 35 Posted by Patch on 28 Jan, 2019 09:49 AM

    Patch's Avatar

    BUT ONLY on tracks that I have added comments to in Traktor...

  6. Support Staff 36 Posted by hendrik on 28 Jan, 2019 09:50 AM

    hendrik's Avatar

    I'm afraid, I currently don't have the time for custom beaTlet development.
    Sorry.

  7. 37 Posted by Patch on 30 Jan, 2019 08:34 PM

    Patch's Avatar

    Understood. Thanks for everything that you’ve already done on this. I’m using it a lot and it works very well.

  8. Support Staff 38 Posted by hendrik on 01 Feb, 2019 12:35 PM

    hendrik's Avatar

    I’m using it a lot and it works very well.

    Great! :-)

  9. 39 Posted by Patch on 11 May, 2019 08:15 PM

    Patch's Avatar

    Okay - so I’ve been thinking about this lately. I could REALLY use the Traktor only tag (Comment2) showing up in iTunes.

    I’d need to learn the programming language of beatlets, but I’m willing to do that, if what I want to do can be done.

    So - can I create a beatlet (or edit an existing one) that would take the Comment2 text from the Traktor Collection, and copy it to an unused text tag in iTunes to allow me to use the Comment2 text to generate smart playlists???

  10. 40 Posted by Patch on 11 May, 2019 08:16 PM

    Patch's Avatar

    Sorry - I mean a tag in the .mp3 file that iTunes can read.

  11. Support Staff 41 Posted by hendrik on 12 May, 2019 04:31 PM

    hendrik's Avatar

    Sure, that's doable. Is the comment2 field an MP3 TXT frame or is it in the XML file?

  12. 42 Posted by Patch on 12 May, 2019 07:54 PM

    Patch's Avatar

    I don’t know. That is also something I’d have to learn about in order to update the beatlet.

    If I had to bet, I’d say it’s in the .xml file (along w/playcount and last played...)

  13. Support Staff 43 Posted by hendrik on 13 May, 2019 07:25 AM

    hendrik's Avatar

    Traktor stores comment 2 as rating in the .nml file. Because it's trivial, I've updated the beaTlet to store the comment 2 value in the custom 1 beaTunes field. You can see the changes I have made here:

    https://github.com/beatunes/beaTlet-samples/commit/51c390cbed1ac654...

    To use this version, you have to manually replace the old one in your plugins folder and restart beaTunes.

    Now, iTunes does not support custom 1. The trouble is, there are no "unused iTunes text tags", so I am reluctant to "officially" put something out there that may delete data people don't really want to delete.

    However, you can easily pick your own tag to write to by changing line 128. Instead of setCustom1(...) call something else, like setAlbumArtist(...). Possible methods to call are listed in the AudioSong docs. You just have to change that one line, save your changes, and restart beaTunes. If for some reason your change breaks the beaTlet, beaTunes will log an error message in its log files—just search for "ImportTraktorDatesAndCounts".

  14. 44 Posted by Patch on 13 May, 2019 08:50 AM

    Patch's Avatar

    Awesome.

    I’ll test it and get back.

    A thousand thank-you’s!!!

  15. 45 Posted by Patch on 13 May, 2019 12:28 PM

    Patch's Avatar

    Tell me, is:

    getMovement()

    in Beatunes, the same as:

    Movement Name

    in iTunes?

  16. Support Staff 46 Posted by hendrik on 13 May, 2019 12:31 PM

    hendrik's Avatar

    Yes.

  17. 47 Posted by Patch on 13 May, 2019 05:30 PM

    Patch's Avatar

    Okay - looks like there's a problem. When I swap out the beatlet, and check in beatunes prefs, the name of the beatlet is struck-thru, and the following eror is showing:

    javax.script.ScriptException: unexpected token: < @ line 7, column 1. in C:\Users\Patch\AppData\Local\tagtraum industries\beaTunes\plugins\ImportTraktorDatesAndCounts.groovy at line number 7
    at com.tagtraum.core.app.ScriptEngineAdapter$GroovyScriptEngineAdapter.a(SourceFile:245)
    at com.tagtraum.core.app.ScriptEngineAdapter$GroovyScriptEngineAdapter.evalFile(SourceFile:213)
    at com.tagtraum.core.app.ScriptEngineAdapter$GroovyScriptEngineAdapter.createInstance(SourceFile:252)
    at com.tagtraum.core.app.ScriptEngineAdapter.createInstance(SourceFile:88)
    at com.tagtraum.core.app.ScriptPluginLoader.a(SourceFile:122)
    at com.tagtraum.core.app.ScriptPluginLoader.a(SourceFile:65)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at com.tagtraum.core.app.ScriptPluginLoader.load(SourceFile:66)
    at com.tagtraum.core.app.PluginManager.init(SourceFile:1500)
    at com.tagtraum.beatunes.BeaTunes.<init>(SourceFile:328)
    at com.tagtraum.beatunes.BeaTunes.a(SourceFile:1991)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    C:\Users\Patch\AppData\Local\tagtraum industries\beaTunes\plugins\ImportTraktorDatesAndCounts.groovy: 7: unexpected token: < @ line 7, column 1.
       <!DOCTYPE html>
       ^

    1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
    at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
    at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
    at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:350)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:144)
    at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
    at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
    at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:254)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.tagtraum.core.app.ScriptEngineAdapter$GroovyScriptEngineAdapter.evalFile(SourceFile:205)
    ... 32 more

  18. 48 Posted by Patch on 13 May, 2019 05:32 PM

    Patch's Avatar

    I've also sent the logs.

  19. Support Staff 49 Posted by hendrik on 14 May, 2019 05:52 AM

    hendrik's Avatar

    This looks like you saved a webpage from the GitHub repository and tried to install it as plugin. That does not work.

    Please

    Hope this helps.

    -hendrik

  20. Support Staff 50 Posted by hendrik on 14 May, 2019 05:55 AM

    hendrik's Avatar

    Correction: In my previous post the link to the beaTlet should have been: https://raw.githubusercontent.com/beatunes/beaTlet-samples/master/g...

    (I have updated the original post in the forum)

  21. 51 Posted by Patch on 14 May, 2019 06:21 PM

    Patch's Avatar

    I could kiss you.

    This works absolutely brilliantly. For info, I've used the Movement Name tag in iTunes and it works, flawlessly.

    Is there any reason that I couldn't modify this to populate the Custom2, Custom3, Custom4 and Custom5 tags in BeaTunes, then have BeaTunes write those tags to other unused .mp3 file tags to show up in iTunes?

    Traktor has a bunch more text tags (Label, Release, Remixer, Producer, Mix, Catalog No.) that I could definitely use in iTunes!!!

  22. 52 Posted by Patch on 15 May, 2019 12:59 PM

    Patch's Avatar

    Does this write the Custom1 text to the iTunes Library, or the .mp3 file itself?

  23. Support Staff 53 Posted by hendrik on 15 May, 2019 01:01 PM

    hendrik's Avatar

    It's written to the beaTunes library and also to the file (if embedding is turned on).
    iTunes does not support custom1.

  24. 54 Posted by Patch on 15 May, 2019 01:05 PM

    Patch's Avatar

    Sorry - I didn't mean storing it in iTunes as Custom1, I meant storing the text from Beatunes Custom1 as Movement Name in iTunes.

    Because if it's written to the file, then I can delete all tunes from my iTunes Library, and then re-import and have all my Smart Playlists autopopulate.

  25. Support Staff 55 Posted by hendrik on 15 May, 2019 01:07 PM

    hendrik's Avatar

    iTunes should write it to the file. But you can always check simply by looking at your file with a hex editor like 0xED. Just open the mp3 file with that editor and search for your string.

  26. 56 Posted by Patch on 15 May, 2019 01:26 PM

    Patch's Avatar

    Okay that's really helpful. I tried HxD for windows and all looks good!.

    And thanks for the tip re: turning embedding on. I'd missed that.

    I asked:

    "Is there any reason that I couldn't modify this to populate the Custom2, Custom3, Custom4 and Custom5 tags in BeaTunes, then have BeaTunes write those tags to other unused .mp3 file tags to show up in iTunes?

    Traktor has a bunch more text tags (Label, Release, Remixer, Producer, Mix, Catalog No.)........."

    Which lines of code would I have to duplicate in the .groovy file for each of those Traktor tags, and where in that file (line numbers) would they live?

  27. Support Staff 57 Posted by hendrik on 15 May, 2019 01:51 PM

    hendrik's Avatar

    Is there any reason that I couldn't modify this to populate the Custom2, Custom3, Custom4 and Custom5 tags in BeaTunes, then have BeaTunes write those tags to other unused .mp3 file tags to show up in iTunes?

    There is no mechanism in beaTunes that writes customX to other "unused" mp3 tags that you could exploit.

    Traktor has a bunch more text tags (Label, Release, Remixer, Producer, Mix, Catalog No.).........

    You'd have to look at your collection.nml file, to see whether and how these fields show up. If they do show up in the .nml file, you should be able to modify the beaTlet to import them. As to how, please read the source code carefully and then attempt to add code for another tag like "Release".

    If the desired fields do not show up in the .nml file, there is more work to do, as they are probably stored in the id3 tags. Those are accessible in beaTunes as well, but require much more programming knowledge.

  28. 58 Posted by Patch on 15 May, 2019 02:09 PM

    Patch's Avatar

    I think I may have explained incorrectly what I want to do.

    I just want to move the info from Traktors tags (exactly as we did with Traktors Comment2) into the .mp3 file so that iTunes can read it.

    If it can be done for Traktor Comments2, it can probably be done with the other Traktor tags I listed.

    It looks like I could use Programme and Sort Programme as vacant tags in the .mp3 file, so I'd need to identify 2 of the Traktor tags (maybe Remixer & Producer?) as the source text to copy from Traktor, to Beatunes (Custom2 and Custom3) and then to the .mp3 file (Programme & Sort Programme) to show up in iTunes.

    Thanks so much for all of your help. I'll be plugging BeaTunes hard over at DJTT.com, and you've got a customer for life in me! :-)

  29. Support Staff 59 Posted by hendrik on 15 May, 2019 02:16 PM

    hendrik's Avatar

    Sounds like what you want to do has nothing to do with any customX fields.

    What you need to do is:

    1. open your collection.nml file in some editor (it's XML so maybe Atom)
    2. figure out, whether any values you want to import show up in there, e.g. search for known Traktor tag values.
    3. if they indeed show up, write some custom code in the beaTlet to read them and write them to some other iTunes field (using song.setWhatEver())

    Keep in mind that it is totally possible that the desired values do not show up in collection.nml.

    Thanks so much for all of your help. I'll be plugging BeaTunes hard over at DJTT.com, and you've got a customer for life in me! :-)

    Thanks! Advertisement is always good! :-)

  30. 60 Posted by Patch on 15 May, 2019 06:05 PM

    Patch's Avatar

    Okay - so I've found all of the Traktor Tag values/names using Atom. They all show up in the .nml (some have some subtle naming differences).

    Do I have to duplicate the following 4 lines of code (lines 126 to 129) for EACH new Traktor Tag that I want copied to the .mp3 file???

    [quote]if (rating != null) {
                            log.debug("Setting rating/comment2/custom1 for " + song + ": " + rating.getValue())
                            song.setCustom1(rating.getValue())
                        }[/quote]

    But, I'd need to change "rating" to the tag I'm copying FROM (in Traktor .nml) (example: CATALOG_NO) and also change "Custom1" to the .mp3 file tag I'm copying TO (example: SORT PROGRAMME).

    This is my first ever attempt at coding as I'm sure you can tell!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac