示例#1
0
                    # os.remove("data/"+name)
                    print("done2")
        os.remove("data/" + name)
        print("done", count)


count1 = 1
print("new running")
while (True):
    print("connect camera...")
    cap = cv2.VideoCapture(
        "rtsp://*****:*****@10.76.53.14:8554/stream0/out.h264")
    while (True):
        ret, img = cap.read()
        timenow = datetime.now() + timedelta(hours=7)
        bool1 = ((int(t2(5, 00).strftime("%H%M")) < int(
            (timenow).strftime("%H%M"))) &
                 (int(t2(20, 00).strftime("%H%M")) > int(
                     (timenow).strftime("%H%M")))) & ((timenow).weekday() < 5)
        # bool1 = True
        # bool1 = False
        if ((cv2.waitKey(20) & 0xFF == ord('q')) | (not bool1)):
            # if ((cv2.waitKey(20) & 0xFF == ord('q'))):
            break
        else:
            if ret:
                _thread.start_new_thread(imagescan, (img, count1, timenow))
            else:
                client = pymongo.MongoClient("mongodb://127.0.0.1:27017")
                db2 = client.errorlog
                errdate = (datetime.now() + timedelta(hours=7))
示例#2
0
# sys.stdout = open(os.devnull, "w")

# import asyncio

# import concurrent.futures
import _thread

import requests
import json
from datetime import timedelta, datetime, date, time as t2
import time
from random import randint

timenow = datetime.now() + timedelta(hours=7)
print(timenow)
print(((timenow).strftime("%H%M")))
print(((int(t2(5, 00).strftime("%H%M")))))
print(int(t2(20, 00).strftime("%H%M")))
print(((int(t2(5, 00).strftime("%H%M")) < int((timenow).strftime("%H%M")))))
print((int(t2(20, 00).strftime("%H%M")) > int((timenow).strftime("%H%M"))))
print("old", ((int(t2(5, 00).strftime("%H%M")) > int(
    (timenow).strftime("%H%M"))) | (int(t2(20, 00).strftime("%H%M")) < int(
        (timenow).strftime("%H%M")))))
print("new", ((int(t2(5, 00).strftime("%H%M")) < int(
    (timenow).strftime("%H%M"))) & (int(t2(20, 00).strftime("%H%M")) > int(
        (timenow).strftime("%H%M")))))
print("full", ((int(t2(5, 00).strftime("%H%M")) < int(
    (timenow).strftime("%H%M"))) & (int(t2(20, 00).strftime("%H%M")) > int(
        (timenow).strftime("%H%M")))) & ((timenow).weekday() < 5))
示例#3
0

def imagescan(frame, count):
    # print("cc",count)
    if (count % 56) == 0:
        now=datetime.now() + timedelta(hours=7)
        today=date.today() + timedelta(hours=7)
        current_time=now.strftime("%H%M%S")
        name="test"+str(today)+"-2-"+current_time+".jpg"
        print("count",count)
        cv2.imwrite("data/"+name, frame)
        storeblob(name)

count1=1
while(True):
    ret, img=cap.read()
    timenow =datetime.now() + timedelta(hours=7)
    bool1 = ((int(t2(5,30).strftime("%H%M"))<int( (timenow).strftime("%H%M")) ) & (int(t2(8,00).strftime("%H%M"))>int( (timenow).strftime("%H%M")) )  ) & ((timenow).weekday() < 5)
    if ((cv2.waitKey(20) & 0xFF == ord('q')) | (not bool1)):
        break

    if ret:
        _thread.start_new_thread(imagescan, (img, count1))
    else: 
        break
    count1=count1 + 1



cap.release()
cv2.destroyAllWindows()
示例#4
0
import sys
from datetime import timedelta, datetime, date, time as t2
import time
timenow = datetime.now() + timedelta(hours=7)
bool1 = ((int(t2(5, 00).strftime("%H%M")) < int(
    (timenow).strftime("%H%M"))) & (int(t2(12, 00).strftime("%H%M")) > int(
        (timenow).strftime("%H%M")))) & ((timenow).weekday() < 5)
if (not bool1):
    time.sleep(900)
    sys.exit()
import numpy as np
import cv2
import os
import uuid
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
import pymongo
from Crypto.Cipher import AES
from Crypto import Random
import base64
# import io
from io import BytesIO
from PIL import Image
from pkcs7 import PKCS7Encoder
# from io import StringIO
# import sys
# import os

# sys.stdout = open(os.devnull, "w")

# import asyncio