Exemplo n.º 1
0
from threading import Thread
import struct
import time

from lib.audio import play_file, prepare_file
from lib.clock import run_at, build_clock
from lib.ntp import get_time_more_exact

from socket import socket, AF_INET, SOCK_DGRAM, \
     SOL_SOCKET, SO_BROADCAST

now = build_clock(get_time_more_exact())
nowi = lambda: int(now())


class Downloader(Thread):
    def __init__(self, playlist):
        Thread.__init__(self)
        self.daemon = True
        self.playlist = playlist

    def run(self):
        pass


class Player(Thread):
    def __init__(self, playlist):
        Thread.__init__(self)
        self.daemon = True
        self.playlist = playlist
Exemplo n.º 2
0
#!/usr/bin/env python

import sys
from decimal import Decimal
from lib import clock, ntp, audio

timestamp, path = sys.argv[1:]
timestamp = Decimal(timestamp)

diff = ntp.get_time_more_exact()
real_clock = clock.build_clock(diff)


def player():
    audio.play_file(path, real_clock)


clock.run_at(timestamp, player, real_clock)
Exemplo n.º 3
0
#!/usr/bin/env python

from lib import clock, ntp
import time
import sys

diff = ntp.get_time_more_exact()
clck = clock.build_clock(diff)

print "click:",
sys.stdin.readline()

for i in xrange(10):
    print clck()
    time.sleep(1)