示例#1
0
 def _ready(self):
     while True:
         line = self._readline(_START_TIMEOUT)
         if line.startswith('have a nice day'):
             raise ProcessException("omxplayer failed to start")
         elif line.startswith('Vcodec id unknown:'):
             raise ProcessException("Unsupported video codec")
         elif "Metadata:" in line:
             break
         elif "Duration:" in line:
             break
示例#2
0
 def _ready(self):
     while True:
         line = self._readline()
         if line.startswith('Bad Response'):
             raise ProcessException(line)
         # Get this error if site down/blocked
         # html page instead of torrent
         elif line.startswith('not a colon at'):
             raise ProcessException("Unable to retrieve torrent")
         elif line.startswith('server is listening'):
             self.args['outfile'] = 'http://127.0.0.1:' + _PEERFLIX_PORT
             return self.args
示例#3
0
 def _ready(self):
     while True:
         line = self._readline()
         if line.startswith("{"):
             obj = json.loads(line)
             if 'filename' in obj:
                 self.subsfile = obj['filename']
                 return {'subtitles': self.subsfile}
             elif 'error' in obj:
                 raise ProcessException(obj['error'])
             else:
                 raise ProcessException('No subtitles found')
         else:
             raise ProcessException('Subtitles died')
示例#4
0
 def _ready(self):
     while True:
         line = self._readline()
         if line.startswith("Listening"):
             return self.args
         else:
             raise ProcessException(line)
示例#5
0
 def _ready(self):
     while True:
         line = self._readline()
         if line.startswith("Listening"):
             self.args['outfile'] = 'http://127.0.0.1:' + _DLSRV_PORT
             return self.args
         else:
             raise ProcessException(line)
示例#6
0
 def _ready(self):
     while True:
         #line = self._readline(self._START_TIMEOUT)
         # Twitch with timeout does not work for me
         line = self._readline()
         if line.startswith('error: No streams found on this URL'):
             raise ProcessException(
                 "No stream currently available at this URL")
         elif "Opening stream: source" in line:
             return {'pid': self.proc.pid, 'outfile': OUT_FILE}
示例#7
0
 def _ready(self):
   self.args['pid'] = self.proc.pid
   while True:
     line = self._readline()
     if line.startswith("[download] Destination:"):
       self.args['outfile'] = OUT_FILE
       return self.args
     elif line.startswith("{"):
       obj = json.loads(line)
       if not 'url' in obj:
         if 'requested_formats' in obj:
           url = obj['requested_formats'][0]['url']
         else:
           raise ProcessException("No URL in YTDL")
       else:
         url = obj['url']
       self.args['outfile'] = url
       return self.args
     elif line.startswith("ERROR:"):
       raise ProcessException(self._get_ytdl_err(line[7:]))
示例#8
0
 def _ready(self):
     #time.sleep(20)
     #os.system(_DBUS_PATH + " status &")
     #line = os.popen(_DBUS_PATH + " status &").read()
     #cherrypy.log("OMXPROCESS: " + line)
     while True:
         #line = self._readline(_START_TIMEOUT)
         time.sleep(3)
         line = os.popen(_DBUS_PATH + " status &").read()
         #cherrypy.log("OMXPROCESS: " + line)
         if line.startswith('have a nice day'):
             raise ProcessException("omxplayer3 failed to start")
         elif "Error" in line:
             raise ProcessException("omxplayer3 failed to start")
             break
         elif line.startswith('Vcodec id unknown:'):
             raise ProcessException("Unsupported video codec")
         elif "Metadata:" in line:
             break
         elif "Duration:" in line:
             break
示例#9
0
 def _ready(self):
     self.args['pid'] = self.proc.pid
     while True:
         line = self._readline()
         if line.startswith("[download] Destination:"):
             self.args['outfile'] = OUT_FILE
             return self.args
         elif line.startswith("{"):
             obj = json.loads(line)
             self.args['outfile'] = obj['url']
             return self.args
         elif line.startswith("ERROR:"):
             raise ProcessException(self._get_ytdl_err(line[7:]))