Advertisement
Guest User

Cloaky

a guest
Feb 3rd, 2010
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. #By Cloaky
  2.  
  3. import win32com.client
  4. import time
  5.  
  6. iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
  7. event = eg.event.suffix
  8. parts = event.split(".")
  9.  
  10. #### Configurations ####
  11. iTunesLowSoundVolume = 50
  12. ########################
  13.  
  14. if parts[1] == "CallIncoming":
  15.     if iTunes.PlayerState != 0:
  16.         eg.globals.iTunesSoundVolume = iTunes.SoundVolume
  17.         print "Incoming Call, Lowering Sound"
  18.         while iTunes.SoundVolume > iTunesLowSoundVolume:
  19.             iTunes.SoundVolume -= 5
  20.             time.sleep(0.25)
  21.  
  22. if parts[1] == "CallDeclined":
  23.     if iTunes.PlayerState != 0:
  24.         print "Call Declined, Raising Sound"
  25.         while iTunes.SoundVolume < eg.globals.iTunesSoundVolume:
  26.             iTunes.SoundVolume += 5
  27.             time.sleep(0.25)
  28.  
  29. if parts[1] == "CallAccept":
  30.     if iTunes.PlayerState != 0:
  31.         eg.globals.iTunesPaused = 1
  32.         print "Call Accepted, Pausing iTunes"
  33.         iTunes.Pause()
  34.     else:
  35.         eg.globals.iTunesPaused = 0
  36.  
  37. if parts[1] == "CallEnd":
  38.     if eg.globals.iTunesPaused == 1 and iTunes.PlayerState == 0:
  39.         eg.globals.iTunesPaused = 0
  40.         print "Call Ended, Resuming iTunes"
  41.         iTunes.Play()
  42.         while iTunes.SoundVolume < eg.globals.iTunesSoundVolume:
  43.             iTunes.SoundVolume += 5
  44.             time.sleep(0.25)
  45.     else:
  46.         print "Call Ended"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement