pylav.extension.radio package#
Submodules#
pylav.extension.radio.base_url module#
- exception pylav.extension.radio.base_url.Error(message=None, *args)[source]#
Bases:
PyLavException
Base class for all exceptions raised by this module
- exception pylav.extension.radio.base_url.RDNSLookupError(ip)[source]#
Bases:
Error
Raised when there was a problem with performing reverse dns lookup for ip.
- ip#
- port#
pylav.extension.radio.objects module#
- class pylav.extension.radio.objects.Codec(*, name=None, stationcount=None)[source]#
Bases:
object
A codec from the RadioBrowser API.
- name#
- stationcount#
- class pylav.extension.radio.objects.Country(*, name=None, iso_3166_1=None, stationcount=None)[source]#
Bases:
object
A country from the RadioBrowser API.
- iso_3166_1#
- name#
- stationcount#
- class pylav.extension.radio.objects.CountryCode(*, name=None, stationcount=None)[source]#
Bases:
object
A country code from the RadioBrowser API.
- name#
- stationcount#
- class pylav.extension.radio.objects.Language(*, name=None, iso_639=None, stationcount=None)[source]#
Bases:
object
A language from the RadioBrowser API.
- iso_639#
- name#
- stationcount#
- class pylav.extension.radio.objects.State(*, name=None, country=None, stationcount=None)[source]#
Bases:
object
A state from the RadioBrowser API.
- country#
- name#
- stationcount#
- class pylav.extension.radio.objects.Station(*, radio_api_client, changeuuid=None, stationuuid=None, serveruuid=None, name=None, url=None, url_resolved=None, homepage=None, favicon=None, tags=None, country=None, countrycode=None, iso_3166_2=None, state=None, language=None, languagecodes=None, votes=None, lastchangetime=None, lastchangetime_iso8601=None, codec=None, bitrate=None, hls=None, lastcheckok=None, lastchecktime=None, lastchecktime_iso8601=None, lastcheckoktime=None, lastcheckoktime_iso8601=None, lastlocalchecktime=None, lastlocalchecktime_iso8601=None, clicktimestamp=None, clicktimestamp_iso8601=None, clickcount=None, clicktrend=None, ssl_error=None, geo_lat=None, geo_long=None, has_extended_info=None)[source]#
Bases:
object
A station from the RadioBrowser API.
- bitrate#
- changeuuid#
- async click()[source]#
Increase the click count of a station by one.
This should be called everytime when a user starts playing a stream to mark the stream more popular than others. Every call to this endpoint from the same IP address and for the same station only gets counted once per day.
- clickcount#
- clicktimestamp#
- clicktimestamp_iso8601#
- clicktrend#
- codec#
- country#
- countrycode#
- favicon#
- geo_lat#
- geo_long#
- has_extended_info#
- hls#
- homepage#
- iso_3166_2#
- language#
- languagecodes#
- lastchangetime#
- lastchangetime_iso8601#
- lastcheckok#
- lastcheckoktime#
- lastcheckoktime_iso8601#
- lastchecktime#
- lastchecktime_iso8601#
- lastlocalchecktime#
- lastlocalchecktime_iso8601#
- name#
- radio_api_client#
- serveruuid#
- ssl_error#
- state#
- stationuuid#
- tags#
- url#
- url_resolved#
- votes#
pylav.extension.radio.radios module#
- class pylav.extension.radio.radios.RadioBrowser(client)[source]#
Bases:
object
This class implements the main interface for the Radio Browser API.
- property base_url#
The base URL for the Radio Browser API.
- async click(station=None, station_id=None)[source]#
Increase the click count of a station by one.
This should be called everytime when a user starts playing a stream to mark the stream more popular than others. Every call to this endpoint from the same IP address and for the same station only gets counted once per day.
- Parameters:
station (
Station, optional
) – The station to click.station_id (
str, optional
) – The station uuid to click.
- async click_counter(stationuuid)[source]#
Increase the click count of a station by one.
This should be called everytime when a user starts playing a stream to mark the stream more popular than others. Every call to this endpoint from the same IP address and for the same station only gets counted once per day. The call will return detailed information about the stat stream, supported output formats: JSON
- Parameters:
stationuuid (
str
) – A globally unique identifier for the station.- Returns:
A dict containing informations about the radio station.
- Return type:
- codecs(codec=None)[source]#
Lists all codecs.
- Parameters:
codec (
str, optional
) – Filter by codec. Defaults to None.- Returns:
Codecs.
- Return type:
- countries(code=None)[source]#
Lists all countries.
- Parameters:
code (
str, optional
) – Filter by country code. Defaults to None.- Returns:
Countries.
- Return type:
- countrycodes(code=None)[source]#
Lists all countries.
- Parameters:
code (
str, optional
) – Filter by country code. Defaults to None.- Returns:
Countries.
- Return type:
- property disabled#
Whether the extension is disabled.
- languages(language=None)[source]#
Lists all languages.
- Parameters:
language (
str, optional
) – Filter by language. Defaults to None.- Returns:
Languages.
- Return type:
- search(**kwargs)[source]#
Advanced search.
It will search for the station whose attribute contains the search term.
Arguments:#
name (str, optional): Name of the station. name_exact (bool, optional): Only exact matches, otherwise all
matches (default: False).
country (str, optional): Country of the station. country_exact (bool, optional): Only exact matches, otherwise
all matches (default: False).
- countrycode (str, optional): 2-digit countrycode of the station
(see ISO 3166-1 alpha-2)
state (str, optional): State of the station. state_exact (bool, optional): Only exact matches, otherwise all
matches. (default: False)
language (str, optional): Language of the station. language_exact (bool, optional): Only exact matches, otherwise
all matches. (default: False)
tag (str, optional): Tag of the station. tag_exact (bool, optional): Only exact matches, otherwise all
matches. (default: False)
tag_list (str, optional): A comma-separated list of tag. bitrate_min (int, optional): Minimum of kbps for bitrate field of
stations in result. (default: 0)
- bitrate_max (int, optional): Maximum of kbps for bitrate field of
stations in result. (default: 1000000)
- order (str, optional): The result list will be sorted by: name,
url, homepage, favicon, tags, country, state, language, votes, codec, bitrate, lastcheckok, lastchecktime, clicktimestamp, clickcount, clicktrend, random
- reverse (bool, optional): Reverse the result list if set to true.
(default: false)
- offset (int, optional): Starting value of the result list from
the database. For example, if you want to do paging on the server side. (default: 0)
- limit (int, optional): Number of returned datarows (stations)
starting with offset (default 100000)
- hidebroken (bool, optional): do list/not list broken stations.
Note: Not documented in the “Advanced Station Search”.
- returns:
Station.
- rtype:
list
- states(country=None, state=None)[source]#
Lists all states.
- Parameters:
country (
str, optional
) – Filter by country. Defaults to None.state (
str, optionla
) – Filter by state. Defaults to None.
- Returns:
States.
- Return type:
- async station_by_uuid(stationuuid)[source]#
Radio station by stationuuid.
- Parameters:
stationuuid (
str
) – A globally unique identifier for the station.- Returns:
Stations.
- Return type:
- async stations_by_clicks(limit, **kwargs)[source]#
A list of the stations that are clicked the most.
- Parameters:
limit – Number of wanted stations
- Returns:
Stations.
- Return type:
- async stations_by_codec(codec, exact=False, **kwargs)[source]#
Lists all radio stations by codec.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_country(country, exact=False, **kwargs)[source]#
Lists all radio stations by country.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_countrycode(code, **kwargs)[source]#
Lists all radio stations by country code.
Arguments:#
code (str): Official countrycodes as in ISO 3166-1 alpha-2. exact (bool): if the search should search for a station with the exact code
- returns:
Stations.
- rtype:
list
- async stations_by_language(language, exact=False, **kwargs)[source]#
Lists all radio stations by language.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_name(name, exact=False, **kwargs)[source]#
Lists all radio stations by name.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_state(state, exact=False, **kwargs)[source]#
Lists all radio stations by state.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_tag(tag, exact=False, **kwargs)[source]#
Lists all radio stations by tag.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_tag_list(tag_list, **kwargs)[source]#
Lists all radio stations by tag. Must match all tags exactly.
- async stations_by_votes(limit, **kwargs)[source]#
A list of the highest-voted stations.
- Parameters:
limit – Number of wanted stations
- Returns:
Stations.
- Return type:
pylav.extension.radio.utils module#
- exception pylav.extension.radio.utils.Error[source]#
Bases:
Exception
Base class for all exceptions raised by this module
- exception pylav.extension.radio.utils.IllegalArgumentError[source]#
Bases:
Error
Raised for illegal argument
- class pylav.extension.radio.utils.TransformerCache[source]#
Bases:
object
A class to cache the data from the RadioBrowser API.
- pylav.extension.radio.utils.radio_browser_adapter(**kwargs)[source]#
Converts the keyword arguments to the format required by the RadioBrowser API.
- pylav.extension.radio.utils.snake_to_camel(string)[source]#
Convert a snake case string to camel case.
Module contents#
- class pylav.extension.radio.RadioBrowser(client)[source]#
Bases:
object
This class implements the main interface for the Radio Browser API.
- property base_url#
The base URL for the Radio Browser API.
- async click(station=None, station_id=None)[source]#
Increase the click count of a station by one.
This should be called everytime when a user starts playing a stream to mark the stream more popular than others. Every call to this endpoint from the same IP address and for the same station only gets counted once per day.
- Parameters:
station (
Station, optional
) – The station to click.station_id (
str, optional
) – The station uuid to click.
- async click_counter(stationuuid)[source]#
Increase the click count of a station by one.
This should be called everytime when a user starts playing a stream to mark the stream more popular than others. Every call to this endpoint from the same IP address and for the same station only gets counted once per day. The call will return detailed information about the stat stream, supported output formats: JSON
- Parameters:
stationuuid (
str
) – A globally unique identifier for the station.- Returns:
A dict containing informations about the radio station.
- Return type:
- codecs(codec=None)[source]#
Lists all codecs.
- Parameters:
codec (
str, optional
) – Filter by codec. Defaults to None.- Returns:
Codecs.
- Return type:
- countries(code=None)[source]#
Lists all countries.
- Parameters:
code (
str, optional
) – Filter by country code. Defaults to None.- Returns:
Countries.
- Return type:
- countrycodes(code=None)[source]#
Lists all countries.
- Parameters:
code (
str, optional
) – Filter by country code. Defaults to None.- Returns:
Countries.
- Return type:
- property disabled#
Whether the extension is disabled.
- languages(language=None)[source]#
Lists all languages.
- Parameters:
language (
str, optional
) – Filter by language. Defaults to None.- Returns:
Languages.
- Return type:
- search(**kwargs)[source]#
Advanced search.
It will search for the station whose attribute contains the search term.
Arguments:#
name (str, optional): Name of the station. name_exact (bool, optional): Only exact matches, otherwise all
matches (default: False).
country (str, optional): Country of the station. country_exact (bool, optional): Only exact matches, otherwise
all matches (default: False).
- countrycode (str, optional): 2-digit countrycode of the station
(see ISO 3166-1 alpha-2)
state (str, optional): State of the station. state_exact (bool, optional): Only exact matches, otherwise all
matches. (default: False)
language (str, optional): Language of the station. language_exact (bool, optional): Only exact matches, otherwise
all matches. (default: False)
tag (str, optional): Tag of the station. tag_exact (bool, optional): Only exact matches, otherwise all
matches. (default: False)
tag_list (str, optional): A comma-separated list of tag. bitrate_min (int, optional): Minimum of kbps for bitrate field of
stations in result. (default: 0)
- bitrate_max (int, optional): Maximum of kbps for bitrate field of
stations in result. (default: 1000000)
- order (str, optional): The result list will be sorted by: name,
url, homepage, favicon, tags, country, state, language, votes, codec, bitrate, lastcheckok, lastchecktime, clicktimestamp, clickcount, clicktrend, random
- reverse (bool, optional): Reverse the result list if set to true.
(default: false)
- offset (int, optional): Starting value of the result list from
the database. For example, if you want to do paging on the server side. (default: 0)
- limit (int, optional): Number of returned datarows (stations)
starting with offset (default 100000)
- hidebroken (bool, optional): do list/not list broken stations.
Note: Not documented in the “Advanced Station Search”.
- returns:
Station.
- rtype:
list
- states(country=None, state=None)[source]#
Lists all states.
- Parameters:
country (
str, optional
) – Filter by country. Defaults to None.state (
str, optionla
) – Filter by state. Defaults to None.
- Returns:
States.
- Return type:
- async station_by_uuid(stationuuid)[source]#
Radio station by stationuuid.
- Parameters:
stationuuid (
str
) – A globally unique identifier for the station.- Returns:
Stations.
- Return type:
- async stations_by_clicks(limit, **kwargs)[source]#
A list of the stations that are clicked the most.
- Parameters:
limit – Number of wanted stations
- Returns:
Stations.
- Return type:
- async stations_by_codec(codec, exact=False, **kwargs)[source]#
Lists all radio stations by codec.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_country(country, exact=False, **kwargs)[source]#
Lists all radio stations by country.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_countrycode(code, **kwargs)[source]#
Lists all radio stations by country code.
Arguments:#
code (str): Official countrycodes as in ISO 3166-1 alpha-2. exact (bool): if the search should search for a station with the exact code
- returns:
Stations.
- rtype:
list
- async stations_by_language(language, exact=False, **kwargs)[source]#
Lists all radio stations by language.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_name(name, exact=False, **kwargs)[source]#
Lists all radio stations by name.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_state(state, exact=False, **kwargs)[source]#
Lists all radio stations by state.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_tag(tag, exact=False, **kwargs)[source]#
Lists all radio stations by tag.
- Parameters:
- Returns:
Stations.
- Return type:
- async stations_by_tag_list(tag_list, **kwargs)[source]#
Lists all radio stations by tag. Must match all tags exactly.
- async stations_by_votes(limit, **kwargs)[source]#
A list of the highest-voted stations.
- Parameters:
limit – Number of wanted stations
- Returns:
Stations.
- Return type: