summaryrefslogtreecommitdiff
path: root/src/YalpClients/EflClient/client.py
blob: c8923ba5dbaed202eeca121406d2018a48e0f2f0 (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
#!/usr/bin/env python

import sys
from omniORB import CORBA
import YalpInterfaces, CosNaming, YalpInterfaces__POA
import medialist
import media
import playlist

class Corba(object):
	def __init__(self, win, c):
		self.win = win
		self.c = c
		
		self.orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
		self.obj = self.orb.resolve_initial_references("NameService")
		self.root_context = self.obj._narrow(CosNaming.NamingContextExt)
		if self.root_context is None:
			print "Failed to narrow the root naming context"
			sys.exit(1)

		self.name = ("YALP_Server")
		try:
			self.obj = self.root_context.resolve_str(self.name)

		except CosNaming.NamingContext.NotFound, ex:
			print "Name not found", ex
			sys.exit(1)

		self.blubb = self.obj._narrow(YalpInterfaces.ServerControlInterface)
		if self.blubb is None:
			print "obj ref is not an dbsfeditf::dependency"
			sys.exit(1)
	
	def corba_search(self,searchentry):
		mlist = []
		mlist.append (YalpInterfaces.VIDEO)
		mlist.append (YalpInterfaces.SOUND)
		deps = self.blubb.search(searchentry, mlist)
		m = medialist.Medialist(self.win, self.c)
		video = playlist.Selection(self.win, self.c)

		for dep in deps[0]:
			current = media.Media(dep, video, self.blubb, self.win, self.c)
			m.add_media(current)