def __init__(self, width=320, height=240, dir="."): global end_of_video self.width = width self.height = height self.ctx_thread = None files = os.listdir(dir) if len(files) == 0: print("error: no files found in dir " + dir) exit() videos = [] for f in files: if (string.find(f, "mp4") > 0): videos.append(f) print("+ " + f) if (string.find(f, "avi") > 0): videos.append(f) print("+ " + f) if (len(videos) < 1): print("error: no videos found in dir " + dir) exit() # init context self.cx = freej.Context() self.cx.init() self.scr = freej.SdlScreen() self.scr.init(400, 300) self.cx.add_screen(scr) self.cx.plugger.refresh(self.cx) self.ctx_thread = threading.Thread(target=self.cx.start, name="freej") self.ctx_thread.start() current = 0 self.callback = NextVideoCB() while (not self.cx.quit): if (current >= len(videos)): current = 0 self.video = freej.VideoLayer() self.video.init(self.cx) self.video.open(dir + "/" + videos[current]) self.video.add_eos_call(self.callback) # self.video.fit() self.video.start() self.cx.add_layer(self.video) while (not end_of_video): time.sleep(5) print "end of video" self.video.quit = True time.sleep(1) self.cx.rem_layer(self.video) current += 1
def __init__(self, width=320, height=240, url="http://giss.tv/dmmdb/rss.php?channel=piksel08"): global end_of_video self.width = width self.height = height self.rsssucker = RSSsucker(url) self.ctx_thread = None if len(self.rsssucker.list): # init context self.cx = freej.Context() self.cx.init() self.scr = freej.SdlScreen() self.scr.init(400, 300) self.cx.add_screen(scr) self.cx.plugger.refresh(self.cx) self.ctx_thread = threading.Thread(target=self.cx.start, name="freej") self.ctx_thread.start() self.callback = NextVideoCB() self.audio = freej.AudioCollector('freej', 1024, 44100) while (not self.cx.quit): for file in self.rsssucker.list: print file self.lay = freej.VideoLayer() self.lay.init(self.cx) self.lay.open( urllib.pathname2url(file).replace("%3A", ":")) self.lay.add_eos_call(self.callback) self.lay.start() self.scr.add_layer(self.lay) self.scr.add_audio(self.audio.Jack) while (not end_of_video): time.sleep(5) print "end of video" self.lay.quit = True self.cx.rem_layer(self.lay) end_of_video = False else: print "Cannot start a show without playlist!"
def __init__(self): self.cx = freej.Context() self.cx.init() self.cx.clear_all = True self.scr = freej.ScreenFactory.get_instance("Screen") self.scr.init(400, 300, 32) self.cx.add_screen(self.scr) if len(sys.argv) > 1: for lay in sys.argv[1:]: self.open_layer(lay) self.th = threading.Thread(target=self.cx.start, name="freej") self.th.start()
#!/usr/bin/env python # pygame + PyOpenGL version of Nehe's OpenGL lesson06 # Paul Furber 2001 - [email protected] import os import sys from OpenGL.GL import * from OpenGL.GLU import * import pygame, pygame.image from pygame.locals import * # init freej and create a layer import freej import time freejc = freej.Context() freejc.init(512,512,2,0) freejc.plugger.refresh(freejc) for gen in range(1,freejc.generators.len()+1): print freejc.generators.pick(gen).name layer = freej.create_layer(freejc,sys.argv[1]) layer.start() freejc.add_layer(layer) time.sleep(0.1) filt = freejc.filters["rotozoom"] filt.apply(layer) # end init freej # keyboard globals
import threading import freej import time import sys #freej.set_debug(3) # init context cx = freej.Context() cx.init() #cx.init(400,300,0,0) scr = freej.SdlScreen() scr.init(400, 300, 32) cx.add_screen(scr) cx.config_check("keyboard.js") cx.plugger.refresh(cx) # add a layer # lay = freej.create_layer(cx,sys.argv[1]) lay = cx.open(sys.argv[1]) filt = cx.filters["vertigo"] lay.add_filter(filt) lay.start() lay.active = True cx.add_layer(lay) th = threading.Thread(target=cx.start, name="freej") th.start() # th.join();
# Paul Furber 2001 - [email protected] import os import sys from OpenGL.GL import * from OpenGL.GLU import * import pygame, pygame.image from pygame.locals import * # init freej and create a layer import freej import time import random import math freejc = freej.Context() freejc.init(512, 512, 2, 0) freejc.plugger.refresh(freejc) freejc2 = freej.Context() freejc2.init(512, 512, 2, 0) freejc2.plugger.refresh(freejc2) for gen in range(1, freejc.generators.len() + 1): print freejc.generators[gen].name def create_layer(ctx, name): layer = freej.GenF0rLayer() layer.init(ctx) layer.open("partik0l")