File size: 1,181 Bytes
48b2ebf c455b22 48b2ebf b67a3d2 c455b22 48b2ebf c455b22 48b2ebf c455b22 48b2ebf c455b22 48b2ebf c455b22 48b2ebf c455b22 48b2ebf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import os
import gdown
import re
import shutil
DRIVE_FOLDER_URL = "https://drive.google.com/drive/folders/1S9xT92Zm9rZ4RSCxAe_DLld8vu78mqW4"
LOCAL_DEST = "adapter"
TEMP_DIR = "gdrive_tmp"
def download_latest_adapter():
print("🔽 Downloading adapter folder from Google Drive...")
gdown.download_folder(url=DRIVE_FOLDER_URL, output=TEMP_DIR, quiet=False, use_cookies=False)
all_versions = sorted(
[d for d in os.listdir(TEMP_DIR) if re.match(r"version \d+", d)],
key=lambda x: int(x.split()[-1])
)
if not all_versions:
raise ValueError("❌ No version folders found in Google Drive folder.")
latest = all_versions[-1]
src = os.path.join(TEMP_DIR, latest)
print(f"✅ Latest adapter found: {latest}")
os.makedirs(LOCAL_DEST, exist_ok=True)
for f in os.listdir(LOCAL_DEST):
file_path = os.path.join(LOCAL_DEST, f)
if os.path.isfile(file_path):
os.remove(file_path)
for file in os.listdir(src):
shutil.copy(os.path.join(src, file), os.path.join(LOCAL_DEST, file))
print(f"✅ Adapter copied to: {LOCAL_DEST}")
if __name__ == "__main__":
download_latest_adapter()
|