Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #By Cloaky
- import win32com.client
- import time
- iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")
- event = eg.event.suffix
- parts = event.split(".")
- #### Configurations ####
- iTunesLowSoundVolume = 50
- ########################
- if parts[1] == "CallIncoming":
- if iTunes.PlayerState != 0:
- eg.globals.iTunesSoundVolume = iTunes.SoundVolume
- print "Incoming Call, Lowering Sound"
- while iTunes.SoundVolume > iTunesLowSoundVolume:
- iTunes.SoundVolume -= 5
- time.sleep(0.25)
- if parts[1] == "CallDeclined":
- if iTunes.PlayerState != 0:
- print "Call Declined, Raising Sound"
- while iTunes.SoundVolume < eg.globals.iTunesSoundVolume:
- iTunes.SoundVolume += 5
- time.sleep(0.25)
- if parts[1] == "CallAccept":
- if iTunes.PlayerState != 0:
- eg.globals.iTunesPaused = 1
- print "Call Accepted, Pausing iTunes"
- iTunes.Pause()
- else:
- eg.globals.iTunesPaused = 0
- if parts[1] == "CallEnd":
- if eg.globals.iTunesPaused == 1 and iTunes.PlayerState == 0:
- eg.globals.iTunesPaused = 0
- print "Call Ended, Resuming iTunes"
- iTunes.Play()
- while iTunes.SoundVolume < eg.globals.iTunesSoundVolume:
- iTunes.SoundVolume += 5
- time.sleep(0.25)
- else:
- print "Call Ended"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement