Created
December 27, 2012 17:52
-
-
Save streamer45/4390335 to your computer and use it in GitHub Desktop.
HelloWorld for Krad in Python!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Hello Krad World Video in Python | |
from time import sleep | |
from kradradio_client import Kradradio | |
# Station name | |
station_name = "hellokrad" | |
station = Kradradio(station_name) | |
# Video resolution and frame rate | |
width = 640 | |
height = 360 | |
fps = 30 | |
# Video filename | |
recording = "/home/admin/hello_krad_world.webm" | |
# Station startup | |
station.cmd("launch") | |
# Setting resolution | |
station.cmd("res "+str(width)+" "+str(height)) | |
# Setting framerate | |
station.cmd("fps "+str(fps)) | |
# Add Text | |
station.cmd("addtext 'Hello Krad World' 120 150 0 4 40 0 0 244 2 2 Helvetica") | |
# Start Recording | |
station.cmd("record video "+recording) | |
# Show Text | |
station.cmd("settext 0 120 150 0 4 40 1 0") | |
# Wait | |
sleep(3) | |
# Fade Text | |
station.cmd("settext 0 120 150 0 4 40 0 0") | |
# Wait | |
sleep(3) | |
# Shutdown | |
station.cmd("kill") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import shlex | |
import subprocess | |
KRAD = "krad_radio" | |
class Kradradio: | |
def __init__(self, sysname): | |
self.sysname = sysname | |
def cmd(self, cmd): | |
fullcmd = KRAD+" "+self.sysname+" "+cmd | |
print(fullcmd) | |
subprocess.call(shlex.split(fullcmd)) | |
sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment