forked from romanvm/Kodistubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xbmcvfs.py
211 lines (161 loc) · 4.03 KB
/
xbmcvfs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
## @package xbmcvfs
# Classes and functions to work with files and folders.
#
class File(object):
def __init__(self, filename, type = None):
"""
'w' - opt open for write
example:
f = xbmcvfs.File(file, ['w'])
"""
pass
def close(self):
"""
example:
f = xbmcvfs.File(file)
f.close()
"""
pass
def read(self, bytes = None):
"""
bytes : how many bytes to read [opt]- if not set it will read the whole file
example:
f = xbmcvfs.File(file)
b = f.read()
f.close()
"""
pass
def readBytes(self, numbytes):
"""
readBytes(numbytes)
numbytes : how many bytes to read [opt]- if not set it will read the whole file
returns: bytearray
example:
f = xbmcvfs.File(file)
b = f.read()
f.close()
"""
return bytearray
def seek(self):
"""
FilePosition : position in the file
Whence : where in a file to seek from[0 begining, 1 current , 2 end possition]
example:
f = xbmcvfs.File(file)
result = f.seek(8129, 0)
f.close()
"""
pass
def size(self):
"""
example:
f = xbmcvfs.File(file)
s = f.size()
f.close()
"""
return int
def write(self, buffer):
"""
buffer : buffer to write to file
example:
f = xbmcvfs.File(file, 'w', True)
result = f.write(buffer)
f.close()
"""
pass
#noinspection PyUnusedLocal
def copy(source, destination):
"""Copy file to destination, returns true/false.
source: string - file to copy.
destination: string - destination file
Example:
success = xbmcvfs.copy(source, destination)"""
return bool
#noinspection PyUnusedLocal
def delete(file):
"""Deletes a file.
file: string - file to delete
Example:
xbmcvfs.delete(file)"""
pass
#noinspection PyUnusedLocal
def rename(file, newFileName):
"""Renames a file, returns true/false.
file: string - file to rename
newFileName: string - new filename, including the full path
Example:
success = xbmcvfs.rename(file,newFileName)"""
return bool
#noinspection PyUnusedLocal
def mkdir(path):
"""Create a folder.
path: folder
Example:
success = xbmcfvs.mkdir(path)
"""
return bool
#noinspection PyUnusedLocal
def mkdirs(path):
"""
mkdirs(path)--Create folder(s) - it will create all folders in the path.
path : folder
example:
- success = xbmcvfs.mkdirs(path)
"""
return bool
#noinspection PyUnusedLocal
def rmdir(path):
"""Remove a folder.
path: folder
Example:
success = xbmcfvs.rmdir(path)
"""
return bool
#noinspection PyUnusedLocal
def exists(path):
"""Checks for a file or folder existance, mimics Pythons os.path.exists()
path: string - file or folder
Example:
success = xbmcvfs.exists(path)"""
return bool
def listdir(path):
"""
listdir(path) -- lists content of a folder.
path : folder
example:
- dirs, files = xbmcvfs.listdir(path)
"""
pass
def mkdirs(path):
"""Create folder(s) - it will create all folders in the path.
path: folder
Example:
success = xbmcfvs.mkdirs(path)
"""
return bool
class Stat(object):
def __init__(self, path):
"""
Stat(path) -- get file or file system status.
path : file or folder
example:
- print xbmcvfs.Stat(path).st_mtime()
"""
def st_mode(self):
return None
def st_ino(self):
return None
def st_nlink(self):
return None
def st_uid(self):
return None
def st_gid(self):
return None
def st_size(self):
return None
def st_atime(self):
return None
def st_mtime(self):
return None
def st_ctime(self):
return None