Exemplo n.º 1
0
 def gui_webui_halt_download(self,d2halt,stop=False):
     """ Called when user has decided to stop or remove a specific DL via webUI.
     For stop the Download is not removed. """
     if d2halt in self.dusers:
         try:
             duser = self.dusers[d2halt]
             olduic = duser['uic'] 
             if olduic is not None:
                 print >>sys.stderr,time.asctime(),'-', "bg: gui_webui_halt_download: Oops, someone interested, removing anyway"
                 olduic.shutdown()
             if 'streaminfo' in duser:
                 # Download was already playing, clean up.
                 stream = duser['streaminfo']['stream']
                 stream.close() # Close original stream.
         finally: 
             del self.dusers[d2halt]
     if stop:
         BaseApp.stop_playing_download(self,d2halt)
     else:
         BaseApp.remove_playing_download(self,d2halt)