@jupyterlab/video-extension 4.5.6 → 4.5.7
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;AAEH,OAAO,EACL,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,gBAAgB,EAEhB,cAAc,EAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AAEH,OAAO,EACL,eAAe,EAGhB,MAAM,yBAAyB,CAAC;AACjC,OA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,CAAC;YAEH,iEAAiE;YACjE,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,mBAAmB,CACnD,MAAM,CAAC,OAAO,CAAC,IAAI,CACpB,CAAC;YACF,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CACxC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAC7D,CAAC;YAEF,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;gBACvC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC;gBACvD,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,IAAI,EAAE,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,+CAA+C;YAC/C,KAAK,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE;gBAC7B,OAAO,EAAE,iBAAiB;gBAC1B,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;oBACf,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;oBACzB,OAAO,EAAE,aAAa;iBACvB,CAAC;gBACF,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/video-extension",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.7",
|
|
4
4
|
"description": "JupyterLab - Video File Viewer Extension",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"watch": "tsc -b --watch"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@jupyterlab/application": "^4.5.
|
|
41
|
-
"@jupyterlab/apputils": "^4.6.
|
|
42
|
-
"@jupyterlab/docregistry": "^4.5.
|
|
43
|
-
"@jupyterlab/services": "^7.5.
|
|
44
|
-
"@jupyterlab/translation": "^4.5.
|
|
40
|
+
"@jupyterlab/application": "^4.5.7",
|
|
41
|
+
"@jupyterlab/apputils": "^4.6.7",
|
|
42
|
+
"@jupyterlab/docregistry": "^4.5.7",
|
|
43
|
+
"@jupyterlab/services": "^7.5.7",
|
|
44
|
+
"@jupyterlab/translation": "^4.5.7",
|
|
45
45
|
"@lumino/widgets": "^2.7.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@jupyterlab/testutils": "^4.5.
|
|
48
|
+
"@jupyterlab/testutils": "^4.5.7",
|
|
49
49
|
"@types/jest": "^29.2.0",
|
|
50
50
|
"@types/webpack-env": "^1.18.0",
|
|
51
51
|
"jest": "^29.2.0",
|
package/src/index.ts
CHANGED
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
} from '@jupyterlab/docregistry';
|
|
22
22
|
import {
|
|
23
23
|
Contents,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
IContentProvider,
|
|
25
|
+
IDefaultDrive
|
|
26
26
|
} from '@jupyterlab/services';
|
|
27
27
|
import { ITranslator } from '@jupyterlab/translation';
|
|
28
28
|
import { Widget } from '@lumino/widgets';
|
|
@@ -213,16 +213,16 @@ export namespace VideoViewerFactory {
|
|
|
213
213
|
*
|
|
214
214
|
* This overrides the default behavior of the RestContentProvider to not include the file content.
|
|
215
215
|
*/
|
|
216
|
-
class VideoContentProvider
|
|
217
|
-
constructor(options:
|
|
218
|
-
|
|
216
|
+
class VideoContentProvider implements IContentProvider {
|
|
217
|
+
constructor(options: { drive: Contents.IDrive }) {
|
|
218
|
+
this._drive = options.drive;
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* Get a file or directory.
|
|
223
223
|
*
|
|
224
224
|
* @param localPath - The path to the file.
|
|
225
|
-
* @param options - The options used to
|
|
225
|
+
* @param options - The options used to get the file.
|
|
226
226
|
*
|
|
227
227
|
* @returns A promise which resolves with the file content.
|
|
228
228
|
*/
|
|
@@ -230,8 +230,32 @@ class VideoContentProvider extends RestContentProvider {
|
|
|
230
230
|
localPath: string,
|
|
231
231
|
options?: Contents.IFetchOptions
|
|
232
232
|
): Promise<Contents.IModel> {
|
|
233
|
-
return
|
|
233
|
+
return this._drive.get(localPath, {
|
|
234
|
+
...options,
|
|
235
|
+
contentProviderId: undefined,
|
|
236
|
+
content: false
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Save a file.
|
|
242
|
+
*
|
|
243
|
+
* @param localPath - The path to the file.
|
|
244
|
+
* @param options - The options used to save the file.
|
|
245
|
+
*
|
|
246
|
+
* @returns A promise which resolves with the file content.
|
|
247
|
+
*/
|
|
248
|
+
async save(
|
|
249
|
+
localPath: string,
|
|
250
|
+
options: Partial<Contents.IModel> & Contents.IContentProvisionOptions = {}
|
|
251
|
+
): Promise<Contents.IModel> {
|
|
252
|
+
return this._drive.save(localPath, {
|
|
253
|
+
...options,
|
|
254
|
+
contentProviderId: undefined
|
|
255
|
+
});
|
|
234
256
|
}
|
|
257
|
+
|
|
258
|
+
private _drive: Contents.IDrive;
|
|
235
259
|
}
|
|
236
260
|
|
|
237
261
|
/**
|
|
@@ -250,7 +274,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
250
274
|
restorer: ILayoutRestorer | null
|
|
251
275
|
): void => {
|
|
252
276
|
const trans = translator.load('jupyterlab');
|
|
253
|
-
const { contents
|
|
277
|
+
const { contents } = app.serviceManager;
|
|
254
278
|
|
|
255
279
|
// Get video file types from the document registry
|
|
256
280
|
const videoFileTypes = getVideoFileTypes(app.docRegistry);
|
|
@@ -259,8 +283,7 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|
|
259
283
|
const registry = defaultDrive.contentProviderRegistry;
|
|
260
284
|
if (registry) {
|
|
261
285
|
const videoContentProvider = new VideoContentProvider({
|
|
262
|
-
|
|
263
|
-
serverSettings
|
|
286
|
+
drive: defaultDrive
|
|
264
287
|
});
|
|
265
288
|
registry.register(VIDEO_CONTENT_PROVIDER_ID, videoContentProvider);
|
|
266
289
|
}
|