-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFile.js
116 lines (75 loc) · 2.24 KB
/
File.js
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
export class File {
// The file ID
id = 0
// The display name of the file
name;
// The size of the file in bytes
size = 0;
// The metatype of file
contentType;
// Does the file have an MP4?
hasMp4 = false
// The ID of the parent folder (if there is one)
parentId = 0
// Whether the file has been access or not
accessed = false
// URL string of a screenshot
screenshot;
// Whether the file has been shared with you or if you own it
isShared = false
// Seconds that the file should be started from
startFrom = 0
// Reference to parent file
parent;
// The timestamp when the file was created
createdAt;
// Link to an HLS playlist that allows for streaming on Apple devices easily
get hlsPlaylist() {
const { accessToken } = PutioKit;
if(!accessToken) return null;
// TODO: Return the URL to the HLSPlaylist
}
// Whether the file is a directory or not
get isDirectory() {
const { contentType } = this;
return (contentType == 'application/x-directory');
}
constructor(json) {
if(json.id) this.id = json.id;
if(json.name) this.name = json.name;
if(json.is_shared) this.isShared = json.is_shared;
if(json.is_mp4_available) this.hasMp4 = true;
if(json.parent_id) this.parentId = json.parent_id;
if(json.size) this.size = json.size;
if(json.content_type) this.contentType = json.content_type;
if(json.first_accessed_at) this.accessed = true;
if(json.created_at) this.createdAt = json.created_at; // TODO: change this to a JS date object for easy formatting later
if(json.screenshot) this.screenshot = json.screenshot;
if(json.start_from) this.startFrom = json.start_from;
}
async rename(name) {
}
async getProgress() {
}
async convertToMp4() {
}
async getMp4Status() {
}
async share(friends) {
}
async unshare(friends) {
}
async delete() {
}
async move(to) {
}
async getSharedWith() {
}
async getSubtitles() {
}
async setPosition(position) {
}
async deletePosition() {
}
}
export default File;