Skip to content

Commit

Permalink
nowindow does not need pygame
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Geoffray committed Feb 18, 2015
1 parent 10a4eef commit 9364348
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Binary file modified piggyphoto/__init__.pyc
Binary file not shown.
Binary file modified piggyphoto/ptp.pyc
Binary file not shown.
12 changes: 8 additions & 4 deletions pyying.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import threading
import piggyphoto, pygame
import piggyphoto
import os
import sys
import time
Expand All @@ -15,7 +15,7 @@
from OSC import * #required, to install : sudo pip install pyOSC

class Pyying():
snap_path = '/var/www/html/pyying/snaps/' # Don't forget to $ chown `whoami` this folder
snap_path = 'snaps/' # Don't forget to $ chown `whoami` this folder
snap_filename = 'snap'
path = '/tmp/stream/'
filename = 'preview'
Expand Down Expand Up @@ -76,13 +76,15 @@ def __init__(self, host="localhost", port=8010, nowindow=False):
self.close()

def start(self):
clock = pygame.time.Clock()
if (not self.nowindow):
clock = pygame.time.Clock()
try:
while not self.quit_pressed():

# trying to get a fixed fps. However the camera is limiting to approx 22 fps
# print str(clock.get_fps())
clock.tick(25)
if (not self.nowindow):
clock.tick(25)

# Shoot picture
if (self.isShooting):
Expand Down Expand Up @@ -181,6 +183,8 @@ def main(argv):
elif opt in ("-p", "--port"):
port = arg

if (not nowindow):
import pygame
ying = Pyying(host=host, port=port, nowindow=nowindow)
ying.start()

Expand Down
8 changes: 4 additions & 4 deletions shootOSC.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from OSC import * #required, to install : sudo pip install pyOSC
from time import sleep
listen_address = '127.0.0.1'
port = 5555
port = 8010
c = OSCClient()
c.connect((listen_address, port)) # connect to our OSCServer
bundle = OSCBundle("/pyying/shoot")
#bundle.setTimeTag(time.time() + 5)
bundle.append ("1")
while True:
c.send(bundle)
sleep(30)
#while True:
c.send(bundle)
#sleep(30)
#sleep(1)

0 comments on commit 9364348

Please sign in to comment.