A utility or Apple Script to identify all "non-ipod compatible" videos

Does anyone know of a utility or Apple Script that will identify all “non-ipod compatible” videos within iTunes? I download a lot of podcast videos and some of them won’t sync with my iPod. If there was an Apple Script that would sort all non-compatible titles into a playlist (so I could batch convert them) it would be a huge help. Thanks - Rob

Browser: Safari 416.12
Operating System: Mac OS X (10.4)

This will find all videos that aren’t from the iTMS.

property playlistName : "Non-iPod Compatible"

tell application "iTunes"
	if not (exists playlist playlistName) then
		make new playlist with properties {name:playlistName}
	end if
	
	get location of (tracks of library playlist 1 whose kind does not start with "Protected" and kind does not end with "audio file")
	add (result) to playlist playlistName
end tell

Hi Bruce and thanks for responding…

I installed the script and it doesn’t seem to do any more than create a new playlist named “Non-iPod Compatible”. I’m pretty new to Applescripting so I don’t have many thoughs on why it’s not working.

I do know this… I know that I have at least one podcast video that returns the iTunes warning, “Some of the videos in your iTunes library, including the video “Quicktips 15 - Adobe Swatch Exchange”, were not copied to the iPod “Robs Color60 iPod” because they cannot be played on this iPod” (so, I know not all of my videos are compattible). However, when I run the script the new playlist shows up empty. I honestly appreciate your help. Do you have any suggestions? Thanks. -Rob

Sorry, my mistake. I’ve edited the script above.

Hi Bruce, thanks again.

Hey, now the playlist seems to fill with “all” of my videos (compatible or not). Is this what the script is supposed to do? Is there any way to have it put “only” the videos that the iPod will not play into this playlist? I mean, somehow iTunes knows not to bother copying a video to the iPod that will not play on the iPod. iTunes must have some built in means of qualifying which ones will play (i.e. acceptable ranges for bitrate, dimensions, etc). Is there any way to have iTunes run that test on each of the video files (then sorting offenders to a playlist) without having a iPod connected? Thanks, -Rob

If it does, it’s not available trhrough AppleScript. If I think of anything else, I’ll let you know.

Edit: Would you mind if a script had to open each file in QuickTime Player to get some information?

No, I wouldn’t mind if the script opened each file in Quicktime for some info. Got any ideas? Thanks agan. -Rob

Edit: Final edit. Try something like this:

tell application "iTunes"
	launch
	set initialList to location of (tracks of library playlist 1 whose kind does not start with "Protected" and kind does not end with "audio file")
end tell

tell application "QuickTime Player"
	launch
	close every window
end tell

set notCompatible to {}
repeat with thisItem in initialList
	try
		tell application "QuickTime Player" to open thisItem
	on error
		set notCompatible's end to thisItem
	end try
	
	checkCompatibleData given track:"Video", format:"H.264", bitrate:786432, resolution:{320, 240}
	if result is false then
		checkCompatibleData given track:"Video", format:"CAN'T FIND MPEG-4 SAMPLE", bitrate:2621440, resolution:{480, 480}
		if result is false then set notCompatible's end to thisItem
	end if
	
	try
		tell application "QuickTime Player" to close front movie
	end try
end repeat

quit application "QuickTime Player"

tell application "iTunes"
	if not (exists playlist "Non-iPod Compatible") then
		make new playlist with properties {name:"Non-iPod Compatible"}
	end if
	add notCompatible to playlist "Non-iPod Compatible"
end tell

on checkCompatibleData given track:aTrack, format:aFormat, bitrate:aRate, resolution:aResolution
	-- resolution is {width, height}. Use {0,0} for audio
	tell application "QuickTime Player"
		tell (first track whose kind is aTrack) of front movie
			try
				if (data format is aFormat) and ((data rate * 8) < aRate) then
					set maxRes to ((first item of aResolution) * (second item of aResolution))
					get natural dimensions
					set fileRes to ((first item of result) * (second item of result))
					if fileRes ≤ maxRes then return true
				end if
			end try
		end tell
	end tell
	return false
end checkCompatibleData

Wow, that was pretty fun to watch (quicktime went nutes opening and closing files all over the place) but…

…Unfortunately, it still seems as though its putting “all” of my videos into the new playlists (some audio too like “It’s Not About the Bike.aa” from Audible.com). I feel like we are almost there though. I just not sure how to decipher your code in orded to fix this. You’ve been so helpful, but would you mind taking one more look at this. Sincerey thanks to you, Rob

Would you mind running this in Script Editor and posting the results?

tell application "iTunes"
	launch
	set testList to kind of (tracks of library playlist 1)
end tell

set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10}
set testList to testList as Unicode text
set AppleScript's text item delimiters to ASTID

set tempFile to ((path to temporary items as Unicode text) & "bp-temp.txt")
try
	set fileRef to open for access tempFile with write permission
	write testList to fileRef
	close access fileRef
on error
	try
		log "boo"
		close access fileRef
	end try
	return false
end try

do shell script "sort -u " & quoted form of POSIX path of tempFile
return paragraphs of result

ok, so much for copy and pasting… now, here are the results (without brackets and quotes)…

AAC audio file, AIFF audio file, Audible file, MPEG audio file, MPEG audio file, MPEG-4 video file, PDF document, Protected AAC audio file, Protected MPEG-4 video file, QuickTime movie file, WAV audio file

-Rob
p.s. for some reason the results listed (MPEG audio file) twice.

Hi Bruce,
I didn’t know if you ever got a chance to see my posted results from running that script. I’d tried to copy/paste the results into the message box on this fourm and it pretty much posted a blank window. So, I typed the results in instead. I wouldn’t blame you if you’ve given up on me, I just didn’t want that blank window to be the last thing you saw from me. Thanks agan for everything. Sincerely, Rob

I did see the result; I havn’t forgetten about you. :slight_smile: (I also deleted the previous [blank] message.)