Exemplo n.º 1
0
class MC_VLCServerlist(Screen):
	def __init__(self, session):
		Screen.__init__(self, session)

		self.session = session
		self.serviceHandler = eServiceCenter.getInstance()

		#self.vlcServerConfig = VlcServerConfig()
		self.serverlist = VlcServerList()

		self.isVisible = True

		#self["currentdir"] = Label("List of known VLC-Server")
		self["serverlist"] = self.serverlist

		self["key_red"] = Button("Delete Server")
		self["key_green"] = Button("Add Server")
		self["key_yellow"] = Button("Edit Server")
		self["key_blue"] = Button("Play DVD")

		self["actions"] = ActionMap(["WizardActions", "MenuActions", "ShortcutActions", "MoviePlayerActions"],
			{
			 "back": 	self.Exit,
			 "red": 	self.keyDelete,
			 "green": 	self.keyAddServer,
			 "yellow": 	self.keyEditServer,
			 "blue":	self.keyDVD,
			 "up": 		self.up,
			 "down": 	self.down,
			 "left": 	self.left,
			 "right": 	self.right,
			 "ok":		self.ok
			 }, -1)

		self.onLayoutFinish.append(self.updateServerlist)

	def updateServerlist(self):
		#self.serverlist.update(self.vlcServerConfig.getServerlist())
		self.serverlist.update(vlcServerConfig.getServerlist(), vlcServerConfig.getDefaultServer())

	def keyAddServer(self):
		#newServer = self.vlcServerConfig.new()
		newServer = vlcServerConfig.new()
		self.session.openWithCallback(self.addCallback, VlcServerConfigScreen, newServer)

	def addCallback(self, result, server):
		if result:
			#self.vlcServerConfig.save(server)
			vlcServerConfig.save(server)
			self.updateServerlist()
		else:
			#self.vlcServerConfig.delete(server)
			vlcServerConfig.delete(server)

	def keyDelete(self):
		self.session.openWithCallback(self.deleteCallback, MessageBox, _("Really delete this Server?"))

	def deleteCallback(self, result, server):
		if result:
			#self.vlcServerConfig.delete(self.serverlist.getSelection())
			vlcServerConfig.delete(self.serverlist.getSelection())
			self.updateServerlist()

	def keyDVD(self):
		server = self.serverlist.getSelection()
		if server is not None:
			dlg = self.session.open(VlcPlayer, server, self.serverlist)
			dlg.playfile("dvdsimple://" + server.getDvdPath(), "DVD")

	def keyEditServer(self):
		server = self.serverlist.getSelection()
		if server is not None:
			self.session.openWithCallback(self.editCallback, VlcServerConfigScreen, server)

	def editCallback(self, result, server):
		if result:
			#self.vlcServerConfig.save(server)
			vlcServerConfig.save(server)
			self.updateServerlist()
		else:
			#self.vlcServerConfig.cancel(server)
			vlcServerConfig.cancel(server)

	def up(self):
		self.serverlist.up()

	def down(self):
		self.serverlist.down()

	def left(self):
		self.serverlist.pageUp()

	def right(self):
		self.serverlist.pageDown()

	def ok(self):
		if self.serverlist.getSelection() is not None:
			self.session.open(MC_VLCMedialist, self.serverlist.getSelection()).update()

	def Exit(self):
		if self.isVisible == False:
			self.visibility()
			return

		# Stop currently playing service
		self.session.nav.stopService()

		# Save and exit
		config.plugins.mc_vlc.save()
		self.close()
