liqian vor 3 Jahren
Ursprung
Commit
94cca8947b
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      utils.py

+ 4 - 4
utils.py

@@ -191,12 +191,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)