This commit is contained in:
lwl0608 2024-09-14 01:41:30 +08:00
parent 853f085739
commit 967343db80
1 changed files with 19 additions and 2 deletions

View File

@ -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'