Exemplo n.º 2
0
class MC_VLCServerlist(Screen):
	def __init__(self, session):
		Screen.__init__(self, session)

		self.session = session
		self.serviceHandler = eServiceCenter.getInstance()

		#self.vlcServerConfig = VlcServerConfig()
		self.serverlist = VlcServerList()

		self.isVisible = True

		#self["currentdir"] = Label("List of known VLC-Server")
		self["serverlist"] = self.serverlist

		self["key_red"] = Button("Delete Server")
		self["key_green"] = Button("Add Server")
		self["key_yellow"] = Button("Edit Server")
		self["key_blue"] = Button("Play DVD")

		self["actions"] = ActionMap(["WizardActions", "MenuActions", "ShortcutActions", "MoviePlayerActions"],
			{
			 "back": 	self.Exit,
			 "red": 	self.keyDelete,
			 "green": 	self.keyAddServer,
			 "yellow": 	self.keyEditServer,
			 "blue":	self.keyDVD,
			 "up": 		self.up,
			 "down": 	self.down,
			 "left": 	self.left,
			 "right": 	self.right,
			 "ok":		self.ok
			 }, -1)

		self.onLayoutFinish.append(self.updateServerlist)

	def updateServerlist(self):
		#self.serverlist.update(self.vlcServerConfig.getServerlist())
		self.serverlist.update(vlcServerConfig.getServerlist(), vlcServerConfig.getDefaultServer())

	def keyAddServer(self):
		#newServer = self.vlcServerConfig.new()
		newServer = vlcServerConfig.new()
		self.session.openWithCallback(self.addCallback, VlcServerConfigScreen, newServer)

	def addCallback(self, result, server):
		if result:
			#self.vlcServerConfig.save(server)
			vlcServerConfig.save(server)
			self.updateServerlist()
		else:
			#self.vlcServerConfig.delete(server)
			vlcServerConfig.delete(server)

	def keyDelete(self):
		self.session.openWithCallback(self.deleteCallback, MessageBox, _("Really delete this Server?"))

	def deleteCallback(self, result, server):
		if result:
			#self.vlcServerConfig.delete(self.serverlist.getSelection())
			vlcServerConfig.delete(self.serverlist.getSelection())
			self.updateServerlist()

	def keyDVD(self):
		server = self.serverlist.getSelection()
		if server is not None:
			dlg = self.session.open(VlcPlayer, server, self.serverlist)
			dlg.playfile("dvdsimple://" + server.getDvdPath(), "DVD")

	def keyEditServer(self):
		server = self.serverlist.getSelection()
		if server is not None:
			self.session.openWithCallback(self.editCallback, VlcServerConfigScreen, server)

	def editCallback(self, result, server):
		if result:
			#self.vlcServerConfig.save(server)
			vlcServerConfig.save(server)
			self.updateServerlist()
		else:
			#self.vlcServerConfig.cancel(server)
			vlcServerConfig.cancel(server)

	def up(self):
		self.serverlist.up()

	def down(self):
		self.serverlist.down()

	def left(self):
		self.serverlist.pageUp()

	def right(self):
		self.serverlist.pageDown()

	def ok(self):
		if self.serverlist.getSelection() is not None:
			self.session.open(MC_VLCMedialist, self.serverlist.getSelection()).update()

	def Exit(self):
		if self.isVisible == False:
			self.visibility()
			return

		# Stop currently playing service
		self.session.nav.stopService()

		# Save and exit
		config.plugins.mc_vlc.save()
		self.close()
Exemplo n.º 3
0
class MC_VLCServerlist(Screen):
    def __init__(self, session):
        Screen.__init__(self, session)
        self.session = session
        self.serviceHandler = eServiceCenter.getInstance()
        self.serverlist = VlcServerList()
        self.isVisible = True
        self['serverlist'] = self.serverlist
        self['key_red'] = Button('Delete Server')
        self['key_green'] = Button('Add Server')
        self['key_yellow'] = Button('Edit Server')
        self['key_blue'] = Button('Play DVD')
        self['actions'] = ActionMap(
            [
                'WizardActions', 'MenuActions', 'ShortcutActions',
                'MoviePlayerActions'
            ], {
                'back': self.Exit,
                'red': self.keyDelete,
                'green': self.keyAddServer,
                'yellow': self.keyEditServer,
                'blue': self.keyDVD,
                'up': self.up,
                'down': self.down,
                'left': self.left,
                'right': self.right,
                'ok': self.ok
            }, -1)
        self.onLayoutFinish.append(self.updateServerlist)

    def updateServerlist(self):
        self.serverlist.update(vlcServerConfig.getServerlist(),
                               vlcServerConfig.getDefaultServer())

    def keyAddServer(self):
        newServer = vlcServerConfig.new()
        self.session.openWithCallback(self.addCallback, VlcServerConfigScreen,
                                      newServer)

    def addCallback(self, result, server):
        if result:
            vlcServerConfig.save(server)
            self.updateServerlist()
        else:
            vlcServerConfig.delete(server)

    def keyDelete(self):
        self.session.openWithCallback(self.deleteCallback, MessageBox,
                                      _('Really delete this Server?'))

    def deleteCallback(self, result, server):
        if result:
            vlcServerConfig.delete(self.serverlist.getSelection())
            self.updateServerlist()

    def keyDVD(self):
        server = self.serverlist.getSelection()
        if server is not None:
            dlg = self.session.open(VlcPlayer, server, self.serverlist)
            dlg.playfile('dvdsimple://' + server.getDvdPath(), 'DVD')
        return

    def keyEditServer(self):
        server = self.serverlist.getSelection()
        if server is not None:
            self.session.openWithCallback(self.editCallback,
                                          VlcServerConfigScreen, server)
        return

    def editCallback(self, result, server):
        if result:
            vlcServerConfig.save(server)
            self.updateServerlist()
        else:
            vlcServerConfig.cancel(server)

    def up(self):
        self.serverlist.up()

    def down(self):
        self.serverlist.down()

    def left(self):
        self.serverlist.pageUp()

    def right(self):
        self.serverlist.pageDown()

    def ok(self):
        if self.serverlist.getSelection() is not None:
            self.session.open(MC_VLCMedialist,
                              self.serverlist.getSelection()).update()
        return

    def Exit(self):
        if self.isVisible == False:
            self.visibility()
            return
        self.session.nav.stopService()
        config.plugins.mc_vlc.save()
        self.close()