"""Utils and helpers related to store availability.""" from sound_recordings.constants import store def get_store_names(): """Return dict of stores with names and ids depending on FF. Returns: dict: The dictionary {storeid: store_name}. """ return store.ACTIVE_STORE_NAMES def get_download_store_names(): """Return dict of download stores with names and ids. Returns: dict: The dictionary {storeid: store_name}. """ return store.ACTIVE_DOWNLOAD_STORE_NAMES def get_store_ids(): """Return list of storeids depending on FF. Returns: list: The list with stores ids. """ return list(get_store_names().keys()) def get_download_store_ids(): """Return list of download storeids. Returns: list: The list with stores ids. """ return list(get_download_store_names().keys()) def get_sources(): """Return dict of stores with names and ids depending on FF. Returns: list: The list with stores ids. """ return store.ALL_SOURCES def get_download_sources(): """Return dict of stores with names and ids depending on FF. Returns: list: The list with stores ids. """ return store.ALL_DOWNLOAD_SOURCES def get_playlist_sources(): """Return dict of video streaming stores with names and ids. Returns: list: The list with stores ids. """ return store.ALL_PLAYLIST_SOURCES def get_playlist_store_ids(): """Return list of playlist storeids. Returns: list: The list with store ids. """ return list(get_playlist_store_names().keys()) def get_playlist_store_names(): """Return dict of playlist stores with names and ids. Returns: dict: The dictionary {storeid: store_name}. """ return store.ACTIVE_PLAYLIST_STORE_NAMES def get_demographic_store_ids(): """Return list of demographic ids. Returns: list: Integer the store ids """ return list(store.ACTIVE_DEMOGRAPHIC_STORE_NAMES.keys()) def get_demographic_sources(): """Return dict of stores with names and ids. Returns: list: The list with stores ids. """ return store.ALL_DEMOGRAPHIC_SOURCES def get_query_store_ids(store_ids): """Use query param ids to work out which store ids to use. If there are no param store ids use defaults. Returns: list: The list of useable store ids. """ if not store_ids: return get_store_ids() return sorted(list(set(store_ids).intersection(get_store_ids())))