Skip to content

Searching

Searching(api, subsonic)

Class that contains all the methods needed to interact with the bookmark endpoints in the Subsonic API.

Source code in .venv/lib/python3.11/site-packages/knuckles/_searching.py
def __init__(self, api: Api, subsonic: "Subsonic") -> None:
    self.api = api

    # Only to pass it to the models
    self.subsonic = subsonic

search(query='', song_count=None, song_offset=None, album_count=None, album_offset=None, artist_count=None, artist_offset=None, music_folder_id=None)

Search and find all the songs, albums and artists that whose title match the given query.

Parameters:

Name Type Description Default
query str

The query string to be send to the server.

''
song_count int | None

The numbers of songs that the server should return.

None
song_offset int | None

The number of songs to offset in the list, useful for pagination.

None
album_count int | None

The numbers of albums that the server should return.

None
album_offset int | None

The number of album to offset in the list, useful for pagination.

None
artist_count int | None

The numbers of artists that the server should return.

None
artist_offset int | None

The number of artists to offset in the list, useful for pagination.

None
music_folder_id str | None

An ID of a music folder to limit where the songs, albums and artists should come from.

None

Returns:

Type Description
SearchResult

An object that contains all the info about the found songs, albums and artists received with the given query.

Source code in .venv/lib/python3.11/site-packages/knuckles/_searching.py
def search(
    self,
    query: str = "",
    song_count: int | None = None,
    song_offset: int | None = None,
    album_count: int | None = None,
    album_offset: int | None = None,
    artist_count: int | None = None,
    artist_offset: int | None = None,
    music_folder_id: str | None = None,
) -> SearchResult:
    """Search and find all the songs, albums and artists that
    whose title match the given query.

    Args:
        query: The query string to be send to the server.
        song_count: The numbers of songs that the server
            should return.
        song_offset: The number of songs to offset in the list,
            useful for pagination.
        album_count: The numbers of albums that the server
            should return.
        album_offset: The number of album to offset in the list,
            useful for pagination.
        artist_count: The numbers of artists that the server
            should return.
        artist_offset: The number of artists to offset in the list,
            useful for pagination.
        music_folder_id: An ID of a music folder to limit where the
            songs, albums and artists should come from.

    Returns:
        An object that contains all the info about the found songs,
            albums and artists received with the given query.
    """

    return self._generic_search(
        query,
        song_count,
        song_offset,
        album_count,
        album_offset,
        artist_count,
        artist_offset,
    )

search_non_id3(query, song_count=None, song_offset=None, album_count=None, album_offset=None, artist_count=None, artist_offset=None, music_folder_id=None)

Search and find all the songs, albums and artists that whose title match the given query. Not organized according ID3 tags.

Parameters:

Name Type Description Default
query str

The query string to be send to the server.

required
song_count int | None

The numbers of songs that the server should return.

None
song_offset int | None

The number of songs to offset in the list, useful for pagination.

None
album_count int | None

The numbers of albums that the server should return.

None
album_offset int | None

The number of album to offset in the list, useful for pagination.

None
artist_count int | None

The numbers of artists that the server should return.

None
artist_offset int | None

The number of artists to offset in the list, useful for pagination.

None
music_folder_id str | None

An ID of a music folder to limit where the songs, albums and artists should come from.

None

Returns:

Type Description
SearchResult

An object that contains all the info about the found songs, albums and artists received with the given query.

Source code in .venv/lib/python3.11/site-packages/knuckles/_searching.py
def search_non_id3(
    self,
    query: str,
    song_count: int | None = None,
    song_offset: int | None = None,
    album_count: int | None = None,
    album_offset: int | None = None,
    artist_count: int | None = None,
    artist_offset: int | None = None,
    music_folder_id: str | None = None,
) -> SearchResult:
    """Search and find all the songs, albums and artists that
    whose title match the given query. Not organized according
    ID3 tags.

    Args:
        query: The query string to be send to the server.
        song_count: The numbers of songs that the server
            should return.
        song_offset: The number of songs to offset in the list,
            useful for pagination.
        album_count: The numbers of albums that the server
            should return.
        album_offset: The number of album to offset in the list,
            useful for pagination.
        artist_count: The numbers of artists that the server
            should return.
        artist_offset: The number of artists to offset in the list,
            useful for pagination.
        music_folder_id: An ID of a music folder to limit where the
            songs, albums and artists should come from.

    Returns:
        An object that contains all the info about the found songs,
            albums and artists received with the given query.
    """

    return self._generic_search(
        query,
        song_count,
        song_offset,
        album_count,
        album_offset,
        artist_count,
        artist_offset,
        music_folder_id,
        False,
    )