This method handles library events.
args - request object; parameters described below
A promise resolving to an event response. Stremio does not wait for or use the response.
type - type of the item that we’re emitting library events for; e.g. movie, series, channel, tv (see Content Types)
id - a Meta ID as described in the Meta Object
extra - object that holds additional properties; defined below
config - object with user settings, see Manifest - User Data
action - set in the extra object; a string defining the user action, can be either: libraryAdd, libraryRemove, watched, unwatched.
videoId - optional, set in the extra object for watched and unwatched when specific videos were marked; a comma-separated list of Video IDs as described in the Video Object. Without it, the whole item was marked. Marking a season sends its videos in one event, split into several events of up to 100 videos for longer seasons.
The Video ID is the same as the Meta ID for movies.
For IMDB series (provided by Cinemeta), the video ID is formed by joining the Meta ID, season and episode with a colon (e.g. "tt0898266:9:17").
builder.defineLibraryHandler(function(args) {
if (args.type === 'movie' && args.id === 'tt1254207') {
// handle the library event
return Promise.resolve({ success: true })
} else {
// otherwise return false
return Promise.resolve({ success: false })
}
})
Note: You may require additional metadata for the requested item (such as name, releaseInfo, etc), if the requested ID is a IMDB ID (Cinemeta, for example, uses only IMDB IDs), then please refer to Getting Metadata from Cinemeta for this purpose.