5

I have a function that downloads videos from specific URLs and I launch this function through a thread to avoid GUI freezing, but I want a function to stop or pause the download. How to do this? Here is the code:

def download_videos(self):
     ydl1 = youtube_dl.YoutubeDL(self.get_opts())
     if self.get_Urls().__len__() > 0:
         ydl1.download(self.get_Urls())

def downloadVideoThrd(self):
    self.t1 = threading.Thread(target=self.download_videos())
    self.t1.start()
pppery
  • 3,550
  • 19
  • 28
  • 41
zafer
  • 59
  • 4
  • These might be of interest to you: https://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread, https://stackoverflow.com/questions/6524459/stopping-a-thread-after-a-certain-amount-of-time, – SuperShoot Nov 15 '18 at 08:28

0 Answers0