Ejemplo n.º 1
0
	def selectServer(self):
		list = []
		if streamplayer:
			list.append(("LT Stream2Dream", "LT Stream2Dream"))
		if vlcServerConfig:
			serverList = vlcServerConfig.getServerlist()
			for x in serverList:
				list.append((x.getName(), x))
		if len(list):
			self.session.openWithCallback(self.serverChosen, ChoiceBox, title="Waehle den Server...", list=list)
Ejemplo n.º 2
0
	def selectServer(self):
		list = []
		if streamplayer:
			list.append(("LT Stream2Dream", "LT Stream2Dream"))
		if vlcServerConfig:
			serverList = vlcServerConfig.getServerlist()
			for x in serverList:
				list.append((x.getName(), x))
		if len(list):
			self.session.openWithCallback(self.serverChosen, ChoiceBox, title="Waehle den Server...", list=list)
	def createVlcServerList(self, loadPath):
		try:
			vlcserverlist = []
			from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
			# Settings change requires running this
			#IDEA: Can the change be detected to avoid unnecessary reloads
			self.vlcServers = vlcServerConfig.getServerlist()
			if self.vlcServers:
				for srv in self.vlcServers:
					srvName = srv.getName()
					emcDebugOut("[EMC_VLC] srvName = " + str(srvName))
					vlcserverlist.append( (os.path.join(loadPath, srvName), srvName, vlcSrv) )
			return vlcserverlist
		except:
			pass
Ejemplo n.º 4
0
	def createVlcServerList(self, loadPath):
		try:
			vlcserverlist = []
			from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
			# Settings change requires running this
			#IDEA: Can the change be detected to avoid unnecessary reloads
			self.vlcServers = vlcServerConfig.getServerlist()
			if self.vlcServers:
				for srv in self.vlcServers:
					srvName = srv.getName()
					emcDebugOut("[EMC_VLC] srvName = " + str(srvName))
					vlcserverlist.append( (os.path.join(loadPath, srvName), srvName, vlcSrv) )
			return vlcserverlist
		except:
			pass
Ejemplo n.º 5
0
 def reloadVlcServers(self):
     try:
         from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
         self.vlcServers = vlcServerConfig.getServerlist(
         )  # settings change requires running this
         self.list = []
         sref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" +
                                  "..")  # dummy ref
         self.list.append((sref, None, None, None, "..", None))
         for srv in self.vlcServers:
             srvName = srv.getName()
             sref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" +
                                      srvName)  # dummy ref
             self.list.append((sref, "VLCd", None, None, srvName, None))
         self.list.sort(key=lambda x: x[1], reverse=False)
         self.l.setList(self.list)
     except:
         pass
Ejemplo n.º 6
0
	def updateServerlist(self):
		#self.serverlist.update(self.vlcServerConfig.getServerlist())
		self.serverlist.update(vlcServerConfig.getServerlist(), vlcServerConfig.getDefaultServer())
