Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'I'm at 695 days' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
I'm at 695 days
Authored by: Oops on Oct 12, '07 10:30:34AM
It does explicitly omit podcasts and video files from consideration.

If "Library Playlist 1" means the "Music" playlist, in which case audiobooks would not be included automatically, then audiobooks are omitted. If audiobooks are in library playlist 1, then the script does not remove audiobooks from consideration. I don't have any audiobooks and so I don't have a way to test this.

If anyone can tell me the answer to that question, or what sort of metadata is special to audiobooks (does the 'kind' contain audiobook?), then the script can easily be adapted to exclude audiobooks. The following should work if audiobooks do not reside in the 'Music' playlist automatically made by iTunes:

tell application "iTunes"
	set totalListeningTime to 0
	repeat with i from 1 to the count every track of playlist "Music"
		if (kind of track i of playlist "Music" contains "audio" and podcast of track i of playlist "Music" is false) then
			set timesPlayed to played count of track i of playlist "Music"
			set songLength to duration of track i of playlist "Music"
			set totalListeningTime to totalListeningTime + timesPlayed * songLength
		end if
	end repeat
	set totalHours to totalListeningTime / 3600
	set totalDays to totalHours / 24
	set totalYears to totalDays / 365.25
	display dialog "You have listened to " & totalDays & " days of music."
end tell
The only difference between this and the submitted script is that 'playlist "Music" ' is replaced by "library playlist 1". Looking at the script, I don't know how it can fail to give the correct answer. [The (kind of track i of playlist "Music" contains "audio" and podcast of track i of playlist "Music" is false) is to remove digital booklets and music videos from showing up. The podcast portion is unnecessary for the music playlist, but necessary if podcasts are in library playlist 1.]

Oops

[ Reply to This | # ]