Skype has an inbuilt function where iTunes playback is paused and resumed automatically when a call comes in. It would be nice to have something similar for Spotify. Both provide a python API so this would seem the obvious route to go down.
I've had a stab at doing this in python. It runs in the background as a daemon, pausing/resuming spotify when a call comes. It uses the Python libraries for Skype & Spotify:
http://code.google.com/p/pytify/
https://developer.skype.com/wiki/Skype4Py
import Skype4Py
import time
from pytify import Spotify
# Create Skype object
skype = Skype4Py.Skype()
skype.Attach()
# Create Spotify object
spotify = Spotify()
spotifyPlaying = spotify.isPlaying()
# Create handler for when Skype call status changes
def on_call_status(call, status):
if status == Skype4Py.clsInProgress:
# Save current spotify state
global spotifyPlaying
spotifyPlaying = spotify.isPlaying()
if spotify.isPlaying():
print "Call started, pausing spotify"
# Call started, pause Spotify
spotify.stop()
elif status == Skype4Py.clsFinished:
# Call finished, resume Spotify if it was playing
if spotifyPlaying and not spotify.isPlaying():
print "Call finished, resuming spotify"
spotify.playpause()
skype.OnCallStatus = on_call_status
while True:
time.sleep(10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With