Package Skype4Py :: Module filetransfer
[frames] | no frames]

Source Code for Module Skype4Py.filetransfer

  1  """File transfers. 
  2  """ 
  3  __docformat__ = 'restructuredtext en' 
  4   
  5   
  6  import os 
  7   
  8  from utils import * 
  9   
 10   
11 -class FileTransfer(Cached):
12 """Represents a file transfer. 13 """ 14 _ValidateHandle = int 15
16 - def __repr__(self):
17 return Cached.__repr__(self, 'Id')
18
19 - def _Alter(self, AlterName, Args=None):
20 return self._Owner._Alter('FILETRANSFER', self.Id, AlterName, Args)
21
22 - def _Property(self, PropName, Set=None):
23 return self._Owner._Property('FILETRANSFER', self.Id, PropName, Set)
24
25 - def _GetBytesPerSecond(self):
26 return int(self._Property('BYTESPERSECOND'))
27 28 BytesPerSecond = property(_GetBytesPerSecond, 29 doc="""Transfer speed in bytes per second. 30 31 :type: int 32 """) 33
34 - def _GetBytesTransferred(self):
35 return long(self._Property('BYTESTRANSFERRED'))
36 37 BytesTransferred = property(_GetBytesTransferred, 38 doc="""Number of bytes transferred. 39 40 :type: long 41 """) 42
43 - def _GetFailureReason(self):
44 return str(self._Property('FAILUREREASON'))
45 46 FailureReason = property(_GetFailureReason, 47 doc="""Transfer failure reason. 48 49 :type: `enums`.fileTransferFailureReason* 50 """) 51
52 - def _GetFileName(self):
53 return os.path.basename(self.FilePath)
54 55 FileName = property(_GetFileName, 56 doc="""Name of the transferred file. 57 58 :type: str 59 """) 60
61 - def _GetFilePath(self):
62 return unicode2path(self._Property('FILEPATH'))
63 64 FilePath = property(_GetFilePath, 65 doc="""Full path to the transferred file. 66 67 :type: str 68 """) 69
70 - def _GetFileSize(self):
71 return long(self._Property('FILESIZE'))
72 73 FileSize = property(_GetFileSize, 74 doc="""Size of the transferred file in bytes. 75 76 :type: long 77 """) 78
79 - def _GetFinishDatetime(self):
80 from datetime import datetime 81 return datetime.fromtimestamp(self.FinishTime)
82 83 FinishDatetime = property(_GetFinishDatetime, 84 doc="""File transfer end date and time. 85 86 :type: datetime.datetime 87 """) 88
89 - def _GetFinishTime(self):
90 return float(self._Property('FINISHTIME'))
91 92 FinishTime = property(_GetFinishTime, 93 doc="""File transfer end timestamp. 94 95 :type: float 96 """) 97
98 - def _GetId(self):
99 return self._Handle
100 101 Id = property(_GetId, 102 doc="""Unique file transfer Id. 103 104 :type: int 105 """) 106
107 - def _GetPartnerDisplayName(self):
108 return self._Property('PARTNER_DISPNAME')
109 110 PartnerDisplayName = property(_GetPartnerDisplayName, 111 doc="""File transfer partner DisplayName. 112 113 :type: unicode 114 """) 115
116 - def _GetPartnerHandle(self):
117 return str(self._Property('PARTNER_HANDLE'))
118 119 PartnerHandle = property(_GetPartnerHandle, 120 doc="""File transfer partner Skypename. 121 122 :type: str 123 """) 124
125 - def _GetStartDatetime(self):
126 from datetime import datetime 127 return datetime.fromtimestamp(self.StartTime)
128 129 StartDatetime = property(_GetStartDatetime, 130 doc="""File transfer start date and time. 131 132 :type: datetime.datetime 133 """) 134
135 - def _GetStartTime(self):
136 return float(self._Property('STARTTIME'))
137 138 StartTime = property(_GetStartTime, 139 doc="""File transfer start timestamp. 140 141 :type: float 142 """) 143
144 - def _GetStatus(self):
145 return str(self._Property('STATUS'))
146 147 Status = property(_GetStatus, 148 doc="""File transfer status. 149 150 :type: `enums`.fileTransferStatus* 151 """) 152
153 - def _GetType(self):
154 return str(self._Property('TYPE'))
155 156 Type = property(_GetType, 157 doc="""File transfer type. 158 159 :type: `enums`.fileTransferType* 160 """)
161 162
163 -class FileTransferCollection(CachedCollection):
164 _CachedType = FileTransfer
165