### Get Kodi Addons by Content Type Source: https://context7.com/regseb/castkodi/llms.txt Fetches addons for specified content types. Multiple types can be provided as arguments. ```javascript // Get addons for multiple content types const addons = await kodi.addons.getAddons("video", "audio"); ``` -------------------------------- ### Check if Specific Kodi Addon is Installed Source: https://context7.com/regseb/castkodi/llms.txt Verifies if a particular addon, identified by its 'addonid', is present in the list of video addons. ```javascript // Check if specific addon is installed const hasYouTube = videoAddons.some(a => a.addonid === "plugin.video.youtube"); if (hasYouTube) { console.log("YouTube addon is available"); } ``` -------------------------------- ### Get Kodi Video Addons Source: https://context7.com/regseb/castkodi/llms.txt Retrieves all enabled video addons installed on Kodi. Requires the 'video' content type. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Get all enabled video addons const videoAddons = await kodi.addons.getAddons("video"); console.log(videoAddons); ``` -------------------------------- ### Control Kodi Application Properties Source: https://context7.com/regseb/castkodi/llms.txt Get and set application properties like volume and mute state. Supports increment/decrement for volume and provides notifications for property changes. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Get application properties const props = await kodi.application.getProperties(["volume", "muted"]); console.log(props); // { volume: 75, muted: false } // Set volume (0-100) and unmute const newVolume = await kodi.application.setVolume(80); console.log(newVolume); // 80 // Increment/decrement volume await kodi.application.setVolume("increment"); // +1 await kodi.application.setVolume("decrement"); // -1 // Toggle mute const isMuted = await kodi.application.setMute(); console.log(isMuted); // true or false // Listen for volume changes kodi.application.onPropertyChanged.addListener((data) => { console.log("Volume:", data.volume, "Muted:", data.muted); }); ``` -------------------------------- ### Change Active Kodi Server Source: https://context7.com/regseb/castkodi/llms.txt Switches the active Kodi server in a multi-server setup by providing the index of the desired server. ```javascript // Change active Kodi server (for multi-server setup) await menu.change(1); // Switch to server at index 1 ``` -------------------------------- ### Connect to Kodi using JSON-RPC Client Source: https://context7.com/regseb/castkodi/llms.txt Demonstrates how to check Kodi connection status and version, and interact with Kodi using a singleton instance or a custom client. Ensure Kodi is accessible at the specified address and meets the minimum version requirement. ```javascript import { Kodi, kodi } from "./core/jsonrpc/kodi.js"; // Check connection and Kodi version before use try { const status = await Kodi.check("192.168.1.100"); console.log(status); // "OK" } catch (err) { if (err.type === "notSupported") { console.error("Kodi version too old, requires v20 (Nexus) or later"); } else if (err.type === "notFound") { console.error("Cannot connect to Kodi at specified address"); } } // Use the singleton kodi instance (reads address from browser storage) const version = await kodi.jsonrpc.version(); console.log(version); // { major: 13, minor: 0, patch: 0 } // Or create a custom instance with specific address const customKodi = new Kodi("ws://192.168.1.100:9090/jsonrpc"); await customKodi.jsonrpc.ping(); // "OK" customKodi.close(); // Close connection when done ``` -------------------------------- ### System Control API Source: https://context7.com/regseb/castkodi/llms.txt Provides methods for controlling the Kodi system, including power management operations. ```APIDOC ## System Control API ### Description Provides methods for controlling the Kodi system including power management operations. ### Methods - **getProperties(properties: Array): Promise** Retrieves specified system properties like shutdown/reboot capabilities. - **shutdown(): Promise** Initiates system shutdown. - **reboot(): Promise** Initiates system reboot. - **suspend(): Promise** Initiates system suspend (sleep). - **hibernate(): Promise** Initiates system hibernate. ### Example Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Get system properties const props = await kodi.system.getProperties([ "canshutdown", "canreboot", "cansuspend", "canhibernate" ]); console.log(props); // { canshutdown: true, canreboot: true, cansuspend: true, canhibernate: false } // Power management (use with caution) await kodi.system.shutdown(); // Power off the system await kodi.system.reboot(); // Restart the system await kodi.system.suspend(); // Suspend (sleep) await kodi.system.hibernate(); // Hibernate ``` ``` -------------------------------- ### GUI Control API Source: https://context7.com/regseb/castkodi/llms.txt Provides display-related controls for Kodi, such as toggling fullscreen mode. ```APIDOC ## GUI Control API ### Description Provides display-related controls such as fullscreen toggling. ### Methods - **setFullscreen(fullscreen?: boolean): Promise** Toggles or sets the fullscreen mode. Returns the new fullscreen state. ### Example Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Toggle fullscreen mode - returns new state const isFullscreen = await kodi.gui.setFullscreen(); console.log(isFullscreen); // true or false ``` ``` -------------------------------- ### Handle No Media Found Source: https://context7.com/regseb/castkodi/llms.txt Returns undefined when no playable media can be extracted from a given URL, such as a text-only page. ```javascript // Returns undefined if no media found const noMedia = await extract( new URL("https://example.com/text-only-page"), { depth: false, incognito: false } ); console.log(noMedia); // undefined ``` -------------------------------- ### Kodi JSON-RPC Client Source: https://context7.com/regseb/castkodi/llms.txt This section covers the core Kodi class for establishing and managing a WebSocket-based JSON-RPC connection to Kodi. It includes methods for checking connection status, verifying Kodi version, and interacting with various Kodi namespaces. ```APIDOC ## Kodi JSON-RPC Client ### Description The core Kodi class provides a WebSocket-based JSON-RPC client for communicating with Kodi. It handles connection management, API version verification, and provides access to various Kodi namespaces (Player, Playlist, Application, Input, System, GUI, Addons). ### Usage ```javascript import { Kodi, kodi } from "./core/jsonrpc/kodi.js"; // Check connection and Kodi version before use try { const status = await Kodi.check("192.168.1.100"); console.log(status); // "OK" } catch (err) { if (err.type === "notSupported") { console.error("Kodi version too old, requires v20 (Nexus) or later"); } else if (err.type === "notFound") { console.error("Cannot connect to Kodi at specified address"); } } // Use the singleton kodi instance (reads address from browser storage) const version = await kodi.jsonrpc.version(); console.log(version); // { major: 13, minor: 0, patch: 0 } // Or create a custom instance with specific address const customKodi = new Kodi("ws://192.168.1.100:9090/jsonrpc"); await customKodi.jsonrpc.ping(); // "OK" customKodi.close(); // Close connection when done ``` ``` -------------------------------- ### Input Control API Source: https://context7.com/regseb/castkodi/llms.txt Provides methods for navigation and text input in Kodi's UI, including support for input request notifications. ```APIDOC ## Input Control API ### Description Provides methods for navigation and text input in Kodi's UI, including support for input request notifications. ### Methods - **home(): Promise** Navigates to the Kodi home screen. - **back(): Promise** Navigates back. - **select(): Promise** Selects the currently focused item. - **contextMenu(): Promise** Opens the context menu for the current item. - **info(): Promise** Shows the information dialog for the current item. - **showOSD(): Promise** Shows the player on-screen display (OSD). - **showPlayerProcessInfo(): Promise** Shows player process information (codec, resolution, etc.). - **sendText(text: string, closeDialog?: boolean): Promise** Sends text input to Kodi. If `closeDialog` is true, the input dialog is closed. - **buttonEvent(button: string, device: "KB" | "XG" | "R1"): Promise** Simulates a button press event from a specified device (Keyboard, Xbox Gamepad, Remote). ### Events - **onInputRequested(request: InputRequest): void** Fired when Kodi requires user input (e.g., for text entry, time, date). ### Example Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Navigation await kodi.input.home(); // Go to home screen await kodi.input.back(); // Go back await kodi.input.select(); // Select current item await kodi.input.contextMenu(); // Show context menu await kodi.input.info(); // Show info dialog // Show player on-screen display await kodi.input.showOSD(); // Show player process info (codec, resolution, etc.) await kodi.input.showPlayerProcessInfo(); // Send text input await kodi.input.sendText("search query", true); // true = close input dialog // Send button event (keyboard, Xbox gamepad, remote) await kodi.input.buttonEvent("left", "KB"); // Keyboard left arrow await kodi.input.buttonEvent("A", "XG"); // Xbox gamepad A button await kodi.input.buttonEvent("play", "R1"); // Standard remote play // Listen for input requests (e.g., when Kodi needs text input) kodi.input.onInputRequested.addListener((request) => { console.log("Input requested:", request.type, "Default:", request.value); // Types: "keyboard", "time", "date", "ip", "password", "number", "seconds" }); ``` ``` -------------------------------- ### Aggregate URLs from Context Menu Click Source: https://context7.com/regseb/castkodi/llms.txt Collects and returns an array of URLs from various sources (selection, link, media, page) provided in the context menu click information. ```javascript // Aggregate URLs from context menu click info const urls = await menu.aggregate({ selectionText: "https://youtube.com/watch?v=abc", linkUrl: "https://example.com/video.mp4", srcUrl: "https://example.com/embedded.mp4", mediaType: "video", pageUrl: "https://example.com/page" }); // Returns array of URLs from selection, link, media, and page ``` -------------------------------- ### Application Control API Source: https://context7.com/regseb/castkodi/llms.txt Control Kodi application properties such as volume and mute state, with support for change notifications. ```APIDOC ## Application Control API ### Description Controls Kodi application properties like volume and mute state, with support for change notifications. ### Methods - **getProperties(properties: Array): Promise** Retrieves specified application properties. - **setVolume(volume: number | "increment" | "decrement"): Promise** Sets the application volume to a specific level (0-100) or adjusts it by increment/decrement. Returns the new volume level. - **setMute(mute?: boolean): Promise** Toggles or sets the mute state. Returns the new mute state. ### Events - **onPropertyChanged(data: ApplicationProperties): void** Fired when application properties (like volume or muted state) change. ### Example Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Get application properties const props = await kodi.application.getProperties(["volume", "muted"]); console.log(props); // { volume: 75, muted: false } // Set volume (0-100) and unmute const newVolume = await kodi.application.setVolume(80); console.log(newVolume); // 80 // Increment/decrement volume await kodi.application.setVolume("increment"); // +1 await kodi.application.setVolume("decrement"); // -1 // Toggle mute const isMuted = await kodi.application.setMute(); console.log(isMuted); // true or false // Listen for volume changes kodi.application.onPropertyChanged.addListener((data) => { console.log("Volume:", data.volume, "Muted:", data.muted); }); ``` ``` -------------------------------- ### Control Kodi System Power Source: https://context7.com/regseb/castkodi/llms.txt Retrieve system properties related to power management and perform power operations like shutdown, reboot, suspend, and hibernate. Use power management functions with caution. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Get system properties const props = await kodi.system.getProperties([ "canshutdown", "canreboot", "cansuspend", "canhibernate" ]); console.log(props); // { canshutdown: true, canreboot: true, cansuspend: true, canhibernate: false } // Power management (use with caution) await kodi.system.shutdown(); // Power off the system await kodi.system.reboot(); // Restart the system await kodi.system.suspend(); // Suspend (sleep) await kodi.system.hibernate(); // Hibernate ``` -------------------------------- ### Navigate Kodi UI and Input Text Source: https://context7.com/regseb/castkodi/llms.txt Control Kodi's user interface with navigation commands, send text input, and simulate button events. Listen for input request notifications. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Navigation await kodi.input.home(); // Go to home screen await kodi.input.back(); // Go back await kodi.input.select(); // Select current item await kodi.input.contextMenu(); // Show context menu await kodi.input.info(); // Show info dialog // Show player on-screen display await kodi.input.showOSD(); // Show player process info (codec, resolution, etc.) await kodi.input.showPlayerProcessInfo(); // Send text input await kodi.input.sendText("search query", true); // true = close input dialog // Send button event (keyboard, Xbox gamepad, remote) await kodi.input.buttonEvent("left", "KB"); // Keyboard left arrow await kodi.input.buttonEvent("A", "XG"); // Xbox gamepad A button await kodi.input.buttonEvent("play", "R1"); // Standard remote play // Listen for input requests (e.g., when Kodi needs text input) kodi.input.onInputRequested.addListener((request) => { console.log("Input requested:", request.type, "Default:", request.value); // Types: "keyboard", "time", "date", "ip", "password", "number", "seconds" }); ``` -------------------------------- ### Manage Kodi Playlist Items Source: https://context7.com/regseb/castkodi/llms.txt Add, insert, retrieve, remove, swap, move, and clear items in the Kodi video playlist. Listen for playlist modification events. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Add media to end of playlist await kodi.playlist.add("https://example.com/video.mp4"); await kodi.playlist.add("plugin://plugin.video.youtube/play/?video_id=abc123"); // Insert media at specific position await kodi.playlist.insert("https://example.com/video2.mp4", 1); // Get all playlist items const items = await kodi.playlist.getItems(); console.log(items); // [ // { file: "https://...", label: "Video 1", title: "Video 1", type: "video", position: 0 }, // { file: "https://...", label: "Video 2", title: "Video 2", type: "video", position: 1 } // ] // Get specific item by position const item = await kodi.playlist.getItem(0); console.log(item); // { file: "...", label: "...", title: "...", type: "video", position: 0 } // Remove item at position await kodi.playlist.remove(1); // Swap two items await kodi.playlist.swap(0, 2); // Move item from position 3 to position 1 await kodi.playlist.move(3, 1); // Clear entire playlist await kodi.playlist.clear(); // Listen for playlist changes kodi.playlist.onAdd.addListener((item) => { console.log("Added to playlist:", item.title, "at position", item.position); }); kodi.playlist.onRemove.addListener((position) => { console.log("Removed item at position:", position); }); kodi.playlist.onClear.addListener(() => { console.log("Playlist cleared"); }); ``` -------------------------------- ### Player Control API Source: https://context7.com/regseb/castkodi/llms.txt Provides methods for controlling media playback in Kodi, including play, pause, seek, stop, navigation through the playlist, and managing playback properties like repeat and shuffle. It also supports event listeners for playback state changes. ```APIDOC ## Player Control API ### Description The Player class provides methods for controlling media playback including play/pause, seek, stop, and navigation. It also supports event listeners for property changes. ### Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Start playback from playlist position 0 await kodi.player.open(0); // Play/Pause toggle - returns current speed (0 = paused, 1 = playing) const speed = await kodi.player.playPause(); console.log(speed); // 1 (playing) or 0 (paused) // Seek to specific position in seconds const newPosition = await kodi.player.seek(120); // Seek to 2:00 console.log(newPosition); // 120 // Navigate playlist await kodi.player.goTo("next"); // Next item await kodi.player.goTo("previous"); // Previous item // Stop playback await kodi.player.stop(); // Get playback properties const props = await kodi.player.getProperties([ "active", "position", "time", "totaltime", "speed", "repeat", "shuffled" ]); console.log(props); // { active: true, position: 0, time: 65, totaltime: 240, speed: 1, repeat: "off", shuffled: false } // Toggle repeat mode (cycles: off -> one -> all -> off) await kodi.player.setRepeat(); // Toggle shuffle await kodi.player.setShuffle(); // Change playback speed await kodi.player.setSpeed("increment"); // Speed up await kodi.player.setSpeed("decrement"); // Slow down // Add subtitles to current playback await kodi.player.addSubtitle("https://example.com/subtitles.srt"); // Listen for playback state changes kodi.player.onPropertyChanged.addListener((properties) => { if ("speed" in properties) { console.log("Playback speed changed:", properties.speed); } if ("time" in properties) { console.log("Position changed:", properties.time, "seconds"); } }); ``` ``` -------------------------------- ### Cast Media to Kodi Source: https://context7.com/regseb/castkodi/llms.txt Utilizes the primary `cast` function to send media URLs to Kodi for playback. Supports different actions like 'send', 'insert', and 'add' to manage the playback queue. The `mux` function helps in validating and selecting the first suitable URL from a list. ```javascript import { cast, mux } from "./core/index.js"; // Cast a YouTube video - plays immediately await cast("send", ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]); // Insert a video to play next in the queue await cast("insert", ["https://vimeo.com/123456789"]); // Add a video to the end of the playlist await cast("add", ["https://soundcloud.com/artist/track"]); // The mux function validates and selects the first valid URL const url = mux([ "invalid-url", "https://www.youtube.com/watch?v=abc123", "magnet:?xt=urn:btih:" ]); console.log(url); // "https://www.youtube.com/watch?v=abc123" // Supported URL schemes const validUrls = mux([ "https://example.com/video.mp4", // HTTP/HTTPS "magnet:?xt=urn:btih:abc123", // Magnet links "acestream://abc123def456", // Ace Stream "plugin://plugin.video.youtube/..." // Kodi plugin URLs ]); ``` -------------------------------- ### Update Context Menus Source: https://context7.com/regseb/castkodi/llms.txt Synchronizes browser context menus based on user-defined configurations. This function should be called to ensure menus are up-to-date. ```javascript import * as menu from "./core/menu.js"; // Update context menus based on user configuration await menu.update(); ``` -------------------------------- ### Handle Context Menu Click Event Source: https://context7.com/regseb/castkodi/llms.txt Processes a context menu click event, performing actions based on the 'menuItemId' (e.g., 'send', 'insert', 'add') and associated URLs. ```javascript // Handle context menu click await menu.click({ menuItemId: "send", // "send", "insert", or "add" linkUrl: "https://www.youtube.com/watch?v=abc123", pageUrl: "https://example.com" }); ``` -------------------------------- ### Casting Media to Kodi Source: https://context7.com/regseb/castkodi/llms.txt The primary API for sending media to Kodi. It supports different actions like sending, inserting, or adding media to the playlist, and can process various URL types including direct media links and torrents. ```APIDOC ## Casting Media to Kodi ### Description The cast function is the primary API for sending media to Kodi. It accepts an action ("send", "insert", or "add") and an array of URLs, extracts the media file using scrapers, and queues it to Kodi's playlist. ### Usage ```javascript import { cast, mux } from "./core/index.js"; // Cast a YouTube video - plays immediately await cast("send", ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"]); // Insert a video to play next in the queue await cast("insert", ["https://vimeo.com/123456789"]); // Add a video to the end of the playlist await cast("add", ["https://soundcloud.com/artist/track"]); // The mux function validates and selects the first valid URL const url = mux([ "invalid-url", "https://www.youtube.com/watch?v=abc123", "magnet:?xt=urn:btih:..." ]); console.log(url); // "https://www.youtube.com/watch?v=abc123" // Supported URL schemes const validUrls = mux([ "https://example.com/video.mp4", // HTTP/HTTPS "magnet:?xt=urn:btih:abc123", // Magnet links "acestream://abc123def456", // Ace Stream "plugin://plugin.video.youtube/..." // Kodi plugin URLs ]); ``` ``` -------------------------------- ### Generate SendToKodi Fallback URL Source: https://context7.com/regseb/castkodi/llms.txt Generates a Kodi plugin URL using the SendToKodi addon for unsupported media URLs. This serves as a fallback mechanism. ```javascript import * as sendToKodiPlugin from "./core/plugin/sendtokodi.js"; // SendToKodi fallback for unsupported URLs const sendToKodiUrl = sendToKodiPlugin.generateUrl( new URL("https://example.com/video.mp4") ); // "plugin://plugin.video.sendtokodi/?url=https%3A%2F%2Fexample.com%2Fvideo.mp4" ``` -------------------------------- ### Control Media Playback with Player API Source: https://context7.com/regseb/castkodi/llms.txt Provides methods to control media playback on Kodi, including play, pause, seek, navigation through the playlist, and stopping playback. It also allows retrieving playback properties and listening for state changes. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Start playback from playlist position 0 await kodi.player.open(0); // Play/Pause toggle - returns current speed (0 = paused, 1 = playing) const speed = await kodi.player.playPause(); console.log(speed); // 1 (playing) or 0 (paused) // Seek to specific position in seconds const newPosition = await kodi.player.seek(120); // Seek to 2:00 console.log(newPosition); // 120 // Navigate playlist await kodi.player.goTo("next"); // Next item await kodi.player.goTo("previous"); // Previous item // Stop playback await kodi.player.stop(); // Get playback properties const props = await kodi.player.getProperties([ "active", "position", "time", "totaltime", "speed", "repeat", "shuffled" ]); console.log(props); // { active: true, position: 0, time: 65, totaltime: 240, speed: 1, repeat: "off", shuffled: false } // Toggle repeat mode (cycles: off -> one -> all -> off) await kodi.player.setRepeat(); // Toggle shuffle await kodi.player.setShuffle(); // Change playback speed await kodi.player.setSpeed("increment"); // Speed up await kodi.player.setSpeed("decrement"); // Slow down // Add subtitles to current playback await kodi.player.addSubtitle("https://example.com/subtitles.srt"); // Listen for playback state changes kodi.player.onPropertyChanged.addListener((properties) => { if ("speed" in properties) { console.log("Playback speed changed:", properties.speed); } if ("time" in properties) { console.log("Position changed:", properties.time, "seconds"); } }); ``` -------------------------------- ### Playlist Management API Source: https://context7.com/regseb/castkodi/llms.txt Manage Kodi's video playlist, including adding, inserting, removing, clearing, and reordering items, with support for event notifications. ```APIDOC ## Playlist Management API ### Description Manages Kodi's video playlist, supporting add, insert, remove, clear, and reorder operations with event notifications. ### Methods - **add(path: string, position?: number): Promise** Adds media to the playlist. If position is specified, inserts at that position. - **getItems(): Promise>** Retrieves all items currently in the playlist. - **getItem(position: number): Promise** Retrieves a specific playlist item by its position. - **remove(position: number): Promise** Removes an item from the playlist at the specified position. - **swap(position1: number, position2: number): Promise** Swaps two items in the playlist. - **move(fromPosition: number, toPosition: number): Promise** Moves an item from one position to another. - **clear(): Promise** Removes all items from the playlist. ### Events - **onAdd(item: PlaylistItem): void** Fired when an item is added to the playlist. - **onRemove(position: number): void** Fired when an item is removed from the playlist. - **onClear(): void** Fired when the playlist is cleared. ### Example Usage ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Add media to end of playlist await kodi.playlist.add("https://example.com/video.mp4"); await kodi.playlist.add("plugin://plugin.video.youtube/play/?video_id=abc123"); // Insert media at specific position await kodi.playlist.insert("https://example.com/video2.mp4", 1); // Get all playlist items const items = await kodi.playlist.getItems(); console.log(items); // Get specific item by position const item = await kodi.playlist.getItem(0); console.log(item); // Remove item at position await kodi.playlist.remove(1); // Swap two items await kodi.playlist.swap(0, 2); // Move item from position 3 to position 1 await kodi.playlist.move(3, 1); // Clear entire playlist await kodi.playlist.clear(); // Listen for playlist changes kodi.playlist.onAdd.addListener((item) => { console.log("Added to playlist:", item.title, "at position", item.position); }); kodi.playlist.onRemove.addListener((position) => { console.log("Removed item at position:", position); }); kodi.playlist.onClear.addListener(() => { console.log("Playlist cleared"); }); ``` ``` -------------------------------- ### Generate YouTube Playlist URL Source: https://context7.com/regseb/castkodi/llms.txt Generates a Kodi plugin URL for playing a YouTube playlist. Requires playlist ID and options for playback and incognito mode. ```javascript import * as youTubePlugin from "./core/plugin/youtube.js"; const playlistUrl = await youTubePlugin.generatePlaylistUrl("PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf", false); console.log(playlistUrl); // "plugin://plugin.video.youtube/play/?playlist_id=PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf&order=default&play=1&incognito=false" ``` -------------------------------- ### Generate YouTube Video URL Source: https://context7.com/regseb/castkodi/llms.txt Generates a Kodi plugin URL for playing a YouTube video. Specify the video ID and whether to use incognito mode. ```javascript import * as youTubePlugin from "./core/plugin/youtube.js"; // YouTube plugin URLs const videoUrl = youTubePlugin.generateVideoUrl("dQw4w9WgXcQ", false); console.log(videoUrl); // "plugin://plugin.video.youtube/play/?video_id=dQw4w9WgXcQ&incognito=false" ``` -------------------------------- ### Generate YouTube Clip URL Source: https://context7.com/regseb/castkodi/llms.txt Generates a Kodi plugin URL for a YouTube clip. Requires the clip URI and incognito mode setting. ```javascript import * as youTubePlugin from "./core/plugin/youtube.js"; const clipUrl = youTubePlugin.generateClipUrl("UgkxGPmZ5iFFxzr6a", false); console.log(clipUrl); // "plugin://plugin.video.youtube/uri2addon/?uri=https%3A%2F%2Fwww.youtube.com%2Fclip%2FUgkxGPmZ5iFFxzr6a&incognito=false" ``` -------------------------------- ### Toggle Kodi Fullscreen Mode Source: https://context7.com/regseb/castkodi/llms.txt Control the fullscreen display mode of the Kodi GUI. The function returns the new fullscreen state after toggling. ```javascript import { kodi } from "./core/jsonrpc/kodi.js"; // Toggle fullscreen mode - returns new state const isFullscreen = await kodi.gui.setFullscreen(); console.log(isFullscreen); // true or false ``` -------------------------------- ### Extract Media URL from Direct Link Source: https://context7.com/regseb/castkodi/llms.txt Handles direct links to media files (e.g., .mp4). The function returns the URL itself if it's a direct media link. ```javascript // Extract from direct media link const directFile = await extract( new URL("https://example.com/video.mp4"), { depth: false, incognito: false } ); console.log(directFile); // "https://example.com/video.mp4" ``` -------------------------------- ### Extract Media URL from YouTube Source: https://context7.com/regseb/castkodi/llms.txt Extracts a playable media URL from a YouTube video page. Options like 'depth' and 'incognito' can be configured. ```javascript import { extract } from "./core/scrapers.js"; // Extract media URL from a YouTube page const youtubeFile = await extract( new URL("https://www.youtube.com/watch?v=dQw4w9WgXcQ"), { depth: false, incognito: false } ); console.log(youtubeFile); ``` -------------------------------- ### Extract Media URL from Twitch Source: https://context7.com/regseb/castkodi/llms.txt Extracts a playable media URL from a Twitch channel page. This typically returns a plugin URL for the Twitch addon. ```javascript // Extract from Twitch const twitchFile = await extract( new URL("https://www.twitch.tv/twitchgaming"), { depth: false, incognito: false } ); ``` -------------------------------- ### Extract Media URL from Embedded Video Source: https://context7.com/regseb/castkodi/llms.txt Extracts media URLs from pages containing embedded videos, utilizing generic scrapers for platforms like YouTube or Vimeo. ```javascript // Extract from page with embedded video (uses generic scrapers) const embeddedFile = await extract( new URL("https://blog.example.com/post-with-video"), { depth: false, incognito: false } ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.