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 4 out of 4. View the first page

  1. 91 Posted by Patch on 28 May, 2019 11:37 AM

    Patch's Avatar

    Can we apply any "rounding" to the conversion from Traktor Ranking to Beatunes Ratings?

    I'm noticing some errors where Beatunes support 1/2 stars and Traktor does not...

  2. Support Staff 92 Posted by hendrik on 28 May, 2019 11:38 AM

    hendrik's Avatar

    Sure—you just have to make sure you convert the 0-255 values to the range 0-100.

  3. 93 Posted by Patch on 28 May, 2019 11:47 AM

    Patch's Avatar

    That is done, using the syntax that you kindly provided above.

    But, I'm seeing some differences between the rating in the actual .mp3 file, and the rating shown in Beatunes. There is sometimes a 1/2 star difference...

  4. Support Staff 94 Posted by hendrik on 28 May, 2019 12:06 PM

    hendrik's Avatar

    beaTunes renders stars based on the range 0-100:

    • 0-9: 0 stars
    • 10-19: 0.5 stars
    • 20-29: 1 stars
    • 30-39: 1.5 stars
    • 40-49: 2 stars
    • 50-59: 2.5 stars
    • 60-69: 3 stars
    • 70-79: 3.5 stars
    • 80-89: 4 stars
    • 90-99: 4.5 stars
    • 100: 5 stars

    You can easily implement some custom mapping by changing this

    int r = java.lang.Math.round(Integer.valueOf(ranking.getValue()) / 2.55f)
    song.setRating(r)
    

    to something like this:

    int traktorRating = Integer.valueOf(ranking.getValue()
    int r = 0
    if (traktorRating < 10) {
        r = 0
    } else if (traktorRating < 20) {
        r = 10
    } else if (traktorRating < 30) {
        [...]
    }
    song.setRating(r)
    

    Obviously you need to adjust this to your custom ranges.

  5. 95 Posted by Patch on 28 May, 2019 06:47 PM

    Patch's Avatar

    What have I done wrong here???

    int traktorRating = Integer.valueOf(ranking.getValue()
    int r = 0
    if (traktorRating < 1) {
        r = 0
    } else if (traktorRating < 51) {
        r = 20
    } else if (traktorRating < 102) {
        r = 40
    } else if (traktorRating < 153) {
        r = 60
    } else if (traktorRating < 204) {
        r = 80
    } else if (traktorRating < 255) {
        r = 100
    }
    song.setRating(r)

  6. Support Staff 96 Posted by hendrik on 28 May, 2019 07:52 PM

    hendrik's Avatar

    There‘s a parenthesis missing at the end of the first line.

  7. 97 Posted by Patch on 29 May, 2019 10:56 AM

    Patch's Avatar

    It works! But somethings still not right. I’m getting different values between Traktor & BeaTunes.

  8. 98 Posted by Patch on 29 May, 2019 11:31 AM

    Patch's Avatar

    This looks helpful. I’ll have a look tonight:

    The following list details how Windows Explorer reads and writes the POPM frame:

    224–255 = 5 stars when READ with Windows Explorer, writes 255
    160–223 = 4 stars when READ with Windows Explorer, writes 196
    096-159 = 3 stars when READ with Windows Explorer, writes 128
    032-095 = 2 stars when READ with Windows Explorer, writes 64
    001-031 = 1 star when READ with Windows Explorer, writes 1

  9. Support Staff 99 Posted by hendrik on 30 May, 2019 07:32 AM

    hendrik's Avatar

    Yeah.. I remember Explorer doing something crazy like that...

  10. 100 Posted by Patch on 01 Jun, 2019 04:25 PM

    Patch's Avatar

    Hendrik - does Beatunes have any issues with special characters?

    I've had a stumble when using tags in a Wendy Rene track, and I traced it to the accent on the 2nd "e" in Rene (é).

    When I removed it, the errors disappeared. It might be iTunes, or BeaTunes or Traktor that doesn't like special characters...

    Can you rule out Beatunes?

  11. Support Staff 101 Posted by hendrik on 01 Jun, 2019 05:05 PM

    hendrik's Avatar

    I’m not aware of any issues.

  12. Support Staff 102 Posted by hendrik on 01 Jun, 2019 05:34 PM

    hendrik's Avatar

    Just FYI: I will be traveling during the next 3 weeks and won’t be able to answer quickly.

  13. 103 Posted by Patch on 01 Jun, 2019 06:14 PM

    Patch's Avatar

    Thanks for the heads-up! Travelling for pleasure I hope?

  14. Support Staff 104 Posted by hendrik on 01 Jun, 2019 06:21 PM

    hendrik's Avatar

    Yep!

  15. 105 Posted by Patch on 01 Jun, 2019 06:56 PM

    Patch's Avatar

    Have fun mate.

    I promise I won't save up all my questions for when you return! X-)

  16. 106 Posted by Patch on 01 Jun, 2019 07:55 PM

    Patch's Avatar

    Well, goddamnit. It looks like I've cracked this!!!

    But I'm very confused - because the code I've written doesn't really corelate with what I think should happen???

    I am ONLY applying * ratings tag in TRAKTOR. That is, I click on the graphical star rating in Traktor (to assign 0 - 5 *'s), and Traktor then writes the corresponding value to the Collection.nml, like this:

    1* = RANKING="51"
    2* = RANKING="102"
    3* = RANKING="153"
    4* = RANKING="204"
    5* = RANKING="255"

    Traktor also writes that to the POPM tag in each.mp3 file as:

    1* = [email blocked]|51|0
    2* = [email blocked]|102|0
    3* = [email blocked]|153|0
    4* = [email blocked]|204|0
    5* = [email blocked]|255|0

    To get the RANKING value into BeaTunes and iTunes, we read from the .nml, then convert to Beatunes own star rating values. Believe it or not, I came to the values (<001, <070, <103, <154, <205, <256) for traktorRating using a bit of trial and error:

    if (ranking != null) {
                        log.debug("Setting rating/ranking for " + song + ": " + ranking.getValue())
                        // convert string with 0-255 to integer with 0-100:
                        int traktorRating = Integer.valueOf(ranking.getValue())
                        int r = 0
                        if (traktorRating < 001) {
                            r = 0
                        } else if (traktorRating < 070) {
     (1* =) r = 20
                        } else if (traktorRating < 103) {
     (2* =) r = 40
                        } else if (traktorRating < 154) {
     (3* =) r = 60
                        } else if (traktorRating < 205) {
     (4* =) r = 80
                        } else if (traktorRating < 256) {
     (5* =) r = 100
                        }

    So now, I apply the rating as a graphical star value in Traktor, that gets copied to the Traktor Collection.nml as an integer, then it gets converted in BeaTunes to the corresponding Beatunes/iTunes integer for those * ratings, and, <<<SOMEHOW>>> the POPM tag in the .mp3 also files gets updated to:

    1* = [email blocked]|23
    2* = [email blocked]|64
    3* = [email blocked]|128
    4* = [email blocked]|196
    5* = [email blocked]|252

    You'll notice that the "|0" from the end of the POPM tag (indicating playcount) is gone at this point. It doesn't matter.

    Those final "[email blocked]|xxx" values in the POPM tag synchronises the * ratings in Traktor, Beatunes/iTunes, and WE!!! (VICTORY!)

    But - I don't understand why?!? (At this point part of me is saying "Don't worry! It works! Just forget about it!", but if I don't understand WHY it's happening, if it is wrong, I won't *know* it's wrong...)

    The only thing I can think of, is Beatunes is assigning a number within a range, and not a specific integer when doing the conversion. What I mean is, for 1*, where I think BeaTunes is assigning a value of r = 20 here:

    } else if (traktorRating < 070) {
        r = 20
    }

    Is it actually assigning r = 23 (from the range 0 to 69) for some reason, and writing that to BeaTunes/iTunes AND the .mp3 file?

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