@jupyterlab/video-extension 4.6.0-alpha.4 → 4.6.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +25 -8
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +33 -10
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { ILayoutRestorer } from '@jupyterlab/application';
|
|
10
10
|
import { WidgetTracker } from '@jupyterlab/apputils';
|
|
11
11
|
import { ABCWidgetFactory, DocumentWidget } from '@jupyterlab/docregistry';
|
|
12
|
-
import { IDefaultDrive
|
|
12
|
+
import { IDefaultDrive } from '@jupyterlab/services';
|
|
13
13
|
import { ITranslator } from '@jupyterlab/translation';
|
|
14
14
|
import { Widget } from '@lumino/widgets';
|
|
15
15
|
/**
|
|
@@ -124,20 +124,38 @@ export class VideoViewerFactory extends ABCWidgetFactory {
|
|
|
124
124
|
*
|
|
125
125
|
* This overrides the default behavior of the RestContentProvider to not include the file content.
|
|
126
126
|
*/
|
|
127
|
-
class VideoContentProvider
|
|
127
|
+
class VideoContentProvider {
|
|
128
128
|
constructor(options) {
|
|
129
|
-
|
|
129
|
+
this._drive = options.drive;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Get a file or directory.
|
|
133
133
|
*
|
|
134
134
|
* @param localPath - The path to the file.
|
|
135
|
-
* @param options - The options used to
|
|
135
|
+
* @param options - The options used to get the file.
|
|
136
136
|
*
|
|
137
137
|
* @returns A promise which resolves with the file content.
|
|
138
138
|
*/
|
|
139
139
|
async get(localPath, options) {
|
|
140
|
-
return
|
|
140
|
+
return this._drive.get(localPath, {
|
|
141
|
+
...options,
|
|
142
|
+
contentProviderId: undefined,
|
|
143
|
+
content: false
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Save a file.
|
|
148
|
+
*
|
|
149
|
+
* @param localPath - The path to the file.
|
|
150
|
+
* @param options - The options used to save the file.
|
|
151
|
+
*
|
|
152
|
+
* @returns A promise which resolves with the file content.
|
|
153
|
+
*/
|
|
154
|
+
async save(localPath, options = {}) {
|
|
155
|
+
return this._drive.save(localPath, {
|
|
156
|
+
...options,
|
|
157
|
+
contentProviderId: undefined
|
|
158
|
+
});
|
|
141
159
|
}
|
|
142
160
|
}
|
|
143
161
|
/**
|
|
@@ -151,15 +169,14 @@ const plugin = {
|
|
|
151
169
|
optional: [ILayoutRestorer],
|
|
152
170
|
activate: (app, translator, defaultDrive, restorer) => {
|
|
153
171
|
const trans = translator.load('jupyterlab');
|
|
154
|
-
const { contents
|
|
172
|
+
const { contents } = app.serviceManager;
|
|
155
173
|
// Get video file types from the document registry
|
|
156
174
|
const videoFileTypes = getVideoFileTypes(app.docRegistry);
|
|
157
175
|
// Register the video stream content provider once
|
|
158
176
|
const registry = defaultDrive.contentProviderRegistry;
|
|
159
177
|
if (registry) {
|
|
160
178
|
const videoContentProvider = new VideoContentProvider({
|
|
161
|
-
|
|
162
|
-
serverSettings
|
|
179
|
+
drive: defaultDrive
|
|
163
180
|
});
|
|
164
181
|
registry.register(VIDEO_CONTENT_PROVIDER_ID, videoContentProvider);
|
|
165
182
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKrD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AAMH,OAAO,EAAE,eAAe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
"description": "JupyterLab - Video File Viewer Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"watch": "tsc -b --watch"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@jupyterlab/application": "^4.6.0-alpha.
|
|
36
|
-
"@jupyterlab/apputils": "^4.7.0-alpha.
|
|
37
|
-
"@jupyterlab/docregistry": "^4.6.0-alpha.
|
|
38
|
-
"@jupyterlab/services": "^7.6.0-alpha.
|
|
39
|
-
"@jupyterlab/translation": "^4.6.0-alpha.
|
|
35
|
+
"@jupyterlab/application": "^4.6.0-alpha.5",
|
|
36
|
+
"@jupyterlab/apputils": "^4.7.0-alpha.5",
|
|
37
|
+
"@jupyterlab/docregistry": "^4.6.0-alpha.5",
|
|
38
|
+
"@jupyterlab/services": "^7.6.0-alpha.5",
|
|
39
|
+
"@jupyterlab/translation": "^4.6.0-alpha.5",
|
|
40
40
|
"@lumino/widgets": "^2.7.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@jupyterlab/testutils": "^4.6.0-alpha.
|
|
43
|
+
"@jupyterlab/testutils": "^4.6.0-alpha.5",
|
|
44
44
|
"@types/jest": "^29.2.0",
|
|
45
45
|
"@types/webpack-env": "^1.18.0",
|
|
46
46
|
"jest": "^29.2.0",
|
package/src/index.ts
CHANGED
|
@@ -18,8 +18,8 @@ import type {
|
|
|
18
18
|
IDocumentWidget
|
|
19
19
|
} from '@jupyterlab/docregistry';
|
|
20
20
|
import { ABCWidgetFactory, DocumentWidget } from '@jupyterlab/docregistry';
|
|
21
|
-
import type { Contents } from '@jupyterlab/services';
|
|
22
|
-
import { IDefaultDrive
|
|
21
|
+
import type { Contents, IContentProvider } from '@jupyterlab/services';
|
|
22
|
+
import { IDefaultDrive } from '@jupyterlab/services';
|
|
23
23
|
import { ITranslator } from '@jupyterlab/translation';
|
|
24
24
|
import { Widget } from '@lumino/widgets';
|
|
25
25
|
|
|
@@ -209,16 +209,16 @@ export namespace VideoViewerFactory {
|
|
|
209
209
|
*
|
|
210
210
|
* This overrides the default behavior of the RestContentProvider to not include the file content.
|
|
211
211
|
*/
|
|
212
|
-
class VideoContentProvider
|
|
213
|
-
constructor(options:
|
|
214
|
-
|
|
212
|
+
class VideoContentProvider implements IContentProvider {
|
|
213
|
+
constructor(options: { drive: Contents.IDrive }) {
|
|
214
|
+
this._drive = options.drive;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* Get a file or directory.
|
|
219
219
|
*
|
|
220
220
|
* @param localPath - The path to the file.
|
|
221
|
-
* @param options - The options used to
|
|
221
|
+
* @param options - The options used to get the file.
|
|
222
222
|
*
|
|
223
223
|
* @returns A promise which resolves with the file content.
|
|
224
224
|
*/
|
|
@@ -226,8 +226,32 @@ class VideoContentProvider extends RestContentProvider {
|
|
|
226
226
|
localPath: string,
|
|
227
227
|
options?: Contents.IFetchOptions
|
|
228
228
|
): Promise<Contents.IModel> {
|
|
229
|
-
return
|
|
229
|
+
return this._drive.get(localPath, {
|
|
230
|
+
...options,
|
|
231
|
+
contentProviderId: undefined,
|
|
232
|
+
content: false
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Save a file.
|
|
238
|
+
*
|
|
239
|
+
* @param localPath - The path to the file.
|
|
240
|
+
* @param options - The options used to save the file.
|
|
241
|
+
*
|
|
242
|
+
* @returns A promise which resolves with the file content.
|
|
243
|
+
*/
|
|
244
|
+
async save(
|
|
245
|
+
localPath: string,
|
|
246
|
+
options: Partial<Contents.IModel> & Contents.IContentProvisionOptions = {}
|
|
247
|
+
): Promise<Contents.IModel> {
|
|
248
|
+
return this._drive.save(localPath, {
|
|
249
|
+
...options,
|
|
250
|
+
contentProviderId: undefined
|
|
251
|
+
});
|
|
230
252
|
}
|
|
253
|
+
|
|
254
|
+
private _drive: Contents.IDrive;
|
|
231
255
|
}
|
|
232
256
|
|
|
233
257
|
/**
|
|
@@ -246,7 +270,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
246
270
|
restorer: ILayoutRestorer | null
|
|
247
271
|
): void => {
|
|
248
272
|
const trans = translator.load('jupyterlab');
|
|
249
|
-
const { contents
|
|
273
|
+
const { contents } = app.serviceManager;
|
|
250
274
|
|
|
251
275
|
// Get video file types from the document registry
|
|
252
276
|
const videoFileTypes = getVideoFileTypes(app.docRegistry);
|
|
@@ -255,8 +279,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
255
279
|
const registry = defaultDrive.contentProviderRegistry;
|
|
256
280
|
if (registry) {
|
|
257
281
|
const videoContentProvider = new VideoContentProvider({
|
|
258
|
-
|
|
259
|
-
serverSettings
|
|
282
|
+
drive: defaultDrive
|
|
260
283
|
});
|
|
261
284
|
registry.register(VIDEO_CONTENT_PROVIDER_ID, videoContentProvider);
|
|
262
285
|
}
|