Ejemplo n.º 7
0
    def okClicked(self):

        idx = self["list"].getSelectionIndex()
        print("idx", idx)
        if idx == 0:
            self.play()
        elif idx == 1:
            try:
                from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
                self.serverList = vlcServerConfig.getServerlist()
                if len(self.serverList) == 0:
                    self.session.open(
                        MessageBox,
                        "No server configured in VlcPlayer Plugin!",
                        MessageBox.TYPE_ERROR)
                elif len(self.serverList) == 1:
                    self.playfile(0)
                else:
                    self.playfile(0)
            except:
                txt = _(
                    "Plugin VlcPlayer is not installed.\nPlease install it and set it up."
                )
                self.session.open(MessageBox,
                                  "Plugin VlcPlayer is not installed!",
                                  MessageBox.TYPE_ERROR)

        elif idx == 2:  ##mfaraj2608 to new way to download videos
            print("In Playvid Download")
            if "#header#" in self.url:
                self.svfile, self.filetitle = self.getlocal_filename()
                cmd1 = "rm " + self.svfile
                os.system(cmd1)
                n1 = self.url.find("#header#", 0)
                header = self.url[(n1 + 8):]
                self.url = self.url[:n1]
                cmd = 'wget -O "' + self.svfile + '" --header="' + header + '" --user-agent="Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36" "' + self.url + '" &'
                print("In Playvid cmd =", cmd)
                os.system(cmd)
                self.icount = 1
                return

            if self.url.startswith("https"):
                self.icount = 1
                self.svfile, self.filetitle = self.getlocal_filename()
                downloadPage(self.url, self.svfile).addErrback(self.showError)

            elif "rtmp" in self.url:
                params = self.url
                print("params A=", params)
                params = "'" + params + "'"
                params = params.replace(" swfVfy=", "' --swfVfy '")
                params = params.replace(" playpath=", "' --playpath '")
                params = params.replace(" app=", "' --app '")
                params = params.replace(" pageUrl=", "' --pageUrl '")
                params = params.replace(" tcUrl=", "' --tcUrl '")
                params = params.replace(" swfUrl=", "' --swfUrl '")
                print("params B=", params)

                self.svfile, self.filetitle = self.getlocal_filename()
                self.urtmp = "rtmpdump -r " + params + " -o '" + self.svfile + "'"
                self["info"].setText(_("Start downloading"))
                self.icount = 1
                cmd = "rm " + self.svfile
                print("rtmp cmd =", cmd)
                os.system(cmd)
                JobManager.AddJob(
                    downloadJob(self, self.urtmp, self.svfile, 'Title 1'))
                self.LastJobView()

            elif "plugin://plugin.video.youtube" in self.url or "youtube.com/" in self.url:
                from tube_resolver.plugin import getvideo
                self.url, error = getvideo(self.url)
                print("Here in Playvid youtube self.url =", self.url)
                if error is not None or self.url is None:
                    print("failed to get valid youtube stream link")
                    return
                self.svfile, self.filetitle = self.getlocal_filename()
                startdownload(self.session,
                              answer='download',
                              myurl=self.url,
                              filename=self.svfile,
                              title=self.filetitle)

            else:
                self.svfile, self.filetitle = self.getlocal_filename()
                startdownload(self.session,
                              answer='download',
                              myurl=self.url,
                              filename=self.svfile,
                              title=self.filetitle)

        elif idx == 3:
            self.stopDL()

        elif idx == 4:
            print('add to favorite')
            from favorites import addfavorite
            import sys

            try:
                addon_id = os.path.split(os.path.split(sys.argv[0])[0])[1]
                print("470add_id", addon_id)
                result = addfavorite(addon_id, self.name, self.url)
            except:
                result = False
            if result == False:
                print("failed to add to favorites")
                self.session.open(MessageBox,
                                  _("Failed to add to favorites."),
                                  MessageBox.TYPE_ERROR,
                                  timeout=4)
            else:
                print("added to favorites")
                self.session.open(MessageBox,
                                  _("Item added successfully to favorites."),
                                  MessageBox.TYPE_INFO,
                                  timeout=4)

        elif idx == 5:
            try:
                error = stream2bouquet(self.url, self.name,
                                       'XBMCAddons_streams')
            except:
                error = (_("Failed to add stream to bouquet"))
            if error == 'none':
                self.session.open(
                    MessageBox,
                    _((_('Stream added to ')) + 'XBMCAddons_streams ' +
                      (_('bouquet\nrestart enigma to refresh bouquets'))),
                    MessageBox.TYPE_INFO,
                    timeout=10)
            else:
                self.session.open(MessageBox,
                                  _("Failed to add stream to bouquet."),
                                  MessageBox.TYPE_ERROR,
                                  timeout=4)
        elif idx == 6:
            from XBMCAddonsMediaExplorer import XBMCAddonsMediaExplorer
            self.session.open(XBMCAddonsMediaExplorer)
Ejemplo n.º 8
0
	def updateServerlist(self):
		#self.serverlist.update(self.vlcServerConfig.getServerlist())
		self.serverlist.update(vlcServerConfig.getServerlist(), vlcServerConfig.getDefaultServer())