from apollo_utils.core.constants.dsp import DSP from apollo_utils.core.utils.ext_enum import ExtEnum CORE_IMAGE_SERVICE_RESOLUTION_PARAM = "resolution" CoreImageServiceImageSizeMapping = {64: "small", 300: "medium", 640: "large"} CORE_IMAGE_SERVICE_ALLOWED_RESOLUTIONS = list(CoreImageServiceImageSizeMapping.keys()) # DSP.value ["spotify", "apple", etc ] -> entity ["track", "playlist"] mappings that can cause troubles with # Core Image Service image_url (can be no image by created link) example explained in AG-10744 CORE_IMAGE_SERVICE_UNDESIRABLE_IMAGES_DSP_ENTITY_PAIRS = {DSP.APPLE.value: ["track"]} class Entity(ExtEnum): PLAYLISTS = "playlists" ALBUMS = "albums" class ByDspPlaylistId(ExtEnum): BY_APPLE_MUSIC_ID = "by_apple_music_id" BY_SPOTIFY_ID = "by_spotify_id" class ByDspTrackId(ExtEnum): BY_APPLE_TRACK_ID = "by_apple_track_id" BY_SPOTIFY_TRACK_ID = "by_spotify_track_id" CoreImageEntityMapping = {"track": Entity.ALBUMS.value, "playlist": Entity.PLAYLISTS.value} # TODO I use DSP.SPOTIFY.value, DSP.APPLE.value as a key in CoreImageByEntityMapping because: # from apollo_utils.core.constants.dsp import DSP # from server.constants import DSP as dsp # DSP.APPLE == dsp.APPLE # False # DSP.APPLE.value == dsp.APPLE.value # True # This can be removed and keys mapping fixed with DSP not DSP.value inside CoreImageByEntityMapping # and usage of CoreImageByEntityMapping inside get_core_image_service_image_url and tests # when ^^ problem with different DSP imports is solved CoreImageByEntityMapping = { "track": { DSP.SPOTIFY.value: ByDspTrackId.BY_SPOTIFY_TRACK_ID.value, DSP.APPLE.value: ByDspTrackId.BY_APPLE_TRACK_ID.value, }, "playlist": { DSP.SPOTIFY.value: ByDspPlaylistId.BY_SPOTIFY_ID.value, DSP.APPLE.value: ByDspPlaylistId.BY_APPLE_MUSIC_ID.value, }, } CORE_IMAGE_SERVICE_STOREFRONT_PARAM = "storefront" DSP_CORE_IMAGE_URL_COUNTRY_CODE_SENSITIVE = (DSP.APPLE.value,) CORE_IMAGE_URL_ENTITY_COUNTRY_CODE_SENSITIVE = Entity.PLAYLISTS.value CORE_IMAGE_AVAILABLE_DSP = (DSP.APPLE.value, DSP.SPOTIFY.value)