Пример #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:]))