Tag: macosx

  • Unchecking heard podcasts in iTunes via AppleScript

    Because I have a small 16 GB iPhone which is way less than the size of my music library, I use the “sync only checked items” approach. However, I want podcasts I have listened to already be unchecked as well. For that reason I’ve written this little Applescript which runs through all the podcasts and unchecks the ones I’ve listened to.

    tell application "iTunes"
    set thetracks to every track of library playlist 1 whose podcast is true and enabled is true and unplayed is false and bookmark is 0
    repeat with currentTrack in thetracks
    set enabled of currentTrack to false
    end repeat
    end tell

    This was slightly harder than it looks due to the fact that iTunes uses the “unplayed” property to indicate it has never been played, ever. When you’re halfway through, though, a tracks’ “unplayed” is false, but you don’t want to uncheck it. In the iTunes GUI a blue dot indicates played, a half-filled blue dot played but not finished and no blue dot is played and finished. The breakthrough is in the “bookmark” field, which gets set to the position in the file you last listened to. Kindly, Apple sets this to 0 when a track is completely listened all the way, leading to the conditions above.

    You can use the AppleScript editor to create this file and save it as “Uncheck heard podcasts.scpt”, then save it in your Library/iTunes/Scripts folder. When you restart iTunes, it will show up in the script menu.

    This is a good example of how knowing a scripting language can help you out.

  • Installing scikits.timeseries on Mac OS X Snow Leopard

    Here is a nice list of steps (and dead ends) to get scikits.timeseries going on Mac OS X Snow Leopard. I am putting it up here for myself and for other people wishing to get going as soon as possible.

    So, scikits.timeseries lists python >= 2.4, setuptools, numpy >= 1.3.0, Scipy >= 0.7.0, matplotlib >= 0.98.0 and pytables >= 2.0.
    I am assuming you already have matplotlib and scipy and all that, and Snow Leopard comes with python 2.6 already installed. Now you need to get pytables going. For that you need to install HDF. If you go to the HDF site and you follow all the way to the Download page you may think you’ve hit the jackpot when they mention there’s a nice pre-built binary for you to download. Don’t do it, as it will not work with pytables! Rather, download the source for 1.8.4 patch 1 and compile it yourself (tar -xzf tarfile; ./configure –prefix=/usr/local && make && sudo make install). Should be fine if you have xcode installed.
    Now you are ready for pytables. sudo easy_install tables works fine if you’ve got hdf installed as per above. Last step is to install timeseries itself. sudo easy_install scikits.timeseries works fine.
    If the import fails (go into python and type import scikits.timeseries) with a reference to numpy 1.2.1, you may need to delete the numpy that Apple packaged with Snow Leopard. Simply do sudo rm -r /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/{numpy-1.2.1-py2.6.egg-info,numpy_APPLE_DEFAULT}
    Timeseries is a great package for working with timeseries that have dates attached. Perfect for timeseries segmentation and analysis for your PhD!
  • OpenModelica Mac OS X binaries

    If you are getting strange error messages when trying to run OMShell or other parts of the stuff that gets installed when you install OpenModelica from the Mac OS X .dmg, try using the .command files instead of the application files. This is discussed in the README.osx file.

    The error you will see is

    basic_string::_S_construct NULL not valid