2
# ----------------------------------------------------------------------------------------------------
3
# Python / Skype4Py example that sets user's online status to Do Not Disturb
9
# ----------------------------------------------------------------------------------------------------
10
# Fired on attachment status change. If attachment to API is successful,
11
# this function sets skype.CurrentUserStatus to 'DND'.
14
print 'API attachment status: ' + skype.Convert.AttachmentStatusToText(status)
16
if status == Skype4Py.apiAttachAvailable:
19
if status == Skype4Py.apiAttachSuccess:
20
print 'Reading Skype\'s contact info'
21
#for user in skype.Friends:
23
tmp = tuple(sorted(skype.Friends, key=lambda friend: friend.FullName))
24
friends = tuple(sorted(tmp, key=lambda friend: friend.OnlineStatus, reverse=True))
25
arg = int(sys.argv[1])
27
print(friends[arg].Handle)
28
print(friends[arg].FullName)
29
print(friends[arg].OnlineStatus)
30
print(friends[arg].Language)
31
print(friends[arg].Birthday)
32
print(friends[arg].Sex)
33
print(friends[arg].PhoneHome)
34
print(friends[arg].PhoneMobile)
35
print(friends[arg].PhoneOffice)
36
print(friends[1].Handle)
37
print(friends[1].FullName)
38
print(friends[1].OnlineStatus)
39
print(friends[1].Language)
40
print(friends[1].Birthday)
42
print(friends[1].PhoneHome)
43
print(friends[1].PhoneMobile)
44
print(friends[1].PhoneOffice)
46
print(friends[arg].Handle)
47
print(friends[arg].FullName)
48
print(friends[arg].OnlineStatus)
49
print(friends[arg].Language)
50
print(friends[arg].Birthday)
51
print(friends[arg].Sex)
52
print(friends[arg].PhoneHome)
53
print(friends[arg].PhoneMobile)
54
print(friends[arg].PhoneOffice)
56
print(friends[arg].Aliases)
59
# ----------------------------------------------------------------------------------------------------
60
# Fired on user's online status change. Prints out new status.
62
#def OnUserStatus(status):
63
# print 'User status has changed to ' + status
66
# ----------------------------------------------------------------------------------------------------
67
# Creating instance of Skype object, assigning handler functions and attaching to Skype.
69
skype = Skype4Py.Skype()
70
skype.OnAttachmentStatus = OnAttach
71
#skype.OnUserStatus = OnUserStatus
73
print 'Connecting to Skype..'
76
# ----------------------------------------------------------------------------------------------------
77
# Looping until user types 'exit'
79
#while not Cmd == 'exit':
80
# Cmd = raw_input('');