Skip to content

Commit

Permalink
TEMPORARY: use events.py to test
Browse files Browse the repository at this point in the history
  • Loading branch information
clvLabs committed Aug 17, 2022
1 parent 8ef62a6 commit 65a6318
Showing 1 changed file with 66 additions and 6 deletions.
72 changes: 66 additions & 6 deletions examples/events.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,83 @@ def onWarning(params: Dict[Any, Any]) -> None:
#
# Main code section
#
import logging

logging.basicConfig( datefmt='%H:%M:%S',
level=logging.INFO,
format='%(asctime)s.%(msecs)03d %(levelname)-8s [%(name)s] %(message)s')

log = logging.getLogger('PyATEMMax-demo')

log.info("Starting")


switcher = PyATEMMax.ATEMMax()

switcher.setLogLevel(logging.DEBUG)
switcher.setSocketLogLevel(logging.DEBUG)

switcher.registerEvent(switcher.atem.events.connectAttempt, onConnectAttempt)
switcher.registerEvent(switcher.atem.events.connect, onConnect)
switcher.registerEvent(switcher.atem.events.disconnect, onDisconnect)
switcher.registerEvent(switcher.atem.events.receive, onReceive)
switcher.registerEvent(switcher.atem.events.warning, onWarning)

switcher.connect(args.ip)
switcher.waitForConnection()

log.info(f"mediaPlayer.stillBanks {switcher.mediaPlayer.stillBanks}")
log.info(f"mediaPlayer.clipBanks {switcher.mediaPlayer.clipBanks}")


print(switcher.mediaPlayer.stillFile)
print(switcher.mediaPlayer.stillFile.itemClass)
print(switcher.mediaPlayer.stillFile.itemDict)
# print(switcher.mediaPlayer.stillFile._data)
for stillBankId in switcher.mediaPlayer.stillFile._data:
stillBank = switcher.mediaPlayer.stillFile._data[stillBankId]
print(f"- [DBG] [{stillBankId}] used [{stillBank.isUsed}] name [{stillBank.fileName}]")
'''
'''

lock_state = True
iteration = 0

while iteration < 1:
iteration += 1

while True:
if switcher.connected:
print(f"[{time.ctime()}] Changing PGM")
switcher.setProgramInputVideoSource(0, random.randint(1,8))

print(f"[{time.ctime()}] Changing PVW")
switcher.setPreviewInputVideoSource(0, random.randint(1,8))
# print("\n"*5)
# print("-"*80)
# log.info(f"Setting LKST lock 0 to {lock_state}")
# switcher.sendSetLockState(0,lock_state)

# time.sleep(0.5)


print("\n"*5)
print("-"*80)
log.info(f"Acquiring Media Lock")
switcher.sendAcquireMediaLock(0, 2)

time.sleep(1)

switcher.sendInitDownloadToSwitcherRequest(0, 0, 2, 100)


# log.info(f"Requesting data transfer")
# switcher.sendDataTransferRequest(1,0,1)

# lock_state = not lock_state

# log.info(f"Changing PGM")
# switcher.setProgramInputVideoSource(0, random.randint(1,8))

# log.info(f"Changing PVW")
# switcher.setPreviewInputVideoSource(0, random.randint(1,8))

# time.sleep(args.interval)
time.sleep(5)

time.sleep(args.interval)
switcher.disconnect()

0 comments on commit 65a6318

Please sign in to comment.