Created
October 15, 2011 02:27
-
-
Save sahilgupta/1288915 to your computer and use it in GitHub Desktop.
Revisions
-
sahilgupta revised this gist
Oct 15, 2011 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,8 @@ #TODO: Add threading to avoid blocking #TODO: Create a windows service out of this #TODO: Start the Track somewhere in the middle instead of the very start! import win32com.client import random import time -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ import win32com.client import random import time itunes= win32com.client.Dispatch("iTunes.Application") mainLibrary = itunes.LibrarySource.Playlists.ItemByName('Music') tracks = mainLibrary.Tracks numTracks = tracks.Count while True: print "Sleep over" tnumber = random.randint(1, numTracks) print tnumber currTrack = tracks.Item(tnumber) currTrack.Play() time.sleep(currTrack.Duration /3)