def get(self, action, content): BaseRequestHandler.get(self) if action not in ('start', 'stop', 'status'): self.set_status(400) self.finish() return self.channel = None if content != None: self.channel = self.find_channel(content.strip('/')) if self.channel == None and action != "status": self.set_status(404) self.finish() return if action == 'start': ProxyRequestHandler.get(self, None, self.channel.id) return if action == 'stop': self.ace = AceClient.get_cached(self.channel.url) if self.ace != None: self.ace.close() self.vlc.send_command("control %s pause\r\ndel %s\r\nshow" % (self.channel.id, self.channel.id), callback=self._on_vlc_data) return if action == 'status': self.vlc.send_command("show", callback=self._on_vlc_data) return pass
def initialize(self, request, response): BaseRequestHandler.initialize(self,request, response) m_pages=Entry.all().filter('entrytype =','page')\ .filter('published =',True)\ .filter('entry_parent =',0)\ .order('menu_order') blogroll=Link.all().filter('linktype =','blogroll') archives=Archive.all().order('-year').order('-month').fetch(12) alltags=Tag.all() self.template_vals.update({ 'menu_pages':m_pages, 'categories':Category.all(), 'blogroll':blogroll, 'archives':archives, 'alltags':alltags, 'recent_comments':Comment.all().order('-date').fetch(5) })
def get(self, action): BaseRequestHandler.get(self) result = {} if action=='refresh': if ManageRequestHandler.future != None and not ManageRequestHandler.future.done(): result['state'] = 'task already running' else: ManageRequestHandler.future = self.refresh_playlists() result['state'] = 'scheduled' self.set_status(200) self.write( json.dumps( result ) ) self.finish() return self.set_status(400) self.finish()
def get(self, mode, content_id): BaseRequestHandler.get(self) self.closing = False self.ace = None self.ace_timeout_id = None self.http = None self.size = 0 self.channel = self.find_channel(content_id) if self.channel == None: self.set_status(404) self.finish() return self.content_id = self.channel.url if self.content_id.startswith("udp://"): url = self.content_id.replace("udp://@", "/udp/") self.on_video_ready(None, url) #self.redirect( url ) else: self.ace = AceClient.get_cached(self.content_id) if self.ace == None: ace_address = (self.config.ace.split(":")[0], int(self.config.ace.split(":")[1]) if len(self.config.ace.split(":")) > 1 else 62062) self.ace = AceClient( ace_address, on_ready=self.on_ace_ready, on_close=self.on_ace_timeout, cache_timeout=self.config.timeouts['ace_cache'], logger=self.logger) self._set_timeout(self.config.timeouts['ace_init']) else: self.ace.on_ready = self.on_ace_ready self.ace.on_close = self.on_ace_timeout self.ace.on_video = self.on_video_ready self.ace.on_stop = self.on_ace_timeout if self.ace.state == AceClient.STATE_RUNNING: self.on_video_ready(self.ace, self.ace.video_url) else: self._set_timeout(self.config.timeouts['ace_ready'])
def get(self, name): name = name.strip('/') if name != None else '' BaseRequestHandler.get(self) self.logger.debug("Searching %s", name) result = self.manager.find_channel(name, False) uniq = [] self.set_status(200) if self.get_argument('json', None) != None: self.set_header('Content-Type', 'application/json') response = [] for item in result: if item.id not in uniq: uniq.append(item.id) response.append({ 'id': item.id, 'name': item.name, 'tags': item.tags, 'hd': item.hd, 'url': item.url, 'logo': item.logo }) self.write(json.dumps(response)) else: self.set_header('Content-Type', 'audio/x-mpegurl') self.set_header('Content-Disposition', 'attachment; filename="' + name + '.m3u"') self.write( "#EXTM3U url-tvg=\"http://www.teleguide.info/download/new3/jtv.zip\"\r\n" ) url = "%s://%s" % (self.request.protocol, self.request.host) for item in result: if item.id not in uniq: uniq.append(item.id) self.write( "#EXTINF:-1 group-title=\"%s\" tvg-name=\"%s\", %s\r\n" % (",".join(item.tags), item.name, item.name)) self.write("%s/channel/uuid/%s\r\n" % (url, item.id)) self.finish()
def __init__(self): BaseRequestHandler.__init__(self) self.current="config" self.sbody=OptionSet.getValue('sys_plugin_sbody',SBODY) self.bbody=OptionSet.getValue('sys_plugin_bbody',BBODY)
def __init__(self): BaseRequestHandler.__init__(self) self.current = "config" self.sbody = OptionSet.getValue('eric_plugin_sbody', SBODY) self.bbody = OptionSet.getValue('eric_plugin_bbody', BBODY)
def initialize(self, request): BaseRequestHandler.initialize(self,request)
def __init__(self): BaseRequestHandler.__init__(self)
def __init__(self): BaseRequestHandler.__init__(self) self.token = WEIXIN_TOKEN