Only wait if a channel download happened.

This commit is contained in:
Relintai 2023-08-25 18:30:14 +02:00
parent 0c6cfd452a
commit 00470654f5
1 changed files with 11 additions and 2 deletions

View File

@ -651,6 +651,8 @@ class ChannelEntry:
video_file_data = None
was_cached = False
def parse_config_line(self, l):
#d = {
@ -687,6 +689,8 @@ class ChannelEntry:
#self.output_command_data_file = "result/" + self.category + "/dl.sh"
self.output_command_data_file = "dl.sh"
self.was_cached = False
def load_data(self):
if not os.path.exists(self.data_file) or not os.path.isfile(self.data_file):
@ -739,6 +743,8 @@ class ChannelEntry:
with open(self.temp_data_file) as f:
data = json.load(f)
self.was_cached = True
return data
with YTDLNew(ydl_opts) as ydl:
@ -839,10 +845,13 @@ if command == "gen":
ce.process()
ce.unload_data()
if not ce.was_cached:
# TODO make this customizable from the command line
sleep_range(10, 5)
ce = None
collected = gc.collect()
print("Garbage collector: collected", "%d objects." % collected)
# TODO make this customizable from the commadn line
sleep_range(10, 5)