All pastes #57970 Raw Edit

Anonymous

public text v1 · immutable
#57970 ·published 2006-05-22 10:22 UTC
rendered paste body
on run argv
	
	tell application "System Events"
		if (application processes whose name is "iTunes") is not {} then
			tell application "iTunes"
				set lib to library playlist 1
				set libName to name of library playlist 1
				
				if lib is not "" then
					set mysize to my printSize(size of lib)
					set runtime to my printTime(time of lib)
					
					if item one of argv is equal to "1" then
						return "testing"
						
					else
						return "My iTunes (" & (version as string) & ¬
							") " & libName & " is " & runtime & ¬
							" long, with " & (count tracks in lib) & ¬
							" songs totalling " & mysize & "."
					end if
					
				end if
			end tell
		end if
	end tell
	
end run

to printSize(theSize)
	if theSize < 1.0E+9 then
		return (round (theSize) / (2 ^ 20) * 100 ¬
			as string) / 100 & " MB"
	else
		return ((round (theSize) / (2 ^ 30) * 100) ¬
			/ 100 as string) & " GB"
	end if
end printSize

to printTime(theTime)
	set AppleScript's text item delimiters to ":"
	set timeList to theTime's words
	set AppleScript's text item delimiters to {""}
	return item 1 of timeList & "days " & ¬
		item 2 of timeList & "hrs " & item 3 of timeList & ¬
		"min " & item 4 of timeList & "sec"
end printTime