From 967343db80609090ad87fc0a6982326ab65c96c7 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Sat, 14 Sep 2024 01:41:30 +0800 Subject: [PATCH] fix --- media/calc_10bit.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/media/calc_10bit.py b/media/calc_10bit.py index 38cb103..007659e 100644 --- a/media/calc_10bit.py +++ b/media/calc_10bit.py @@ -37,20 +37,37 @@ class S: def __del__(self): self.col_video.close() + def update_pixel_format(self, vid, pixel_format): + q = {"_id": vid} + up = { + "$set": { + "pixel_format": pixel_format + } + } + ret = self.col_video.update_one(q, up) + return ret + def proc(self): prj = { "src_id": 1, "src_id_720": 1 } docs = self.col_video.find({}, projection=prj) - for d in docs[:100]: + + total = len(docs) + idx = 0 + for d in docs: + idx += 1 vid = safe_get_int(d, "_id") src_id_720 = safe_get_str(d, "src_id_720") url = host + src_id_720 if len(src_id_720) > 0: # print(vid, url) pixel_format = get_pixel_format(url) - print(vid, pixel_format) + ret = self.update_pixel_format(vid, pixel_format) + print("{}/{} vid: {}, pf: {}, ret: {}".format(idx, total, vid, pixel_format, ret.modified_count)) + # if pixel_format != "yuv420p": + # print(vid, pixel_format) # video_url = 'https://filecdn01.tiefen.fun/vdprodh264720/5a/d7/175d-2137-4a66-8e5c-d5ed61241b6c'