Add script to create videos for speaking questions.
This commit is contained in:
@@ -22,5 +22,24 @@ def upload_file_firebase(bucket_name, destination_blob_name, source_file_name):
|
||||
print("Error uploading file to Google Cloud Storage:", e)
|
||||
return False
|
||||
|
||||
def upload_file_firebase_get_url(bucket_name, destination_blob_name, source_file_name):
|
||||
# Uploads a file to Firebase Storage.
|
||||
storage_client = storage.Client()
|
||||
bucket = storage_client.bucket(bucket_name)
|
||||
try:
|
||||
blob = bucket.blob(destination_blob_name)
|
||||
blob.upload_from_filename(source_file_name)
|
||||
print(f"File uploaded to {destination_blob_name}")
|
||||
|
||||
# Make the file public
|
||||
blob.make_public()
|
||||
|
||||
# Get the public URL
|
||||
url = blob.public_url
|
||||
return url
|
||||
except Exception as e:
|
||||
print("Error uploading file to Google Cloud Storage:", e)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user