Applescript for deleting watched shows and podcasts in iTunes

Since switching from my Zune HD to an Apple iPod Touch, I’ve noticed that the iTunes software behaves differently than the Zune Software so far as removing deleted shows. For example, after I watch a TV show, movie, or podcast on my Zune HD I can delete it from my device. Then, when I sync with my PC using the Zune Software the application will see that I deleted the video and will also delete it from my PC as well.

With iTunes, it doesn’t work that way. If I delete a video from my iPod Touch after watching it iTunes will copy the video file back on the iPod Touch when I sync again. The only way I’ve found to have iTunes not sync a watched video on my iPod Touch is to configure iTunes to not sync “watched” videos. As such, I manually have to delete the video from iTunes to remove it from my system. I guess this is better, since you may not want iTunes to accidentally delete a video from your system if you really didn’t fully watch it (or in my case, fall asleep in bed while watching a video and have it run to the end!).

So, I’ve written an Applescript that will search out all the videos marked as watched in iTunes after connecting my iPod Touch and remove them from my Mac. Note, that I’m defining that a video has been “watched” if it has been marked by iTunes to have been played and also has a bookmark of 0.0.

My script also does the same for podcast videos and does a final syncing operation. It seems to work pretty well. Below is the full script that I’m using:

I’ve compiled this script to an application and it sits on my desktop where I can launch it by clicking the desktop icon. As I work more and more with nifty things like Applescripts controlling apps, I really appreciate moving from the PC over to the Mac world.

Advertisements

One Response to Applescript for deleting watched shows and podcasts in iTunes

  1. Jeff says:

    I know you posted this awhile back but I wanted to say “thanks.” Not only is this EXACTLY what I have been looking for (when it comes to podcasts AND deleting watched episodes) but by posting the image instead of the script text, I was forced to learn a little about applescripts and how amazing they can be.

    Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: