summaryrefslogtreecommitdiff
path: root/src/YalpClients/EflClient/playlist.py
blob: 4d3f12c3730d5ce9de73c20f7fe056adf7ee741b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python

import edje
import ecore.evas
import sys
import os
import ecore
import emotion
import evas
import elementary
import YalpInterfaces, CosNaming, YalpInterfaces__POA
import evas.c_evas

import media

class Selection(object):
	def __init__(self, win, c):
		self.win = win
		self.c = c
		self.vid = emotion.Emotion(self.win.canvas, module_filename="xine")
		self.add_button()
		self.c.signal_callback_add("mouse,clicked,1", "medialist_buttonframe",
		self.play_video)
		self.c.signal_callback_add("mouse,clicked,1", "stop_buttonframe", 
		self.stop_video)
	
	def add_button(self):
		addbutton = elementary.Button(self.win)
		addbutton.label_set("Play")
		self.c.part_swallow("medialist_buttonframe", addbutton)
		addbutton.show()

		stopbutton = elementary.Button(self.win)
		stopbutton.label_set("Stop")
		self.c.part_swallow("stop_buttonframe", stopbutton)
		stopbutton.show()

		hidebutton = elementary.Button(self.win)
		hidebutton.label_set("Hide")
		self.c.part_swallow("hide_buttonframe", hidebutton)
		hidebutton.show()

	def set_stream(self, songs, servercon):
		self.songlist = songs
		self.servercon = servercon
		print "songlist", songs
		
	
	def play_video(self, dummy, dumm, duemmer):
		ip = "10.0.3.180"
		port = 9993
		self.info = YalpInterfaces.AccessInfo("huhu", "huhu", "xine", "openmoko",
			YalpInterfaces.STREAM)
		self.stream = YalpInterfaces.Output(0, self.info, self.songlist,
			YalpInterfaces.CREATE, ip)
		ret = self.servercon.control(self.stream)
		self.stream.outputAction = YalpInterfaces.START
		ret = self.servercon.control(self.stream)
		print "stream.info:", self.stream.info

		print "stream from", ip, port
		self.vid.file_set("http://"+ip+":"+str(port))
		self.c.part_swallow("video", self.vid)
		self.vid.show()
		self.vid.play = True
	
	def stop_video(self, huhu, haha, hoho):
		self.stream.outputAction = YalpInterfaces.STOP
		ret = self.servercon.control(self.stream)
		self.vid.play = False