()
Initializes this module by checking which platforms are available to use.
Initializes this module by checking which platforms are available to use.
Initializes this module by checking which platforms are available to use .
def start() -> None:
    """Initializes this module by checking which platforms are available to use."""

    # local songs are enabled if a library is set
    local_enabled = os.path.islink(library.get_library_path())
    storage.set("local_enabled", local_enabled)

    # in the docker container all dependencies are installed
    youtube_available = conf.DOCKER or importlib.util.find_spec("yt_dlp") is not None
    redis.set("youtube_available", youtube_available)
    if not youtube_available:
        # if youtube is not available, overwrite the database to disable it
        storage.set("youtube_enabled", False)

    # Spotify has no python dependencies we could easily check.
    try:
        spotify_available = (
            conf.DOCKER
            or "[spotify]"
            in subprocess.check_output(["mopidy", "config"], stderr=subprocess.DEVNULL)
            .decode()
            .splitlines()
        )
    except FileNotFoundError:
        # mopidy is not installed (eg in docker). Since we can't check, enable
        spotify_available = True
    redis.set("spotify_available", spotify_available)
    if not spotify_available:
        storage.set("spotify_enabled", False)

    soundcloud_available = (
        conf.DOCKER or importlib.util.find_spec("soundcloud") is not None
    )
    redis.set("soundcloud_available", soundcloud_available)
    if not soundcloud_available:
        storage.set("soundcloud_enabled", False)

    # Jamendo has no python dependencies we could easily check.
    try:
        jamendo_available = (
            conf.DOCKER
            or "[jamendo]"
            in subprocess.check_output(["mopidy", "config"], stderr=subprocess.DEVNULL)
            .decode()
            .splitlines()
        )
    except FileNotFoundError:
        jamendo_available = True
    redis.set("jamendo_available", jamendo_available)
    if not jamendo_available:
        storage.set("jamendo_enabled", False)
def start ( ) -> None : # local songs are enabled if a library is set local_enabled = os . path . islink ( library . get_library_path ( ) ) storage . set ( "local_enabled" , local_enabled ) # in the docker container all dependencies are installed youtube_available = conf . DOCKER or importlib . util . find_spec ( "yt_dlp" ) is not None redis . set ( "youtube_available" , youtube_available ) if not youtube_available : # if youtube is not available, overwrite the database to disable it storage . set ( "youtube_enabled" , False ) # Spotify has no python dependencies we could easily check. try : spotify_available = ( conf . DOCKER or "[spotify]" in subprocess . check_output ( [ "mopidy" , "config" ] , stderr = subprocess . DEVNULL ) . decode ( ) . splitlines ( ) ) except FileNotFoundError : # mopidy is not installed (eg in docker). Since we can't check, enable spotify_available = True redis . set ( "spotify_available" , spotify_available ) if not spotify_available : storage . set ( "spotify_enabled" , False ) soundcloud_available = ( conf . DOCKER or importlib . util . find_spec ( "soundcloud" ) is not None ) redis . set ( "soundcloud_available" , soundcloud_available ) if not soundcloud_available : storage . set ( "soundcloud_enabled" , False ) # Jamendo has no python dependencies we could easily check. try : jamendo_available = ( conf . DOCKER or "[jamendo]" in subprocess . check_output ( [ "mopidy" , "config" ] , stderr = subprocess . DEVNULL ) . decode ( ) . splitlines ( ) ) except FileNotFoundError : jamendo_available = True redis . set ( "jamendo_available" , jamendo_available ) if not jamendo_available : storage . set ( "jamendo_enabled" , False )