-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Source API #298
Comments
We're going to need an API rework to support runtime configuration. It's kind of possible already because media sources have access to the For runtime configuration, sources should be managed more strictly by üWave Core. Maybe an API could look like this: interface MediaItem {
...
}
interface PlaylistMeta {
...
}
// Maybe a generic parameter for the options object?
// Maybe a generic parameter for the SourceData?
abstract class MediaSource {
static api: number = 3;
static name: string;
// This schema would automatically be merged with an `{ enabled: { type: boolean } }` schema using `allOf`
static schema: JSONSchema;
constructor(options: object /* or maybe a generic type */);
get(context: SourceContext, sourceIDs: string[]): Promise<MediaItem[]>;
search(context: SourceContext, query: string, pagination?: any): Promise<MediaItem[]>;
// Get media items in a playlist. sourceID may be ID or a playlist URL or etc
// optional
getPlaylistItems(context: SourceContext, sourceID: string): Promise<MediaItem[]>;
// Get playlists owned by the user [throw error if user has no connected account]
// optional
getSelfPlaylists(context: SourceContext): Promise<PlaylistMeta[]>;
// Get (public) playlists owned by some other user or similar concept.
// optional
getUserPlaylists(context: SourceContext, userID: string): Promise<PlaylistMeta[]>;
// maybe?
// optional
searchPlaylists(context: SourceContext, query: string): Promise<PlaylistMeta[]>;
// optional
close(): Promise<void> | void {}
} |
Turns out static abstract members are not a thing. That was the reason for using an Perhaps it could be an interface and a import { createMediaSource, MediaSource } = require('@u-wave/media-source');
class YouTubeSource implements MediaSource {
// ...
}
export = createMediaSource(YouTubeSource, {
name: 'youtube',
schema: {
// ...
},
}) |
Currently, media sources have three API methods:
search
get
import
search
andget
are quite clear and good now, butimport
is basically a wildcard and requires custom client support. This issue is intended to scope out the features that would be required in a more restrictive API.Feature Checklist
Probably just assign each a name. It could be implicit on the implementer end, so Core would determine it based on which methods are available.
Like the current YouTube source, on the web client this should open a panel that lists all the media in a playlist, and that has an "import all" button that can be used to import the entire thing into a new üWave playlist.
The text was updated successfully, but these errors were encountered: