Пример #1
0
 def downepi(self, episode):
     """ down a show """
     pos = self.visible.posend
     url, dest, cook = links.flvdown(episode, "")
     if url:
         try:
             if (not ospath.isdir(dest.split('/')[0])):
                 osmkdir(dest.split('/')[0])
             cmd = "wget -c " + url + " -O " + dest
             proc = subpopen(cmd, shell=True, stderr=PIPE, stdout=PIPE)
             while proc.poll() is None:
                 line = proc.stderr.readline()
                 resul = down.search(line[:-1])
                 if resul:
                     msg = resul.group(1) + ' ' + resul.group(2) + \
                             ' ' + resul.group(3)
                 self.screen.addstr(pos[0], pos[1]+pos[2], msg)
                 self.screen.refresh()
             subdown.downSub(episode, "")
         except:
             proc.kill()
             self.error(episode.getBaseName() + ': down error')
         else:
             self.error(episode.getBaseName() + ': down finish')
             episode.isOnDisk = True
             self.display()
     else:
         self.error(episode.getBaseName() + ': url not found')