예제 #1
0
 def _refresh_cache(self, type, progress):
     self.log.write("Refreshing %s cache..." % type)
     proc = subprocess.Popen(
         "get_iplayer " + "--refresh " +  # Force update of cache
         "--type=%s " % type + "--quiet",
         shell=True,
         stdout=subprocess.PIPE)
     while proc.poll() == None:
         progress.Pulse()
         time.sleep(0.04)
예제 #2
0
    def start(self, cmd):
        self.cancel()
        self._cmd = cmd
        self._process_data = ""
        self.download_chunks = []
        self.error_message = None

        try:
            self._process = subprocess.Popen(cmd,
                                             shell=True,
                                             stdout=subprocess.PIPE,
                                             stderr=subprocess.STDOUT)

        except OSError, inst:
            self.error_message = ("Could not execute %s (%s) " %
                                  (cmd[0], str(inst)))
            self._on_finished()
예제 #3
0
 def run(self):
     subproc = asub.Popen(["python", "pymodules/apitest/chessview/pychessview.py"], stdout=PIPE)
     print "chess runner started from Naali SubprocessCommunicator", os.getpid()
     time.sleep(0.1) #a little time for the process to start
 
     while 1:
         time.sleep(0.1) #10fps ought to be well enough for chess moves!
         dead = subproc.poll()
         if dead is not None:
             #print "ChessViewControl: asubproc died"
             print "_",
             continue
         rec = asub.recv_some(subproc)
         #rec = subproc.communicate()
         #print "REC:", rec
         if rec:
             self.push(circuits.Event(rec), "rec")
예제 #4
0
    def _download_start(self, episode):
        episode.download_state = self.DOWNLOAD_RUNNING
        cmd = (self.settings.config.get_iplayer_cmd + " " +
               "--force-download " + "--vmode=iphone " +
               "--vmode=flashvhigh,flashhigh,iphone,flashnormal " +
               "--file-prefix \"<name> <pid> <episode>\" " +
               "--output %s " % self.settings.config.download_dir +
               "--pid %s" % episode.pid)

        try:
            process = subprocess.Popen(cmd,
                                       shell=True,
                                       stdout=subprocess.PIPE,
                                       stderr=subprocess.STDOUT)
            self._processes.append((episode, process))

        except OSError, inst:
            episode.error_message = ("Could not execute get_iplayer " +
                                     "(%s)" % str(inst))
            self._on_process_ended(episode)
예제 #5
0
    def refresh(self):
        """ Start get_iplayer process to refresh the cache """
        self.error_message = None
        self.is_refreshing = True

        # Temp to disable cache refresh
        #         self._on_process_ended()
        #         return

        cmd = (
            self.settings.config.get_iplayer_cmd + " " +
            "--refresh " +  # Force update of cache
            "--nopurge " +  # Prevent old episode deletion prompt
            "--type=%s " % self.code)
        try:
            self._process = subprocess.Popen(cmd,
                                             shell=True,
                                             stdout=subprocess.PIPE,
                                             stderr=subprocess.STDOUT)
        except OSError, inst:
            self._on_process_error("Could not start get_iplayer.")
            raise
예제 #6
0
    def download(self, item):
        episode = self.episodes[item]
        self.SetStringItem(item, self.COL_STATUS, "Downloading")
        self.current_item = item
        self.log.write("Downloading episode %s..." % episode.pid)
        cmd = ("get_iplayer " + "--force-download " + "--vmode=iphone " +
               "--vmode=flashvhigh,flashhigh,iphone,flashnormal " +
               "--file-prefix \"<name> <availabledate> <episode> <pid>\" " +
               "--output %s " % self.iplayer.download_dir +
               "--pid %s" % episode.pid)

        try:
            self.process = subprocess.Popen(cmd,
                                            shell=True,
                                            stdout=subprocess.PIPE,
                                            stderr=subprocess.STDOUT)
        except OSError, inst:
            episode.error = True
            episode.error_message = ("Could not execute get_iplayer " +
                                     "(%s)" % str(inst))
            self.log.error(error_message)
            self._on_process_ended()
            return