src.themerr.player#

class src.themerr.player.Player[source]#

Bases: Player

Kodi’s player class.

Creates a new player to control playback.

Examples

>>> player = Player()
Attributes:
loglogging.Logger

The logger for this class.

theme_is_playingbool

True if a theme is currently playing, False otherwise.

theme_is_playing_forint

The number of seconds the theme has been playing for.

theme_playing_kodi_idOptional[str]

The Kodi ID of the theme currently playing.

theme_playing_urlOptional[str]

The URL of the theme currently playing.

Methods

ytdl_extract_url(url: str) -> Optional[str]

Extract the audio URL from a YouTube URL.

play_url(url: str, kodi_id: str, windowed: bool = False)

Play a YouTube URL.

stop()

Stop playback.

reset()

Reset the player.

play_url(url: str, kodi_id: str, windowed: bool = False)[source]#

Play a YouTube URL.

Given a user facing YouTube URL, extract the audio URL and play it.

Parameters:
urlstr

The url to play.

kodi_idstr

The Kodi ID of the item.

windowedbool

True to play in a window, False otherwise.

Examples

>>> player = Player()
>>> player.play_url(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ", kodi_id='tmdb_1')
reset()[source]#

Reset the player.

Reset class variables to their default values.

Examples

>>> player = Player()
>>> player.reset()
stop()[source]#

Stop playback.

This function will stop playback and reset the player.

Examples

>>> player = Player()
>>> player.stop()