import cv2
import glob
import time
import pymongo
from datetime import datetime
dbName = "tablica_informacyjna"
scheduleCol = "schedule"
scheduleTextCol = "textSchedule"
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient[dbName]
file = 'C:\\Users\\Nico\\Desktop\\WP\\'
# typy danych - image,video,hmtl,link,webcam
def scheduleMedia():
dblist = myclient.list_database_names()
if dbName not in dblist:
return []
mycol = mydb["schedule"]
collist = mydb.list_collection_names()
if scheduleCol not in collist:
return []
dateToday = datetime.today().strftime('%Y-%m-%d')
query = {"$and": [{"start": {"$lte": dateToday}, "end": {"$gte": dateToday}}]}
list = []
for item in mycol.find(query, {"_id": 0}):
list.append(item)
return list
def video(filename):
cap = cv2.VideoCapture(file+filename)
while (cap.isOpened()):
ret, frame = cap.read()
print(ret)
if ret:
cv2.imshow('Gallery', frame)
if cv2.waitKey(33) == 27:
exit()
break
else:
break
cap.release()
def img(filename,time):
cv2.imshow('Gallery', cv2.imread(file+filename))
time.sleep(time)
if cv2.waitKey(33) == ord('q'):
exit()
image_list = []
for filename in glob.glob('C:\\Users\\Nico\\Desktop\\WP/*.jpg'):
im = cv2.imread(filename)
image_list.append(im)
i = 0
cv2.namedWindow('Gallery', cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty('Gallery', cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
l=scheduleMedia()
while True:
for x in scheduleMedia():
if x["type"] == 'image':
img(x[["name"]], x["duration"])
if x["type"] == 'video':
video(x[["name"]])
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}