AnlaAnla 2 tygodni temu
rodzic
commit
7473b0c305
3 zmienionych plików z 30 dodań i 16 usunięć
  1. 7 0
      .idea/dataSources.xml
  2. 22 15
      Test/minio测试.py
  3. 1 1
      app/utils/scheme.py

+ 7 - 0
.idea/dataSources.xml

@@ -8,5 +8,12 @@
       <jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
       <working-dir>$ProjectFileDir$</working-dir>
     </data-source>
+    <data-source source="LOCAL" name="远程1" uuid="22cea3ec-d9b5-49e5-85ae-e51209971fe6">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://192.168.77.249:3306</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
   </component>
 </project>

+ 22 - 15
Test/minio测试.py

@@ -1,4 +1,5 @@
 from minio import Minio
+import os
 
 
 client = Minio(
@@ -8,22 +9,28 @@ client = Minio(
     secure=False
 )
 
-bucket_name = "grading"
+MINIO_ENDPOINT = "192.168.77.249:9000"
+MINIO_BUCKET = "grading"
+MINIO_BASE_PREFIX = "raspi_img_data"
 
+DATA_HOST_URL = f"http://{MINIO_ENDPOINT}/{MINIO_BUCKET}/{MINIO_BASE_PREFIX}"
 
-try:
-    # 2. 检查存储桶是否存在
-    found = client.bucket_exists(bucket_name)
-    if not found:
-        client.make_bucket(bucket_name)
-        print(f"存储桶 {bucket_name} 已创建")
-    else:
-        print(f"存储桶 {bucket_name} 已存在")
 
-    # 4. 列出该目录(桶)下的所有文件
-    objects = client.list_objects(bucket_name, recursive=True)
-    for obj in objects:
-        print(f"对象名称: {obj.object_name}, 大小: {obj.size} bytes")
+# try:
+#     # 2. 检查存储桶是否存在
+#     found = client.bucket_exists(bucket_name)
+#     if not found:
+#         client.make_bucket(bucket_name)
+#         print(f"存储桶 {bucket_name} 已创建")
+#     else:
+#         print(f"存储桶 {bucket_name} 已存在")
+#
+#     cloud_path = os.path.join(data_dir, object_name).replace("\\", "/")
+#
+#     client.fput_object(bucket_name, cloud_path, img_path, content_type="image/jpeg")
+#     print(f"成功上传 {object_name} 到 {bucket_name}")
 
-except Exception as e:
-    print(f"发生错误: {e}")
+
+
+# except Exception as e:
+#     print(f"发生错误: {e}")

+ 1 - 1
app/utils/scheme.py

@@ -20,7 +20,7 @@ class ImageType(str, Enum):
 class CardType(str, Enum):
     pokemon = "pokemon"
     basketball = "basketball"
-    baseball = "baseball"
+    football = "football"
 
 
 class ResultImagePathType(str, Enum):