liqian 3 år sedan
förälder
incheckning
f4b3b76b87
2 ändrade filer med 7 tillägg och 7 borttagningar
  1. 2 2
      config.py
  2. 5 5
      utils.py

+ 2 - 2
config.py

@@ -237,7 +237,7 @@ class ProductionConfig(BaseConfig):
 
 
 def set_config():
-    return DevelopmentConfig()
-    # return TestConfig()
+    # return DevelopmentConfig()
+    return TestConfig()
     # return PreProductionConfig()
     # return ProductionConfig()

+ 5 - 5
utils.py

@@ -180,12 +180,12 @@ def update_video_w_h_rate(video_ids, key_name):
     info_data = {}
     for video_id, width, height, rotate in data:
         # rotate 字段值为 90或270时,width和height的值相反
-        if rotate in (90, 270):
-            w_h_rate = height / width
+        if int(rotate) in (90, 270):
+            w_h_rate = int(height) / int(width)
         else:
-            w_h_rate = width / height
+            w_h_rate = int(width) / int(height)
         if w_h_rate > 1:
-            info_data[int(video_id)] = float(w_h_rate)
+            info_data[int(video_id)] = w_h_rate
     redis_helper = RedisHelper()
     # 删除旧数据
     redis_helper.del_keys(key_name=key_name)
@@ -198,6 +198,6 @@ if __name__ == '__main__':
     # data_test = [9.20273281e+03, 7.00795065e+03, 5.54813112e+03, 9.97402494e-01, 9.96402495e-01, 9.96402494e-01]
     # data_normalization(data_test)
     # request_post(request_url=config_.NOTIFY_BACKEND_UPDATE_ROV_SCORE_URL, request_data={'videos': []})
-    video_ids = [110, 112, 113, 115, 116, 117, 118]
+    video_ids = [110, 112, 113, 115, 116, 117, 8289883]
     update_video_w_h_rate(video_ids=video_ids, key_name='')