2010-05-06 9 views
5

पर कॉल आने पर प्रोग्रामेटिक रूप से रोकें कैसे करें स्काइप में एक अंतर्निहित फ़ंक्शन है जहां कॉल आने पर आईट्यून्स प्लेबैक रोक दिया जाता है और स्वचालित रूप से फिर से शुरू हो जाता है। स्पॉटिफ़ाई के लिए कुछ ऐसा होना अच्छा लगेगा। दोनों एक पायथन एपीआई प्रदान करते हैं, इसलिए यह नीचे जाने के लिए स्पष्ट मार्ग प्रतीत होता है।स्काइप

उत्तर

6

मुझे पाइथन में ऐसा करने में एक झटका लगा है। यह पृष्ठभूमि में एक डिमन के रूप में चलता है, जब कॉल आता है तो स्पॉटिफाइज़ करना/फिर से शुरू करना।

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) 
: यह के लिए स्काइप & Spotify पायथन पुस्तकालयों का उपयोग करता है
संबंधित मुद्दे