(self)
Set the media version numbers for all media in the app to the current app version
        if the media is new or has changed since the last build. Otherwise set it to the
        version from the last build.
Set the media version numbers for all media in the app to the current app version
        if the media is new or has changed since the last build. Otherwise set it to the
        version from the last build.
Set the media version numbers for all media in the app to the current app version if the media is new or has changed since the last build . Otherwise set it to the version from the last build .
def set_media_versions(self):
        """
        Set the media version numbers for all media in the app to the current app version
        if the media is new or has changed since the last build. Otherwise set it to the
        version from the last build.
        """

        # access to .multimedia_map is slow
        previous_version = self._get_version_comparison_build()
        prev_multimedia_map = previous_version.multimedia_map if previous_version else {}

        for path, map_item in self.multimedia_map.items():
            prev_map_item = prev_multimedia_map.get(path, None)
            if prev_map_item and prev_map_item.unique_id:
                # Re-use the id so CommCare knows it's the same resource
                map_item.unique_id = prev_map_item.unique_id
            if (prev_map_item and prev_map_item.version
                    and prev_map_item.multimedia_id == map_item.multimedia_id):
                map_item.version = prev_map_item.version
            else:
                map_item.version = self.version
def set_media_versions ( self ) : # access to .multimedia_map is slow previous_version = self . _get_version_comparison_build ( ) prev_multimedia_map = previous_version . multimedia_map if previous_version else { } for path , map_item in self . multimedia_map . items ( ) : prev_map_item = prev_multimedia_map . get ( path , None ) if prev_map_item and prev_map_item . unique_id : # Re-use the id so CommCare knows it's the same resource map_item . unique_id = prev_map_item . unique_id if ( prev_map_item and prev_map_item . version and prev_map_item . multimedia_id == map_item . multimedia_id ) : map_item . version = prev_map_item . version else : map_item . version = self . version