Slashdot Mirror


More iTunes Math

markmcb writes "OmniNerd once again digs into the math behind iTunes. The 5-star ratings in iTunes are actually stored in a variable allowing values from 0 to 100, with 20 = 1-star, 40 = 2-star, etc. Known to few, if you set a rating to 30 (manually), it will show up as 1 1/2 stars in the program's GUI. Matt Schinckel provides interesting statistical evidence showing that not only do non-whole, non-half values (e.g., 47) not increase the amount a song will play, but neither do the half-star ratings (with the exception of .5 star)."

7 of 167 comments (clear)

  1. Re:The beauty of AppleScript. by gowmc · · Score: 2, Informative

    AppleScript really isn't a particularly great language. My understanding is that any OSA language can use AppleEvents, so all you need is something like this to talk to applications in something you are more used to:

    http://mail.python.org/pipermail/pythonmac-sig/200 1-August/004064.html

    --
    -- If it aint broke, fix it till it is. --
  2. Re:Is it really surprising? by CyricZ · · Score: 5, Informative

    Yes, it's interesting. If you find such topics boring, then perhaps you shouldn't be reading Slashdot. I'm sure you'll find reading material more entertaining and suitable for lower intelligence level at Disney.com.

    Many people who read this site care about issues like this. We find it interesting to experiment with software systems, especially those which we do not have direct access to the source code of. It's fun to see how a consumer-grade application reacts to unexpected data, for instance.

    He could have decompiled the application. But doing so would likely have been in violation of the licensing agreement he agreed to before using said software. You may question the legality of such agreements, but he may not have wanted to take the risk of publishing his findings. Litigation is expensive, after all.

    Not only that, but it's quite difficult to decompile a program written in C, C++ or Objective-C. That's especially true when you're dealing with an optimized program. It often isn't obvious what a particular chunk of assembly code is doing, and thus is basically useless for such analysis.

    --
    Cyric Zndovzny at your service.
  3. Re:The beauty of AppleScript. by Dorceon · · Score: 2, Informative
    You can do all of this through the iTunes COM interface, which is accessible to VBS, and also any compiled application.
    var iTunesApp = WScript.CreateObject("iTunes.Application");
    var mainLibrary = iTunesApp.LibraryPlaylist;
    var tracks = mainLibrary.Tracks;
    var numTracks = tracks.Count;
    var time_secs = 0;

    for (i = 1; i <= numTracks; i++)
    {
    var currTrack = tracks.Item(i);
    var track_end = currTrack.Finish;
    var track_start = currTrack.Start;
    var track_dur = track_end - track_start;
    var track_time = currTrack.PlayedCount * track_dur;
    time_secs += track_time;
    }

    WScript.Echo("You've spent " + Math.floor(time_secs / (3600*24)) + " days " + Math.floor((time_secs / 3600) % 24) + " hours " + Math.floor((time_secs / 60) % 60) + " minutes " + Math.floor(time_secs % 60) + " seconds listening to iTunes. (" + time_secs + " seconds total.)");
    According to this, iTunes has been playing for ~29.5 days since my hard drive crash about a year ago. This is what I get for having a Scheduled Task (think cron job) run a VBS that uses COM to start iTunes as my alarm clock. (Item is 1-indexed, which is probably simpler for non-coders; subtracting the start time from the end time instead of using Length makes sure it doesn't count space that isn't part of the song, such as most of The Wonderful Future by Our Lady Peace, which has abour 13 minutes of empty space between the end of the song and Ray Kurzweil reading a long excerpt from his "The Age of Spiritual Machines".)
    --
    What sound do people on rollercoasters make? Hint: it's not Xbox 360.
  4. Re:How does it handle values outside the range? by Eccles · · Score: 3, Informative

    Carbon applications are usually written in Objective C.

    No they aren't. I'm a professional programmer for a Mac (and PC) program using the Carbon interface for Macs. As Wikipedia says, "Carbon is more versatile in that it may be accessed using C, C++, Pascal, Ada, or any other language with suitable interface headers, whereas Cocoa exclusively uses Objective C and Java." Most cross-platform apps use Carbon because Objective-C isn't widely used on PCs.

    --
    Ooh, a sarcasm detector. Oh, that's a real useful invention.
  5. Re:Endnote #20 by tom6a · · Score: 2, Informative

    Brandon answered the question in the article comments, "Assuming no time between tracks, the test ran for about 15.41 minutes (924.81 seconds)." (See http://www.omninerd.com/2006/02/11/news/530)

  6. Basically the same... by Otto · · Score: 2, Informative

    You can do half star ratings in iTunes for Windows as well. Works exactly the same way.

    Scripts to do it can be found here: http://ottodestruct.com/blog/category/geekery/prog rammery/

    --
    - Give a man a fire and he's warm for a day, but set him on fire and he's warm for the rest of his life.
  7. Re:Obligatory by Anonymous Coward · · Score: 1, Informative

    Uhh, did you even go to that link? It runs on linux and OS X.