Browse Source

clear_temp_files option now also deletes empty livestream folder

notcammy 7 years ago
parent
commit
7710f49300
1 changed files with 6 additions and 0 deletions
  1. 6 0
      pyinstalive/downloader.py

+ 6 - 0
pyinstalive/downloader.py

@@ -190,6 +190,12 @@ def stitch_video(broadcast_downloader, broadcast, comment_thread_worker):
 			else:
 				broadcast_downloader.stitch(live_mp4_file, cleartempfiles=False)
 			log('[I] Successfully stitched downloaded files into video.', "GREEN")
+			if settings.clear_temp_files.title() == "True":
+				live_folder_to_del = live_mp4_file.split('.mp4')[0] + "_downloads"
+				try:
+					shutil.rmtree(live_folder_to_del)
+				except Exception as e:
+					log("[E] Could not remove temp folder: {:s}".format(str(e)), "RED")
 			if settings.ftp_enabled:
 				try:
 					seperator("GREEN")