set userPass to "{\"username\" : \"" & username & "\", \"password\" : \"" & pass & "\","
set sendUrl to ""
tell application "iTunes"
set theLists to every playlist whose special kind is TV Shows or special kind is Movies
repeat with theList in theLists
set allTracks to (every track of theList whose played date > currDate)
repeat with aTrack in allTracks
set played to played date of aTrack
set typeOfTrack to video kind of aTrack
set theYear to year of aTrack
if played > currDate then
if typeOfTrack = movie then
set sendUrl to movieUrl
set theMovieName to name of aTrack
set nrOfPlays to played count of aTrack
set lastPlayed to played date of aTrack
set lastPlayed to do shell script "date -j -f \"%A %d %B %Y %H:%M:%S\" \"" & lastPlayed & "\" +%s"
set sendData to userPass & "\"movies\" : [{\"title\" : \"" & theMovieName & "\", \"year\" : " & theYear & ", \"plays\" : " & nrOfPlays & ", \"last_played\" : " & lastPlayed & "}]"