fix
This commit is contained in:
parent
853f085739
commit
967343db80
|
@ -37,20 +37,37 @@ class S:
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.col_video.close()
|
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):
|
def proc(self):
|
||||||
prj = {
|
prj = {
|
||||||
"src_id": 1,
|
"src_id": 1,
|
||||||
"src_id_720": 1
|
"src_id_720": 1
|
||||||
}
|
}
|
||||||
docs = self.col_video.find({}, projection=prj)
|
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")
|
vid = safe_get_int(d, "_id")
|
||||||
src_id_720 = safe_get_str(d, "src_id_720")
|
src_id_720 = safe_get_str(d, "src_id_720")
|
||||||
url = host + src_id_720
|
url = host + src_id_720
|
||||||
if len(src_id_720) > 0:
|
if len(src_id_720) > 0:
|
||||||
# print(vid, url)
|
# print(vid, url)
|
||||||
pixel_format = get_pixel_format(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'
|
# video_url = 'https://filecdn01.tiefen.fun/vdprodh264720/5a/d7/175d-2137-4a66-8e5c-d5ed61241b6c'
|
||||||
|
|
Loading…
Reference in New Issue