| 1879 | logger.info(f"Saved Tokens on: {self.new_text_file.tokens_url_signed_blob_path}") |
| 1880 | |
| 1881 | def save_raw_audio_file(self): |
| 1882 | new_offset_in_seconds = settings.SIGNED_URL_CACHE_NEW_OFFSET_SECONDS_VALID |
| 1883 | self.new_audio_file.url_signed_expiry = int(new_offset_in_seconds) # 1 month |
| 1884 | |
| 1885 | self.new_audio_file.url_signed_blob_path = '{}{}/{}'.format(settings.PROJECT_TEXT_FILES_BASE_DIR, |
| 1886 | str(self.project_id), |
| 1887 | str(self.new_audio_file.id)) |
| 1888 | |
| 1889 | # TODO: Please review. On image there's a temp directory for resizing. But I don't feel the need for that here. |
| 1890 | logger.debug(f"Uploading text file from {self.input.temp_dir_path_and_filename}") |
| 1891 | |
| 1892 | data_tools.upload_to_cloud_storage( |
| 1893 | temp_local_path = self.input.temp_dir_path_and_filename, |
| 1894 | blob_path = self.new_audio_file.url_signed_blob_path, |
| 1895 | content_type = "text/plain", |
| 1896 | ) |
| 1897 | |
| 1898 | self.new_audio_file.url_signed = data_tools.build_secure_url(self.new_audio_file.url_signed_blob_path, |
| 1899 | new_offset_in_seconds) |
| 1900 | |
| 1901 | def save_raw_text_file(self): |
| 1902 | new_offset_in_seconds = settings.SIGNED_URL_CACHE_NEW_OFFSET_SECONDS_VALID |