def SvcDoRun(self): import sys, os p = os.path.dirname(__file__) f = open(os.path.join(p, 'log.txt'), 'w') sys.stdout = f sys.stderr = f port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) for section, settings in config.getShares(): httpd.add_container(section, settings) b = beacon.Beacon() b.add_service('TiVoMediaServer:' + str(port) + '/http') b.start() while 1: sys.stdout.flush() (rx, tx, er) = select.select((httpd, ), (), (), 5) for sck in rx: sck.handle_request() rc = win32event.WaitForSingleObject(self.stop_event, 5) if rc == win32event.WAIT_OBJECT_0: b.stop() break
def setup(in_service=False): config.init(sys.argv[1:]) config.init_logging() sys.excepthook = exceptionLogger port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) logger = logging.getLogger('pyTivo') logger.info('Last modified: ' + last_date()) logger.info('Python: ' + platform.python_version()) logger.info('System: ' + platform.platform()) for section, settings in config.getShares(): httpd.add_container(section, settings) b = beacon.Beacon() b.add_service('TiVoMediaServer:%s/http' % port) b.start() if 'listen' in config.getBeaconAddresses(): b.listen() httpd.set_beacon(b) httpd.set_service_status(in_service) logger.info('pyTivo is ready.') return httpd
def setup(in_service=False): config.init(sys.argv[1:], in_service) config.init_logging() sys.excepthook = exceptionLogger port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) logger = logging.getLogger('pyTivo') logger.info('Last modified: ' + last_date()) logger.info('Python: ' + platform.python_version()) logger.info('System: ' + platform.platform()) for section, settings in config.getShares(): httpd.add_container(section, settings) b = beacon.Beacon() b.add_service('TiVoMediaServer:%s/http' % port) b.start() if 'listen' in config.getBeaconAddresses(): b.listen() httpd.set_beacon(b) httpd.set_service_status(in_service) logger.info('pyTivo is ready.') return httpd
def SvcDoRun(self): config.init([]) config.init_logging() p = os.path.dirname(__file__) f = open(os.path.join(p, 'log.txt'), 'w') sys.stdout = f sys.stderr = f port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) for section, settings in config.getShares(): httpd.add_container(section, settings) b = beacon.Beacon() b.add_service('TiVoMediaServer:%s/http' % port) b.start() if 'listen' in config.getBeaconAddresses(): b.listen() httpd.set_beacon(b) while 1: sys.stdout.flush() (rx, tx, er) = select.select((httpd,), (), (), 5) for sck in rx: sck.handle_request() rc = win32event.WaitForSingleObject(self.stop_event, 5) if rc == win32event.WAIT_OBJECT_0: b.stop() break
def push_one_file(self, f): file_info = VideoDetails() file_info['valid'] = transcode.supported_format(f['path']) temp_share = config.get_server('temp_share', '') temp_share_path = '' if temp_share: for name, data in config.getShares(): if temp_share == name: temp_share_path = data.get('path') mime = 'video/mpeg' if config.isHDtivo(f['tsn']): for m in ['video/mp4', 'video/bif']: if transcode.tivo_compatible(f['path'], f['tsn'], m)[0]: mime = m break if (mime == 'video/mpeg' and transcode.mp4_remuxable(f['path'], f['tsn'])): new_path = transcode.mp4_remux(f['path'], f['name'], f['tsn'], temp_share_path) if new_path: mime = 'video/mp4' f['name'] = new_path if temp_share_path: ip = config.get_ip() port = config.getPort() container = quote(temp_share) + '/' f['url'] = 'http://%s:%s/%s' % (ip, port, container) if file_info['valid']: file_info.update(self.metadata_full(f['path'], f['tsn'], mime)) url = f['url'] + quote(f['name']) title = file_info['seriesTitle'] if not title: title = file_info['title'] source = file_info['seriesId'] if not source: source = title subtitle = file_info['episodeTitle'] try: m = mind.getMind(f['tsn']) m.pushVideo( tsn = f['tsn'], url = url, description = file_info['description'], duration = file_info['duration'] / 1000, size = file_info['size'], title = title, subtitle = subtitle, source = source, mime = mime, tvrating = file_info['tvRating']) except Exception, msg: logger.error(msg)
def __init__(self, countryName, cityName, serverAddress): self._timeout = config.getTimeout() self._port = config.getPort() self._countryName = countryName self._cityName = cityName self._serverAddress = serverAddress self._actionNotification = ActionNotification() self._actionNotification.start()
def __init__(self): self.handlerH = HandlerHeaders.HandlerHeaders() self.handlerS = HandlerStatusCode.HandlerStatusCode() self.handlerR = HandlerRequest.HandlerRequest(self.handlerH, self.handlerS) self.HOST = config.getHost() self.DIR = config.getDir() self.PORT = config.getPort() self.BUFSIZE = config.getBufSize()
def sendRequest(self): self.setBody() url = config.getHostname() + ":" + config.getPort() + self.path r = requests.request(method=self.method, url=url, headers=self.header, json=self.body) self.statusCode = r.status_code self.responseHeaders = r.headers self.responseBody = r.json()
def Push(self, handler, query): try: tsn = query['tsn'][0] except: logger.error('Push requires a TiVo Service Number') handler.send_error(404) return if not tsn in config.tivos: for key, value in config.tivos.items(): if value.get('name') == tsn: tsn = key break try: tivo_name = config.tivos[tsn]['name'] except: tivo_name = tsn container = quote(query['Container'][0].split('/')[0]) ip = config.get_ip(tsn) port = config.getPort() baseurl = 'http://%s:%s/%s' % (ip, port, container) if config.getIsExternal(tsn): exturl = config.get_server('externalurl') if exturl: if not exturl.endswith('/'): exturl += '/' baseurl = exturl + container else: ip = self.readip() baseurl = 'http://%s:%s/%s' % (ip, port, container) path = self.get_local_base_path(handler, query) files = query.get('File', []) for f in files: file_path = os.path.normpath(path + '/' + f) queue.append({ 'path': file_path, 'name': f, 'tsn': tsn, 'url': baseurl }) if len(queue) == 1: thread.start_new_thread(Video.process_queue, (self, )) logger.info('[%s] Queued "%s" for Push to %s' % (time.strftime('%d/%b/%Y %H:%M:%S'), unicode(file_path, 'utf-8'), tivo_name)) files = [unicode(f, 'utf-8') for f in files] handler.redir(PUSHED % (tivo_name, '<br>'.join(files)), 5)
def __init__(self, countryName, cityName, serverAddress, custom): self._timeout = config.getTimeout() self._port = config.getPort() self._countryName = countryName self._cityName = cityName self._serverAddress = serverAddress self._actionNotification = ActionNotification() self._actionNotification.start() self._hardcodedServerAddress = False self._isCustom = custom if self._usingDathoFreeServers(): gui.DialogOK("Using datho free servers", '', '')
def processDlRequest(self): while True: data = self.work_queue.get() for share_name, settings in config.getShares(): if settings['type'] == 'webvideo': break self.__logger.debug('Processing request: %s' % data) path = settings['path'] file_name = os.path.join(path, '%s-%s' % (data['bodyOfferId'].replace(':', '-'), data['url'].split('/')[-1])) status = self.downloadFile(data['url'], file_name) mime = 'video/mpeg' if status: tsn = data['bodyId'][4:] file_info = VideoDetails() if config.isHDtivo(tsn): for m in ['video/mp4', 'video/bif']: if tivo_compatible(file_name, tsn, m)[0]: mime = m break file_info.update(self.metadata_full(file_name, tsn, mime)) ip = config.get_ip() port = config.getPort() data['url'] = ('http://%s:%s' % (ip, port) + urllib.quote('/%s/%s' % (share_name, os.path.basename(file_name)))) data['duration'] = file_info['duration'] / 1000 data['size'] = file_info['size'] self.__logger.debug('Complete request: %s' % data) m = mind.getMind() m.completeDownloadRequest(data, status, mime) self.in_progress_lock.acquire() try: del self.in_progress[data['bodyOfferId']] finally: self.in_progress_lock.release()
def Push(self, handler, query): try: tsn = query['tsn'][0] except: logger.error('Push requires a TiVo Service Number') handler.send_error(404) return if not tsn in config.tivos: for key, value in config.tivos.items(): if value.get('name') == tsn: tsn = key break try: tivo_name = config.tivos[tsn]['name'] except: tivo_name = tsn container = quote(query['Container'][0].split('/')[0]) ip = config.get_ip(tsn) port = config.getPort() baseurl = 'http://%s:%s/%s' % (ip, port, container) if config.getIsExternal(tsn): exturl = config.get_server('externalurl') if exturl: if not exturl.endswith('/'): exturl += '/' baseurl = exturl + container else: ip = self.readip() baseurl = 'http://%s:%s/%s' % (ip, port, container) path = self.get_local_base_path(handler, query) files = query.get('File', []) for f in files: file_path = os.path.normpath(path + '/' + f) queue.append({'path': file_path, 'name': f, 'tsn': tsn, 'url': baseurl}) if len(queue) == 1: thread.start_new_thread(Video.process_queue, (self,)) logger.info('[%s] Queued "%s" for Push to %s' % (time.strftime('%d/%b/%Y %H:%M:%S'), unicode(file_path, 'utf-8'), tivo_name)) files = [unicode(f, 'utf-8') for f in files] handler.redir(PUSHED % (tivo_name, '<br>'.join(files)), 5)
def setup(in_service=False): config.init(sys.argv[1:]) config.init_logging() sys.excepthook = exceptionLogger port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) logger = logging.getLogger('pyTivo') logger.info('Last modified: ' + last_date()) logger.info('Python: ' + platform.python_version()) logger.info('System: ' + platform.platform()) for section, settings in config.getShares(): httpd.add_container(section, settings) # Precaching of files: does a recursive list of base path if settings.get('precache', 'False').lower() == 'true': plugin = GetPlugin(settings.get('type')) if hasattr(plugin, 'pre_cache'): logger.info('Pre-caching the ' + section + ' share.') pre_cache_filter = getattr(plugin, 'pre_cache') def build_recursive_list(path): try: for f in os.listdir(path): f = os.path.join(path, f) if os.path.isdir(f): build_recursive_list(f) else: pre_cache_filter(f) except: pass build_recursive_list(settings.get('path')) b = beacon.Beacon() b.add_service('TiVoMediaServer:%s/http' % port) b.start() if 'listen' in config.getBeaconAddresses(): b.listen() httpd.set_beacon(b) httpd.set_service_status(in_service) logger.info('pyTivo is ready.') return httpd
def Push(self, handler, query): file = unquote(query['File'][0]) tsn = query['tsn'][0] path = self.get_local_path(handler, query) file_path = path + file file_info = VideoDetails() file_info['valid'] = transcode.supported_format(file_path) if file_info['valid']: file_info.update(self.__metadata_full(file_path, tsn)) import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('tivo.com',123)) ip = s.getsockname()[0] container = quote(query['Container'][0].split('/')[0]) port = config.getPort() url = 'http://%s:%s/%s%s' % (ip, port, container, quote(file)) print 'tsn', tsn print 'url', url print query username = config.getTivoUsername() password = config.getTivoPassword() if not username or not password: raise Exception("tivo_username and tivo_password required") try: m = mind.Mind(username, password, True) m.pushVideo( tsn = tsn, url = url, description = file_info['description'], duration = file_info['duration'] / 1000, size = file_info['size'], title = file_info['title'], subtitle = file_info['name']) except Exception, e: import traceback handler.send_response(500) handler.end_headers() handler.wfile.write('%s\n\n%s' % (e, traceback.format_exc() )) raise
def Push(self, handler, query): file = unquote(query['File'][0]) tsn = query['tsn'][0] path = self.get_local_path(handler, query) file_path = path + file file_info = VideoDetails() file_info['valid'] = transcode.supported_format(file_path) if file_info['valid']: file_info.update(self.__metadata_full(file_path, tsn)) import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('tivo.com', 123)) ip = s.getsockname()[0] container = quote(query['Container'][0].split('/')[0]) port = config.getPort() url = 'http://%s:%s/%s%s' % (ip, port, container, quote(file)) print 'tsn', tsn print 'url', url print query username = config.getTivoUsername() password = config.getTivoPassword() if not username or not password: raise Exception("tivo_username and tivo_password required") try: m = mind.Mind(username, password, True) m.pushVideo(tsn=tsn, url=url, description=file_info['description'], duration=file_info['duration'] / 1000, size=file_info['size'], title=file_info['title'], subtitle=file_info['name']) except Exception, e: import traceback handler.send_response(500) handler.end_headers() handler.wfile.write('%s\n\n%s' % (e, traceback.format_exc())) raise
def setup(in_service=False): config.init(sys.argv[1:]) config.init_logging() sys.excepthook = exceptionLogger port = config.getPort() httpd = httpserver.TivoHTTPServer(("", int(port)), httpserver.TivoHTTPHandler) logger = logging.getLogger("pyTivo") for section, settings in config.getShares(): httpd.add_container(section, settings) # Precaching of files: does a recursive list of base path if settings.get("precache", "False").lower() == "true": plugin = GetPlugin(settings.get("type")) if hasattr(plugin, "pre_cache"): logger.info("Pre-caching the " + section + " share.") pre_cache_filter = getattr(plugin, "pre_cache") def build_recursive_list(path): try: for f in os.listdir(path): f = os.path.join(path, f) if os.path.isdir(f): build_recursive_list(f) else: pre_cache_filter(f) except: pass build_recursive_list(settings.get("path")) b = beacon.Beacon() b.add_service("TiVoMediaServer:%s/http" % port) b.start() if "listen" in config.getBeaconAddresses(): b.listen() httpd.set_beacon(b) httpd.set_service_status(in_service) logger.info("pyTivo is ready.") return httpd
def Push(self, handler, query): tsn = query['tsn'][0] for key in config.tivo_names: if config.tivo_names[key] == tsn: tsn = key break tivo_name = config.tivo_names.get(tsn, tsn) container = quote(query['Container'][0].split('/')[0]) ip = config.get_ip(tsn) port = config.getPort() baseurl = 'http://%s:%s/%s' % (ip, port, container) if config.getIsExternal(tsn): exturl = config.get_server('externalurl') if exturl: baseurl = exturl else: ip = self.readip() baseurl = 'http://%s:%s/%s' % (ip, port, container) path = self.get_local_base_path(handler, query) files = query.get('File', []) for f in files: file_path = path + os.path.normpath(f) queue.append({ 'path': file_path, 'name': f, 'tsn': tsn, 'url': baseurl }) if len(queue) == 1: thread.start_new_thread(Video.process_queue, (self, )) logger.info('[%s] Queued "%s" for Push to %s' % (time.strftime('%d/%b/%Y %H:%M:%S'), unicode(file_path, 'utf-8'), tivo_name)) files = [unicode(f, 'utf-8') for f in files] handler.redir(PUSHED % (tivo_name, '<br>'.join(files)), 5)
def Push(self, handler, query): tsn = query['tsn'][0] for key in config.tivo_names: if config.tivo_names[key] == tsn: tsn = key break tivo_name = config.tivo_names.get(tsn, tsn) container = quote(query['Container'][0].split('/')[0]) ip = config.get_ip(tsn) port = config.getPort() baseurl = 'http://%s:%s/%s' % (ip, port, container) if config.getIsExternal(tsn): exturl = config.get_server('externalurl') if exturl: if not exturl.endswith('/'): exturl += '/' baseurl = exturl + container else: ip = self.readip() baseurl = 'http://%s:%s/%s' % (ip, port, container) path = self.get_local_base_path(handler, query) files = query.get('File', []) for f in files: file_path = path + os.path.normpath(f) queue.append({'path': file_path, 'name': f, 'tsn': tsn, 'url': baseurl}) if len(queue) == 1: thread.start_new_thread(Video.process_queue, (self,)) logger.info('[%s] Queued "%s" for Push to %s' % (time.strftime('%d/%b/%Y %H:%M:%S'), unicode(file_path, 'utf-8'), tivo_name)) files = [unicode(f, 'utf-8') for f in files] handler.redir(PUSHED % (tivo_name, '<br>'.join(files)), 5)
def Push(self, handler, query): tsn = query["tsn"][0] for key in config.tivo_names: if config.tivo_names[key] == tsn: tsn = key break tivo_name = config.tivo_names.get(tsn, tsn) container = quote(query["Container"][0].split("/")[0]) ip = config.get_ip(tsn) port = config.getPort() baseurl = "http://%s:%s/%s" % (ip, port, container) if config.getIsExternal(tsn): exturl = config.get_server("externalurl") if exturl: if not exturl.endswith("/"): exturl += "/" baseurl = exturl + container else: ip = self.readip() baseurl = "http://%s:%s/%s" % (ip, port, container) path = self.get_local_base_path(handler, query) files = query.get("File", []) for f in files: file_path = path + os.path.normpath(f) queue.append({"path": file_path, "name": f, "tsn": tsn, "url": baseurl}) if len(queue) == 1: thread.start_new_thread(Video.process_queue, (self,)) logger.info( '[%s] Queued "%s" for Push to %s' % (time.strftime("%d/%b/%Y %H:%M:%S"), unicode(file_path, "utf-8"), tivo_name) ) files = [unicode(f, "utf-8") for f in files] handler.redir(PUSHED % (tivo_name, "<br>".join(files)), 5)
def push_one_file(self, f): file_info = VideoDetails() file_info['valid'] = transcode.supported_format(f['path']) temp_share = config.get_server('temp_share', '') temp_share_path = '' remux_path = os.path.dirname(f['path']) if temp_share: for name, data in config.getShares(): if temp_share == name: temp_share_path = data.get('path') remux_path = temp_share_path mime = 'video/mpeg' if config.isHDtivo(f['tsn']): for m in ['video/mp4', 'video/bif']: if transcode.tivo_compatible(f['path'], f['tsn'], m)[0]: mime = m break if (mime == 'video/mpeg' and transcode.mp4_remuxable(f['path'], f['tsn'])): if config.get_freeSpace(remux_path, f['path']): new_path = transcode.mp4_remux(f['path'], f['name'], f['tsn'], temp_share_path) if new_path: mime = 'video/mp4' f['name'] = new_path if temp_share_path: ip = config.get_ip() port = config.getPort() container = quote(temp_share) + '/' f['url'] = 'http://%s:%s/%s' % (ip, port, container) else: logger.warning('Not enough disk space to perform remux, ' + 'transcoding instead.') if file_info['valid']: file_info.update(self.metadata_full(f['path'], f['tsn'], mime)) url = f['url'] + quote(f['name']) title = file_info['seriesTitle'] if not title: title = file_info['title'] source = file_info['seriesId'] if not source: source = title subtitle = file_info['episodeTitle'] try: m = mind.getMind(f['tsn']) m.pushVideo( tsn = f['tsn'], url = url, description = file_info['description'], duration = file_info['duration'] / 1000, size = file_info['size'], title = title, subtitle = subtitle, source = source, mime = mime, tvrating = file_info['tvRating']) except ValueError, msg: if 'usernamePasswordError' in msg: if f['name'].endswith('.pyTivo-temp'): fname = os.path.join(remux_path, os.path.basename(f['name'])) fname = unicode(fname, 'utf-8') os.remove(fname) logger.debug(fname + ' has been removed')
#!/usr/bin/env python import beacon, httpserver, os, sys import config from plugin import GetPlugin port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) for section, settings in config.getShares(): httpd.add_container(section, settings) # Precaching of files: does a recursive list of base path if settings.get('precache', 'False').lower() == 'true': plugin = GetPlugin(settings.get('type')) if hasattr(plugin, 'pre_cache'): print 'Pre-caching the', section, 'share.' pre_cache_filter = getattr(plugin, 'pre_cache') def build_recursive_list(path): try: for f in os.listdir(path): f = os.path.join(path, f) if os.path.isdir(f): build_recursive_list(f) else: pre_cache_filter(f) except: pass build_recursive_list(settings.get('path'))
def __init__(self, window): def send(): getMsg.delete(1.0, END) print("发送数据" + ipcom.get() + ":" + portcom.get()) response = tcp.tcpSend(ipcom.get(),portcom.get(),encom.get(),setMsg.get()) getMsg.insert(1.0, response) #IP框 ipVariable = tk.StringVar() #创建下拉菜单 ipcom = ttk.Combobox(window, textvariable=ipVariable) ipcom.pack() #给下拉菜单设定值 ipcom["value"] = config.getIp() #下拉菜单的默认值 ipcom.current(0) def ipFunc(event): #print(ipcom.get()) # #获取选中的值方法1 print(ipVariable.get()) # #获取选中的值方法2 #给下拉菜单绑定事件 ipcom.bind("<<ComboboxSelected>>", ipFunc) #端口框 portVariable = tk.StringVar() portcom = ttk.Combobox(window, textvariable=portVariable) portcom.pack() portcom["value"] = config.getPort() portcom.current(0) def xFunc(event): print(portVariable.get()) portcom.bind("<<ComboboxSelected>>", xFunc) #编码框 enVariable = tk.StringVar() encom = ttk.Combobox(window, textvariable=enVariable) encom.pack() encom["value"] = ["utf8", "gbk", "base64"] encom.current(0) def enFunc(event): print(enVariable.get()) encom.bind("<<ComboboxSelected>>", enFunc) #发送框 setMsg = Entry(window,justify=LEFT,width=1000) setMsg.pack(padx=10, pady=10) setMsg.delete(0, END) setMsg.insert(0, "") frame = tk.Frame(window) frame.pack() '''self.openBU = tk.Button(frame, text="建立连接", fg="blue", command=open,width=6,height=1) self.openBU.pack(side=tk.LEFT) self.closeBU = tk.Button(frame, text="关闭连接", fg="blue", command=close,width=6,height=1) self.closeBU.pack(side=tk.LEFT)''' self.sendBU = tk.Button(frame, text="发送", fg="blue", command=send,width=6,height=1) self.sendBU.pack(side=tk.LEFT) #接收框 getMsg = Text(window, width=1000,height=1000) getMsg.pack(padx=10, pady=10) #1行0列-末尾 getMsg.delete(1.0, END)
def currentPort(self): return config.getPort()
sys.exit(1) import beacon import config import httpserver from plugin import GetPlugin def exceptionLogger(*args): sys.excepthook = sys.__excepthook__ logging.getLogger('pyTivo').error('Exception in pyTivo', exc_info=args) config.init(sys.argv[1:]) config.init_logging() sys.excepthook = exceptionLogger port = config.getPort() httpd = httpserver.TivoHTTPServer(('', int(port)), httpserver.TivoHTTPHandler) logger = logging.getLogger('pyTivo') for section, settings in config.getShares(): httpd.add_container(section, settings) # Precaching of files: does a recursive list of base path if settings.get('precache', 'False').lower() == 'true': plugin = GetPlugin(settings.get('type')) if hasattr(plugin, 'pre_cache'): logger.info('Pre-caching the ' + section + ' share.') pre_cache_filter = getattr(plugin, 'pre_cache') def build_recursive_list(path):
def Push(self, handler, query): tsn = query['tsn'][0] for key in config.tivo_names: if config.tivo_names[key] == tsn: tsn = key break tivo_name = config.tivo_names.get(tsn, tsn) container = quote(query['Container'][0].split('/')[0]) ip = config.get_ip() port = config.getPort() baseurl = 'http://%s:%s' % (ip, port) if config.getIsExternal(tsn): exturl = config.get_server('externalurl') if exturl: baseurl = exturl else: ip = self.readip() baseurl = 'http://%s:%s' % (ip, port) path = self.get_local_base_path(handler, query) files = query.get('File', []) for f in files: file_path = path + os.path.normpath(f) file_info = VideoDetails() file_info['valid'] = transcode.supported_format(file_path) mime = 'video/mpeg' if config.isHDtivo(tsn): for m in ['video/mp4', 'video/bif']: if transcode.tivo_compatible(file_path, tsn, m)[0]: mime = m break if file_info['valid']: file_info.update(self.metadata_full(file_path, tsn, mime)) url = baseurl + '/%s%s' % (container, quote(f)) title = file_info['seriesTitle'] if not title: title = file_info['title'] source = file_info['seriesId'] if not source: source = title subtitle = file_info['episodeTitle'] try: m = mind.getMind(tsn) m.pushVideo( tsn = tsn, url = url, description = file_info['description'], duration = file_info['duration'] / 1000, size = file_info['size'], title = title, subtitle = subtitle, source = source, mime = mime, tvrating = file_info['tvRating']) except Exception, e: handler.send_response(500) handler.end_headers() handler.wfile.write('%s\n\n%s' % (e, traceback.format_exc() )) raise logger.info('[%s] Queued "%s" for Push to %s' % (time.strftime('%d/%b/%Y %H:%M:%S'), unicode(file_path, 'utf-8'), tivo_name))