Skip to content

Commit

Permalink
🛩️🌚 ↝ [SSP-31 SSP-15]: Extracting all media
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Nov 10, 2024
1 parent 83c291a commit 7e81938
Show file tree
Hide file tree
Showing 62 changed files with 52 additions and 0 deletions.
Binary file added content/avatars/0.11311584587670742.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/84238508.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/84238508_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/84238508_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/84238508_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/94904822_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/94904822_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/94904822_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/clouds/94904822_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions content/storageExtraction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import os
from supabase import create_client, Client

def init_supabase_client():
url = "http://127.0.0.1:54321"
key = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
return create_client(url, key)

def fetch_files_from_bucket(supabase: Client, bucket_name: str):
storage = supabase.storage.from_(bucket_name)
response = storage.list()
return response # This returns a list of files directly

def download_file_from_bucket(supabase: Client, bucket_name: str, file_name: str, download_path: str):
storage = supabase.storage.from_(bucket_name)
print(f"Attempting to download: {bucket_name}/{file_name}")
try:
file_data = storage.download(file_name)
with open(download_path, 'wb') as file:
file.write(file_data)
print(f"Downloaded {file_name} to {download_path}")
except Exception as e:
print(f"Error downloading {file_name}: {e}")

def create_directory_for_bucket(bucket_name: str):
directory_path = os.path.join(os.getcwd(), bucket_name)
if not os.path.exists(directory_path):
os.makedirs(directory_path)
return directory_path

def download_files_from_buckets(supabase: Client, bucket_names: list):
for bucket_name in bucket_names:
print(f"Processing bucket: {bucket_name}")
files = fetch_files_from_bucket(supabase, bucket_name)
bucket_directory = create_directory_for_bucket(bucket_name)
for file in files:
file_name = file['name']
download_path = os.path.join(bucket_directory, file_name)
try:
print(f"Downloading file: {file_name} to {download_path}")
download_file_from_bucket(supabase, bucket_name, file_name, download_path)
except Exception as e:
print(f"Error downloading {file_name}: {e}")
print(f"Finished downloading files from bucket: {bucket_name}\n")

def main():
supabase = init_supabase_client()
bucket_names = ['anomalies', 'zoodex', 'media', 'avatars', 'clouds', 'telescope']
download_files_from_buckets(supabase, bucket_names)

if __name__ == "__main__":
main()
Binary file added content/telescope/100879215.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/telescope/101178991.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/telescope/36776833.jpeg
Binary file added content/telescope/3774358.png
Binary file added content/telescope/41432028.jpeg
Binary file added content/telescope/41434047.jpeg
Binary file added content/telescope/46366425.jpeg
Binary file added content/telescope/46374544.jpeg
Binary file added content/telescope/54946413.jpeg
Binary file added content/telescope/54947992.jpeg
Binary file added content/telescope/54948407.jpeg
Binary file added content/telescope/69163612.jpeg
Binary file added content/telescope/69164744.jpeg
Binary file added content/telescope/69165042.jpeg
Binary file added content/telescope/69165953.jpeg
Binary file added content/telescope/69166150.jpeg
Binary file added content/telescope/69173163.jpeg
Binary file added content/telescope/69173819.jpeg
Binary file added content/telescope/69174537.jpeg
Binary file added content/telescope/83739280.jpeg
Binary file added content/telescope/83740302.jpeg
Binary file added content/telescope/83740762.jpeg
Binary file added content/telescope/83742405.jpeg
Binary file added content/telescope/87655022.jpeg
Binary file added content/telescope/87658669.jpeg
Binary file added content/telescope/87659096.jpeg
Binary file added content/telescope/87659996.jpeg
Binary file added content/telescope/88336832.jpeg
Binary file added content/telescope/88341827.jpeg
Binary file added content/telescope/90670192.png
Binary file added content/telescope/91262833.png
Binary file added content/telescope/91393611.png
Binary file added content/telescope/91397859.png
Binary file added content/telescope/91849610.png
Binary file added content/telescope/91994994.png
Binary file added content/telescope/91999896.png

0 comments on commit 7e81938

Please sign in to comment.