From a041f4f6538717911ec3003d01bf3320fd703775 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 3 Apr 2022 10:34:46 -0700 Subject: [PATCH] sdl: publish --- sdk/gen/types.input.ts | 27 ++++++++++++------- sdk/package-lock.json | 4 +-- sdk/package.json | 2 +- sdk/scrypted_python/scrypted_sdk/types.py | 10 ++++--- sdk/types/index.d.ts | 23 ++++++++++------ sdk/types/index.ts | 27 ++++++++++++------- sdk/types/package-lock.json | 4 +-- sdk/types/package.json | 2 +- .../scrypted_python/scrypted_sdk/types.py | 10 ++++--- 9 files changed, 71 insertions(+), 38 deletions(-) diff --git a/sdk/gen/types.input.ts b/sdk/gen/types.input.ts index c0d00469c..64bb0fbe6 100644 --- a/sdk/gen/types.input.ts +++ b/sdk/gen/types.input.ts @@ -193,7 +193,8 @@ export interface Notifier { * MediaObject is an intermediate object within Scrypted to represent all media objects. Plugins should use the MediaConverter to convert the Scrypted MediaObject into a desired type, whether it is a externally accessible URL, a Buffer, etc. */ export interface MediaObject { - mimeType?: string; + mimeType: string; + console?: Console; } /** * StartStop represents a device that can be started, stopped, and possibly paused and resumed. Typically vacuum cleaners or washers. @@ -907,6 +908,14 @@ export interface OauthClient { onOauthCallback(callbackUrl: string): Promise; } + +export interface MediaObjectOptions { + /** + * The default console to be used when logging usage of the MediaObject. + */ + console?: Console; +} + export interface MediaManager { /** * Additional plugin provided convertors to consider for use when converting MediaObjects. @@ -944,21 +953,21 @@ export interface MediaManager { convertMediaObjectToUrl(mediaObject: string | MediaObject, toMimeType: string): Promise; /** - * Create a MediaObject. The media will be created from the provided FFmpeg input arguments. + * Create a MediaObject from FFMpeg input arguments. */ - createFFmpegMediaObject(ffmpegInput: FFMpegInput): Promise; + createFFmpegMediaObject(ffmpegInput: FFMpegInput, options?: MediaObjectOptions): Promise; + + /** + * Create a MediaObject from an URL. The mime type will be determined dynamically while resolving the url. + */ + createMediaObjectFromUrl(data: string, options?: MediaObjectOptions): Promise; /** * Create a MediaObject. * If the data is a buffer, JSON object, or primitive type, it will be serialized. * All other objects will be objects will become RPC objects. */ - createMediaObject(data: any | Buffer, mimeType: string): Promise; - - /** - * Create a MediaObject from an URL. The mime type should be provided, but it may be inferred from the URL path. - */ - createMediaObjectFromUrl(data: string, mimeType?: string): Promise; + createMediaObject(data: any | Buffer, mimeType: string, options?: MediaObjectOptions): Promise; /** * Get the path to ffmpeg on the host system. diff --git a/sdk/package-lock.json b/sdk/package-lock.json index a9fd0e152..229448423 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/sdk", - "version": "0.0.186", + "version": "0.0.187", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/sdk", - "version": "0.0.186", + "version": "0.0.187", "license": "ISC", "dependencies": { "@babel/preset-typescript": "^7.16.7", diff --git a/sdk/package.json b/sdk/package.json index 9eab68243..6ab8b2d12 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/sdk", - "version": "0.0.186", + "version": "0.0.187", "description": "", "main": "index.js", "scripts": { diff --git a/sdk/scrypted_python/scrypted_sdk/types.py b/sdk/scrypted_python/scrypted_sdk/types.py index 96e31dbbc..151f984d9 100644 --- a/sdk/scrypted_python/scrypted_sdk/types.py +++ b/sdk/scrypted_python/scrypted_sdk/types.py @@ -304,6 +304,10 @@ class HumiditySettingStatus(TypedDict): class Logger(TypedDict): pass +class MediaObjectOptions(TypedDict): + console: Console + pass + class MediaPlayerOptions(TypedDict): autoplay: bool mimeType: str @@ -980,11 +984,11 @@ class MediaManager: pass async def convertMediaObjectToUrl(self, mediaObject: str | MediaObject, toMimeType: str) -> str: pass - async def createFFmpegMediaObject(self, ffmpegInput: FFMpegInput) -> MediaObject: + async def createFFmpegMediaObject(self, ffmpegInput: FFMpegInput, options: MediaObjectOptions = None) -> MediaObject: pass - async def createMediaObject(self, data: Any, mimeType: str) -> MediaObject: + async def createMediaObject(self, data: Any, mimeType: str, options: MediaObjectOptions = None) -> MediaObject: pass - async def createMediaObjectFromUrl(self, data: str, mimeType: str = None) -> MediaObject: + async def createMediaObjectFromUrl(self, data: str, options: MediaObjectOptions = None) -> MediaObject: pass async def getFFmpegPath(self) -> str: pass diff --git a/sdk/types/index.d.ts b/sdk/types/index.d.ts index 2d9c3e9b8..a4a74152b 100644 --- a/sdk/types/index.d.ts +++ b/sdk/types/index.d.ts @@ -337,7 +337,8 @@ export interface Notifier { * MediaObject is an intermediate object within Scrypted to represent all media objects. Plugins should use the MediaConverter to convert the Scrypted MediaObject into a desired type, whether it is a externally accessible URL, a Buffer, etc. */ export interface MediaObject { - mimeType?: string; + mimeType: string; + console?: Console; } /** * StartStop represents a device that can be started, stopped, and possibly paused and resumed. Typically vacuum cleaners or washers. @@ -991,6 +992,12 @@ export interface OauthClient { */ onOauthCallback(callbackUrl: string): Promise; } +export interface MediaObjectOptions { + /** + * The default console to be used when logging usage of the MediaObject. + */ + console?: Console; +} export interface MediaManager { /** * Additional plugin provided convertors to consider for use when converting MediaObjects. @@ -1021,19 +1028,19 @@ export interface MediaManager { */ convertMediaObjectToUrl(mediaObject: string | MediaObject, toMimeType: string): Promise; /** - * Create a MediaObject. The media will be created from the provided FFmpeg input arguments. + * Create a MediaObject from FFMpeg input arguments. */ - createFFmpegMediaObject(ffmpegInput: FFMpegInput): Promise; + createFFmpegMediaObject(ffmpegInput: FFMpegInput, options?: MediaObjectOptions): Promise; + /** + * Create a MediaObject from an URL. The mime type will be determined dynamically while resolving the url. + */ + createMediaObjectFromUrl(data: string, options?: MediaObjectOptions): Promise; /** * Create a MediaObject. * If the data is a buffer, JSON object, or primitive type, it will be serialized. * All other objects will be objects will become RPC objects. */ - createMediaObject(data: any | Buffer, mimeType: string): Promise; - /** - * Create a MediaObject from an URL. The mime type should be provided, but it may be inferred from the URL path. - */ - createMediaObjectFromUrl(data: string, mimeType?: string): Promise; + createMediaObject(data: any | Buffer, mimeType: string, options?: MediaObjectOptions): Promise; /** * Get the path to ffmpeg on the host system. */ diff --git a/sdk/types/index.ts b/sdk/types/index.ts index c95a663e5..9b2ea92a8 100644 --- a/sdk/types/index.ts +++ b/sdk/types/index.ts @@ -894,7 +894,8 @@ export interface Notifier { * MediaObject is an intermediate object within Scrypted to represent all media objects. Plugins should use the MediaConverter to convert the Scrypted MediaObject into a desired type, whether it is a externally accessible URL, a Buffer, etc. */ export interface MediaObject { - mimeType?: string; + mimeType: string; + console?: Console; } /** * StartStop represents a device that can be started, stopped, and possibly paused and resumed. Typically vacuum cleaners or washers. @@ -1608,6 +1609,14 @@ export interface OauthClient { onOauthCallback(callbackUrl: string): Promise; } + +export interface MediaObjectOptions { + /** + * The default console to be used when logging usage of the MediaObject. + */ + console?: Console; +} + export interface MediaManager { /** * Additional plugin provided convertors to consider for use when converting MediaObjects. @@ -1645,21 +1654,21 @@ export interface MediaManager { convertMediaObjectToUrl(mediaObject: string | MediaObject, toMimeType: string): Promise; /** - * Create a MediaObject. The media will be created from the provided FFmpeg input arguments. + * Create a MediaObject from FFMpeg input arguments. */ - createFFmpegMediaObject(ffmpegInput: FFMpegInput): Promise; + createFFmpegMediaObject(ffmpegInput: FFMpegInput, options?: MediaObjectOptions): Promise; + + /** + * Create a MediaObject from an URL. The mime type will be determined dynamically while resolving the url. + */ + createMediaObjectFromUrl(data: string, options?: MediaObjectOptions): Promise; /** * Create a MediaObject. * If the data is a buffer, JSON object, or primitive type, it will be serialized. * All other objects will be objects will become RPC objects. */ - createMediaObject(data: any | Buffer, mimeType: string): Promise; - - /** - * Create a MediaObject from an URL. The mime type should be provided, but it may be inferred from the URL path. - */ - createMediaObjectFromUrl(data: string, mimeType?: string): Promise; + createMediaObject(data: any | Buffer, mimeType: string, options?: MediaObjectOptions): Promise; /** * Get the path to ffmpeg on the host system. diff --git a/sdk/types/package-lock.json b/sdk/types/package-lock.json index 3490ac229..d6c4e0b25 100644 --- a/sdk/types/package-lock.json +++ b/sdk/types/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/types", - "version": "0.0.28", + "version": "0.0.29", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/types", - "version": "0.0.28", + "version": "0.0.29", "license": "ISC", "devDependencies": {} } diff --git a/sdk/types/package.json b/sdk/types/package.json index a510bf83e..9989bf5c7 100644 --- a/sdk/types/package.json +++ b/sdk/types/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/types", - "version": "0.0.28", + "version": "0.0.29", "description": "", "main": "index.js", "author": "", diff --git a/sdk/types/scrypted_python/scrypted_sdk/types.py b/sdk/types/scrypted_python/scrypted_sdk/types.py index 96e31dbbc..151f984d9 100644 --- a/sdk/types/scrypted_python/scrypted_sdk/types.py +++ b/sdk/types/scrypted_python/scrypted_sdk/types.py @@ -304,6 +304,10 @@ class HumiditySettingStatus(TypedDict): class Logger(TypedDict): pass +class MediaObjectOptions(TypedDict): + console: Console + pass + class MediaPlayerOptions(TypedDict): autoplay: bool mimeType: str @@ -980,11 +984,11 @@ class MediaManager: pass async def convertMediaObjectToUrl(self, mediaObject: str | MediaObject, toMimeType: str) -> str: pass - async def createFFmpegMediaObject(self, ffmpegInput: FFMpegInput) -> MediaObject: + async def createFFmpegMediaObject(self, ffmpegInput: FFMpegInput, options: MediaObjectOptions = None) -> MediaObject: pass - async def createMediaObject(self, data: Any, mimeType: str) -> MediaObject: + async def createMediaObject(self, data: Any, mimeType: str, options: MediaObjectOptions = None) -> MediaObject: pass - async def createMediaObjectFromUrl(self, data: str, mimeType: str = None) -> MediaObject: + async def createMediaObjectFromUrl(self, data: str, options: MediaObjectOptions = None) -> MediaObject: pass async def getFFmpegPath(self) -> str: pass