Skip to content

Media Library Scanning

MediaLibraryScanning(api, subsonic)

Class that contains all the methods needed to interact with the media library scanning endpoints in the Subsonic API.

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

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

get_scan_status()

Get the status of the scanning of the library.

Returns:

Type Description
ScanStatus

An object that holds all the info about the current state of the scanning of the library.

Source code in .venv/lib/python3.11/site-packages/knuckles/_media_library_scanning.py
def get_scan_status(self) -> ScanStatus:
    """Get the status of the scanning of the library.

    Returns:
        An object that holds all the info about the
            current state of the scanning of the library.
    """

    response = self.api.json_request("getScanStatus")["scanStatus"]

    return ScanStatus(self.subsonic, **response)

start_scan()

Request to the server to start a scanning of the library.

Returns:

Type Description
ScanStatus

An object that holds all the info about the current state of the scanning of the library.

Source code in .venv/lib/python3.11/site-packages/knuckles/_media_library_scanning.py
def start_scan(self) -> ScanStatus:
    """Request to the server to start a scanning of the library.

    Returns:
        An object that holds all the info about the
            current state of the scanning of the library.
    """

    response = self.api.json_request("startScan")["scanStatus"]

    return ScanStatus(self.subsonic, **response)