forked from stewartmcgown/uds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileParts.py
30 lines (25 loc) · 937 Bytes
/
FileParts.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
class UDSFile(object):
def __init__(self, name, base64, mime, size, encoded_size, id=None, parents=['root'], size_numeric=None, shared=False, sha256=''):
self.name = name
self.base64 = base64
self.mime = mime
self.size = size
self.size_numeric = size_numeric
self.encoded_size = encoded_size
self.parents = parents
self.id_ = id
self.shared = shared
self.sha256 = sha256
class Chunk():
CHUNK_READ_LENGTH_BYTES = 750000
def __init__(self, path, part, max_size, media, parent):
self.path = path
self.part = part
self.range_start = part * Chunk.CHUNK_READ_LENGTH_BYTES
self.media = media
self.parent = parent
range_end = ((part + 1) * Chunk.CHUNK_READ_LENGTH_BYTES)
if range_end > max_size:
self.range_end = max_size
else:
self.range_end = range_end