(self, build_profile_id=None, remove_unused=False, multimedia_map=None)
Gets all the media objects stored in the multimedia map.
            If passed a profile, will only get those that are used
            in a language in the profile.

            Returns a generator of tuples, where the first item in the tuple is
            the path (jr://...) and the second is the object (CommCareMultimedia or a subclass)
Gets all the media objects stored in the multimedia map.
            If passed a profile, will only get those that are used
            in a language in the profile.
Gets all the media objects stored in the multimedia map . If passed a profile will only get those that are used in a language in the profile .
def get_media_objects(self, build_profile_id=None, remove_unused=False, multimedia_map=None):
        """
            Gets all the media objects stored in the multimedia map.
            If passed a profile, will only get those that are used
            in a language in the profile.

            Returns a generator of tuples, where the first item in the tuple is
            the path (jr://...) and the second is the object (CommCareMultimedia or a subclass)
        """
        found_missing_mm = False
        # preload all the docs to avoid excessive couch queries.
        # these will all be needed in memory anyway so this is ok.
        build_profile = self.build_profiles[build_profile_id] if build_profile_id else None
        if not multimedia_map:
            multimedia_map = self.multimedia_map_for_build(build_profile=build_profile,
                                                           remove_unused=remove_unused)
        expected_ids = [map_item.multimedia_id for map_item in multimedia_map.values()]
        raw_docs = dict((d["_id"], d) for d in iter_docs(CommCareMultimedia.get_db(), expected_ids))
        for path, map_item in multimedia_map.items():
            media_item = raw_docs.get(map_item.multimedia_id)
            if media_item:
                media_cls = CommCareMultimedia.get_doc_class(map_item.media_type)
                yield path, media_cls.wrap(media_item)
            else:
                # Re-attempt to fetch media directly from couch
                media = CommCareMultimedia.get_doc_class(map_item.media_type)
                try:
                    media = media.get(map_item.multimedia_id)
                    yield path, media
                except ResourceNotFound as e:
                    if toggles.CAUTIOUS_MULTIMEDIA.enabled(self.domain):
                        raise e
def get_media_objects ( self , build_profile_id = None , remove_unused = False , multimedia_map = None ) : found_missing_mm = False # preload all the docs to avoid excessive couch queries. # these will all be needed in memory anyway so this is ok. build_profile = self . build_profiles [ build_profile_id ] if build_profile_id else None if not multimedia_map : multimedia_map = self . multimedia_map_for_build ( build_profile = build_profile , remove_unused = remove_unused ) expected_ids = [ map_item . multimedia_id for map_item in multimedia_map . values ( ) ] raw_docs = dict ( ( d [ "_id" ] , d ) for d in iter_docs ( CommCareMultimedia . get_db ( ) , expected_ids ) ) for path , map_item in multimedia_map . items ( ) : media_item = raw_docs . get ( map_item . multimedia_id ) if media_item : media_cls = CommCareMultimedia . get_doc_class ( map_item . media_type ) yield path , media_cls . wrap ( media_item ) else : # Re-attempt to fetch media directly from couch media = CommCareMultimedia . get_doc_class ( map_item . media_type ) try : media = media . get ( map_item . multimedia_id ) yield path , media except ResourceNotFound as e : if toggles . CAUTIOUS_MULTIMEDIA . enabled ( self . domain ) : raise e