I'm using on online TV recorder to record TV shows. Those recordings are downloaded as a podcast to iTunes. My following Applescript should just grab those podcasts, update some info fields and finally mark them as "TV show" to have them show up under "TV Shows" in iTunes.

It works very well, only the part where I want to set the video kind to TV show doesn't seem to work.

set video kind of aTrack to TV show

I also had a look at this Doug's script that does something similar and I can't find any difference.

Here is my full script:

on matchRegExp(regex, txt, |caseSensitive?|)
    if |caseSensitive?| then
        set ci to "i"
        set ci to ""
    end if
    set theRubyOneLiner to quote & "s = '" & txt & "'; s =~ /" & regex & "/" & ci & "; puts Regexp.last_match.to_a" & quote
    set theCommand to "ruby -e " & theRubyOneLiner
    set theMatchData to do shell script theCommand
    set tid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to character id 13 -- new line
    set theMatchData to the text items of theMatchData
    set AppleScript's text item delimiters to tid
end matchRegExp

tell application "iTunes"
    set myLib to library playlist 1

    set pods to every track of library playlist 1 whose genre is "Podcast" and album is "Online Videorecorder"

    set ofi to fixed indexing
    set fixed indexing to true

    with timeout of 3000 seconds
        repeat with aTrack in pods
            set desc to long description of aTrack

                set episode to last item of my matchRegExp("(Folge|Episode) (\\d+)", desc, true)
                set season to last item of my matchRegExp("(Staffel|Season) (\\d+)", desc, true)
            end try

            set series to name of aTrack
            set title to description of aTrack
            set cat to category of aTrack

                set video kind of aTrack to TV show
            on error m
                log m
            end try

            set episode number of aTrack to episode
            set season number of aTrack to season
            set show of aTrack to series
            set episode ID of aTrack to title
            set description of aTrack to desc
        end repeat
    end timeout
    set fixed indexing to ofi

end tell

1 Answer 1


The problem is that you can't change the "Media Kind" of a podcast track via AppleScript. For whatever reason, it seems to be some sort of special type that isn't exposed in the AppleScript dictionary.

The closest I've found to a method for doing this is this script in the Apple Support Forums that changes the Media Kind via GUI scripting. It seems to be set up for changing it to an Audiobook, so you'll have to modify it a bit, but it may be a decent starting point.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .