Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm using Hazel to automate the conversion of video files to iTunes .mv4 format, however one limitation I've run into is being able to mark a video file as "TV show" or "Movie" before adding to iTunes.

I'd like to do this via Applescript so I can run it as part of my rule set up, but I'm more of an AppleScript copy/paster than a coder.

share|improve this question

4 Answers 4

Here's a bit to start the copy/pasting process, from the excellent "Doug's Scripts" website:

http://dougscripts.com/410

This is the "Set Video Kind of Selected" script, which lets you choose what kind you want the file to be marked as TV Show, Movie, etc.

share|improve this answer
    
I've looked at that AppleScript before, but it prompts the user to add info manually and I am looking to automate things. I think I may have deduced what I need to do, my earlier efforts were not calling iTunes in to set the video kind, will see if this works. Thanks! –  George C Aug 24 '11 at 3:12
    
@George: The script is free to anyone to modify. If you wish to work with Applescripts, at some point you need to learn to actually code rather than simple copying/pasting. You will get along a whole lot better with your Mac if you do. It is worth the effort. –  Philip Regan Aug 24 '11 at 12:26
    
@Philip I agree, I've tried to educate myself on AppleScript but the syntax just seems over my head. I'm more of a hobbyist and a reverse-engineerer. –  George C Aug 24 '11 at 22:19

Taken from:

http://kjvarga.blogspot.ca/2009/03/applescript-automator-import-avi-video.html

on run {input, parameters}  
 set videoType to button returned of (display dialog ("What type of video are you importing?") buttons {"Movie", "TV Show"} default button {"TV Show"})  
 repeat with i in input  
  try  
   tell application "Finder" to set file type of file i to "MooV"  
  end try  
  tell application "iTunes"  
   set newAddition to (add (i as alias))  
   if videoType = "TV Show" then  
    tell newAddition to set video kind to TV show  
   end if  
  end tell  
 end repeat  
 return input  
end run  
share|improve this answer
  1. open Automator

  2. choose Application as Document type

  3. select Run Applescript from the Utilities folder in the Automator Library

  4. Paste this in to the part that says (Your script goes here)

    tell application "iTunes"
    set newAddition to (add input)
    tell newAddition to set video kind to TV show
    end tell

  5. Save with a useful name

  6. Drop shows on the App and they will be added to iTunes as TV shows

Tested with iTunes 11

share|improve this answer
    
Can this be used within an AppleScript? I don't need to have the file actually added to iTunes, just marked as a TV show. –  George C Dec 10 '12 at 19:24

Automator would be my first inclination if you don't want to learn the syntax and craft of making your own AppleScripts.

It lets you save an action as a service or as a folder action both of which are about as easy as a script. The service can run right out of iTunes if desired.

You can use several variables to try and fill in the TV related fields as well as just changing the media kind.

share|improve this answer
    
I was not able to find any Automator actions that allowed me to set the video kind for movie files. What is the name of the action I should be looking at? Thanks! –  George C Aug 24 '11 at 3:16
    
See apple.stackexchange.com/questions/21099/… ( not at a mac so I'm not 100% sure the kind has a setter, but many fields are there ) –  bmike Aug 24 '11 at 3:56
    
Unfortunately that action only has tag fields for music/audio files. –  George C Aug 24 '11 at 22:18
    
That's less than ideal - unless someone makes or finds a plug in to teach Automator more tricks, you might be stuck scripting with other tools like shell or AppleScript. –  bmike Aug 24 '11 at 22:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.