mirror of
https://github.com/Relintai/ytdl_link_gen.git
synced 2024-12-20 01:16:50 +01:00
Only wait if a channel download happened.
This commit is contained in:
parent
0c6cfd452a
commit
00470654f5
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user